SlideShare a Scribd company logo
Pwning with Powershell
Using Powershell for recon, shells and escalation
Hi, I’m Jared.
 Sysadmin for 10 years
 Likes to take pictures
 Likes to break things
 I write stuff occasionally here: https://words.photosandtext.com
 I twitter stuff @jaredhaight
What is Powershell?
And how do I use it?
What is Powershell?
 Powershell is an object oriented scripting language
 Kind of a mix between C# and bash
 It is the default method to manage a lot of Windows services now
 Two components included
 Powershell.exe – The shell
 Powershell_ise.exe – The IDE
How do I use it?
 Variable assignment
 $foo = ‘bar’
 For loops
 ForEach ($obj in $list) {write-host $obj}
 Logic
 If ($obj –eq “cha-ha.com”) {write-host “those guys are pretty cool”}
 RTFM
 Get-help command
 Get-help command -examples
Why do I want to know this crap?
 Powershell is what admins are using to manage their boxes now (the good ones
at least)
 It actually is powerful
 Full access to .NET objects
 Can interpret C# code
Quick and Dirty Powershell Web Server
#Courtesy of ObsecureSec (http://obscuresecurity.blogspot.com/2014/05/dirty-powershell-
webserver.html)
$Hso = New-Object Net.HttpListener
$Hso.Prefixes.Add("http://+:8000/")
$Hso.Start()
While ($Hso.IsListening)
{
$HC = $Hso.GetContext()
$HRes = $HC.Response
$HRes.Headers.Add("Content-Type","text/plain")
$Buf = [Text.Encoding]::UTF8.GetBytes((GC (Join-Path $Pwd ($HC.Request).RawUrl)))
$HRes.ContentLength64 = $Buf.Length
$HRes.OutputStream.Write($Buf,0,$Buf.Length)
$HRes.Close()
}
$Hso.Stop()
“PowerShell: Microsoft's post-
exploitation language”
-Sun Tzu
“PowerShell: Microsoft's post-
exploitation language”
-@obscuresec
What is being done with Powershell in
Infosec?
 Everything
 Recon
 Backdoors
 Shells
 Exfiltration
 Escalation
 Incident Response
 Forensics
 Reverse Engineering
 Big focus on “in memory” attacks. Payloads don’t touch the disk.
Pentesting Frameworks
The fun stuff
Veil PowerTools
 https://github.com/Veil-Framework/PowerTools
 Part of the Veil Framework
 Components
 PewPewPew – Run command against a list of servers without touching the HDD
 PowerBreach – Offers a variety of ways to trigger backdoor code
 PowerPick – Allows the execution of PS code without powershell.exe
 PowerUp – Assists with local escalation
 PowerView – Network awareness tool
Cool stuff in Powertools
 PowerView
 Invoke-SearchFiles – File search on local or remote hosts
 Get-NetDomainControllers
 Get-NetGroup – Gets members of a specified group
 Get-NetLoggedon – Get users logged into a server
 Invoke-StealthUserHunter – Finds Home Directory server and checks for active sessions from
specific users accounts
 Invoke-FindLocalAdminAccess – Finds machines that the current account has admins rights on
 Get-ExploitableSystems – Cross references systems against common metasploit payloads
Cool stuff in Powertools
 PowerUp
 Get-ServiceEXEPerms – finds services where the user has write access to the exe
 Invoke-ServiceUserAdd – Generates an exe that adds a given user to a local group and replaces
a service exe with it.
 PowerBreach
 Inoke-DeadUserBackdoor – Triggers a payload if a given user account is deleted
 Invoke-EventLogBackdoor – Triggers a payload if a specific user fails an RDP login
Cool stuff in Powertools
 PewPewPew
 My favorite name for anything ever.
 Invoke-MassCommand – Runs a given command against a bunch of servers
 Invoke-MassMimikatz – Runs mimikatz against all the things.
PowerSploit
 https://github.com/mattifestation/PowerSploit
 Modules
 AV Bypass
 Code Execution
 Exfiltration
 Mayhem
 Persistence
 Recon
 Script Modification – Modifies scripts to act as payloads (encoding, encryption)
Cool things in Powersploit
 Exfiltration
 Invoke-NinjaCopy – Copies a file from NTFS by reading the raw volume and parsing NTFS structures
 Inoke-Mimikatz – Loads Mimikatz into memory and runs it. Doesn’t touch disk when run against a
remove computer.
 Get-Keystrokes – Keystroke logger
 Get-GPPPassword – Browses Group Policy and finds passwords
 Get-TimedScreenshot – Takes screenshots on an interval
 Code Execution
 Invoke-Shellcode – Inject shellcode into a specified process
Cool things in Powersploit
 Mayhem
 Set-MasterBootRecord – Writes a string to the MBR
 Set-CriticalProcess - BSOD
Nishang
 https://github.com/samratashok/nishang
 Modules
 Too many to list
 Backdoors
 Escalation
 Gather
 Pivot
 Scans
 Shells
 Client
Cool things about Nishang
 Client
 Out-Word – Creates a word file (or infect an existing one) with a macro that downloads and runs
a powershell script
 Also see: Out-Excel, Out-HTA, Out-CHM, Out-Shortcut and Out-Java
 Backdoors
 DNS_Txt_Pwnage – A backdoor that receives commands through DNS TXT queries
 Gupt-Backdoor – A backdoor that receives commands from WLAN SSIDs (without connecting)
.DESCRIPTION
Gupt looks for a specially crafted Wireless Network Name/SSID from list of all avaliable
networks. It matches first four characters of each SSID with the parameter MagicString.
On a match, if the 5th character is a 'c', rest of the SSID name is considered to be a
command and executed. If the 5th character is a 'u', rest of the SSID is considered the
id part of Google URL Shortener and a script is downloaded and executed in memory from
the URL. See examples for usage.
Cool things about Nishang
 Gather
 Copy-VSS – Copy SAM, SECURITY and AD database using Volume Shadow Copy
 Get-PassHashes – Dumps local hashes
 Invoke-MimikatzWdigestDowngrade – Downgrades wdigest settings so that plain text passwords
can be retrieved from LSA memory (to bypass protections implemented in Windows 2012 and 8.1)
 Shells
 Invoke-PSGcat – Executes commands stored in a gmail account
 Invoke-PowerShellTCP – Interactive bind or reverse shell
 Utility
 Do-Exfiltration – Send data to Pastebin, Gmail, Webserver or out as DNS TXT query
Now a demo
Taped before a live home audience.
The Situation
 Loki is a disgruntled web developer
 Thor also works here, but he’s not part of this demo
 Also Tony Stark is the IT guy.
Getting local admin
 Loki is an unprivileged user on his computer (He’s just in the “Domain Users” group)
 Because Loki is a webdev, he has a local development environment installed on his
machine.
 This environment was installed with XAMPP, an easy to use package of PHP, MySQL and
Apache.
 In the following video, Loki finds that the Apache exe is writable. He then overwrites the
Apache exe with an exe that creates a new local admin account.
 Finally he restarts his computer to force the service to restart.
Dumping hashes, exfiltrating and
escalating
 Now that Loki has a local admin account (“mshackman”) he can dump the hashes for
the local computer
 He then exfiltrates this data to pastbin
 Finally he disables the wdigest protections in Windows 8.1 in preparation for tricking IT into
logging into his computer.
Dumping Active Directory
 Loki convinced Tony Stark to login into his computer and is now able to dump Starks
password using mimikatz
 With Domain Admin credentials, Loki copies “Copy-VSS.ps1” to a Domain Control and
then proceeds to dump the Active Directory database for offline assessment.
Who to watch
 @harmj0y – Veil PowerTools
 @sixdub – Veil Powertools
 @mattifestation (Matt Graeber)– PowerSploit
 @obscuresec – Misc. Awesomeness
 @clymb3r – Misc. Awesomeness
 @nikhil_mitt – Nishang
 @jaredcatkinson – Invoke-IR
Fin
 Questions?
 @jaredhaight

More Related Content

What's hot

The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting ClassThe Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
Rob Fuller
 
Adventures in Asymmetric Warfare
Adventures in Asymmetric WarfareAdventures in Asymmetric Warfare
Adventures in Asymmetric Warfare
Will Schroeder
 
Wielding a cortana
Wielding a cortanaWielding a cortana
Wielding a cortana
Will Schroeder
 
Pwnstaller
PwnstallerPwnstaller
Pwnstaller
Will Schroeder
 
PSConfEU - Building an Empire with PowerShell
PSConfEU - Building an Empire with PowerShellPSConfEU - Building an Empire with PowerShell
PSConfEU - Building an Empire with PowerShell
Will Schroeder
 
Obfuscating The Empire
Obfuscating The EmpireObfuscating The Empire
Obfuscating The Empire
Ryan Cobb
 
Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017
Daniel Bohannon
 
PowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege EscalationPowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege Escalation
Will Schroeder
 
Kautilya: Teensy beyond shell
Kautilya: Teensy beyond shellKautilya: Teensy beyond shell
Kautilya: Teensy beyond shell
Nikhil Mittal
 
Defending Your "Gold"
Defending Your "Gold"Defending Your "Gold"
Defending Your "Gold"
Will Schroeder
 
PowerShell for Cyber Warriors - Bsides Knoxville 2016
PowerShell for Cyber Warriors - Bsides Knoxville 2016PowerShell for Cyber Warriors - Bsides Knoxville 2016
PowerShell for Cyber Warriors - Bsides Knoxville 2016
Russel Van Tuyl
 
Getting Started With PowerShell Scripting
Getting Started With PowerShell ScriptingGetting Started With PowerShell Scripting
Getting Started With PowerShell Scripting
Ravikanth Chaganti
 
A Year in the Empire
A Year in the EmpireA Year in the Empire
A Year in the Empire
Will Schroeder
 
A Case Study in Attacking KeePass
A Case Study in Attacking KeePassA Case Study in Attacking KeePass
A Case Study in Attacking KeePass
Will Schroeder
 
Derbycon - Passing the Torch
Derbycon - Passing the TorchDerbycon - Passing the Torch
Derbycon - Passing the Torch
Will Schroeder
 
PowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue KidPowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue Kid
Matthew Johnson
 
I Hunt Sys Admins
I Hunt Sys AdminsI Hunt Sys Admins
I Hunt Sys Admins
Will Schroeder
 
More fun using Kautilya
More fun using KautilyaMore fun using Kautilya
More fun using Kautilya
Nikhil Mittal
 
Power of linked list
Power of linked listPower of linked list
Power of linked list
Peter Hlavaty
 
Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)
Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)
Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)Rob Fuller
 

What's hot (20)

The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting ClassThe Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
 
Adventures in Asymmetric Warfare
Adventures in Asymmetric WarfareAdventures in Asymmetric Warfare
Adventures in Asymmetric Warfare
 
Wielding a cortana
Wielding a cortanaWielding a cortana
Wielding a cortana
 
Pwnstaller
PwnstallerPwnstaller
Pwnstaller
 
PSConfEU - Building an Empire with PowerShell
PSConfEU - Building an Empire with PowerShellPSConfEU - Building an Empire with PowerShell
PSConfEU - Building an Empire with PowerShell
 
Obfuscating The Empire
Obfuscating The EmpireObfuscating The Empire
Obfuscating The Empire
 
Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017
 
PowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege EscalationPowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege Escalation
 
Kautilya: Teensy beyond shell
Kautilya: Teensy beyond shellKautilya: Teensy beyond shell
Kautilya: Teensy beyond shell
 
Defending Your "Gold"
Defending Your "Gold"Defending Your "Gold"
Defending Your "Gold"
 
PowerShell for Cyber Warriors - Bsides Knoxville 2016
PowerShell for Cyber Warriors - Bsides Knoxville 2016PowerShell for Cyber Warriors - Bsides Knoxville 2016
PowerShell for Cyber Warriors - Bsides Knoxville 2016
 
Getting Started With PowerShell Scripting
Getting Started With PowerShell ScriptingGetting Started With PowerShell Scripting
Getting Started With PowerShell Scripting
 
A Year in the Empire
A Year in the EmpireA Year in the Empire
A Year in the Empire
 
A Case Study in Attacking KeePass
A Case Study in Attacking KeePassA Case Study in Attacking KeePass
A Case Study in Attacking KeePass
 
Derbycon - Passing the Torch
Derbycon - Passing the TorchDerbycon - Passing the Torch
Derbycon - Passing the Torch
 
PowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue KidPowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue Kid
 
I Hunt Sys Admins
I Hunt Sys AdminsI Hunt Sys Admins
I Hunt Sys Admins
 
More fun using Kautilya
More fun using KautilyaMore fun using Kautilya
More fun using Kautilya
 
Power of linked list
Power of linked listPower of linked list
Power of linked list
 
Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)
Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)
Attacker Ghost Stories (CarolinaCon / Area41 / RVASec)
 

Viewers also liked

Try harder or go home
Try harder or go homeTry harder or go home
Try harder or go home
jaredhaight
 
PSConfEU - Offensive Active Directory (With PowerShell!)
PSConfEU - Offensive Active Directory (With PowerShell!)PSConfEU - Offensive Active Directory (With PowerShell!)
PSConfEU - Offensive Active Directory (With PowerShell!)
Will Schroeder
 
Lateral Movement with PowerShell
Lateral Movement with PowerShellLateral Movement with PowerShell
Lateral Movement with PowerShell
kieranjacobsen
 
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON
 
Client side attacks using PowerShell
Client side attacks using PowerShellClient side attacks using PowerShell
Client side attacks using PowerShell
Nikhil Mittal
 
PowerShell - PowerForensics
PowerShell - PowerForensicsPowerShell - PowerForensics
PowerShell - PowerForensics
Taha İslam YILMAZ
 
Bringing your game to the global scene - Toge Productions
Bringing your game to the global scene - Toge ProductionsBringing your game to the global scene - Toge Productions
Bringing your game to the global scene - Toge Productions
Tech in Asia ID
 
The art and science of storytelling - WPCampus Version
The art and science of storytelling - WPCampus VersionThe art and science of storytelling - WPCampus Version
The art and science of storytelling - WPCampus Version
Donna Talarico
 
Internet of things applications covering industrial domain
Internet of things applications covering industrial domainInternet of things applications covering industrial domain
Internet of things applications covering industrial domain
Dev Bhattacharya
 
Bridging the Gap
Bridging the GapBridging the Gap
Bridging the Gap
Will Schroeder
 
44CON London 2015: NTFS Analysis with PowerForensics
44CON London 2015: NTFS Analysis with PowerForensics44CON London 2015: NTFS Analysis with PowerForensics
44CON London 2015: NTFS Analysis with PowerForensics
Jared Atkinson
 
Fundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege EscalationFundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege Escalation
nullthreat
 
BSidesDC - **** it, Do It Live (PowerShell Digital Forensics)
BSidesDC - **** it, Do It Live (PowerShell Digital Forensics)BSidesDC - **** it, Do It Live (PowerShell Digital Forensics)
BSidesDC - **** it, Do It Live (PowerShell Digital Forensics)
Jared Atkinson
 
ColdFusion for Penetration Testers
ColdFusion for Penetration TestersColdFusion for Penetration Testers
ColdFusion for Penetration Testers
Chris Gates
 
Drilling deeper with Veil's PowerTools
Drilling deeper with Veil's PowerToolsDrilling deeper with Veil's PowerTools
Drilling deeper with Veil's PowerTools
Will Schroeder
 
PowerShell Functions
PowerShell FunctionsPowerShell Functions
PowerShell Functions
mikepfeiffer
 

Viewers also liked (20)

Try harder or go home
Try harder or go homeTry harder or go home
Try harder or go home
 
PSConfEU - Offensive Active Directory (With PowerShell!)
PSConfEU - Offensive Active Directory (With PowerShell!)PSConfEU - Offensive Active Directory (With PowerShell!)
PSConfEU - Offensive Active Directory (With PowerShell!)
 
Lateral Movement with PowerShell
Lateral Movement with PowerShellLateral Movement with PowerShell
Lateral Movement with PowerShell
 
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
 
Client side attacks using PowerShell
Client side attacks using PowerShellClient side attacks using PowerShell
Client side attacks using PowerShell
 
PowerShell - PowerForensics
PowerShell - PowerForensicsPowerShell - PowerForensics
PowerShell - PowerForensics
 
Bringing your game to the global scene - Toge Productions
Bringing your game to the global scene - Toge ProductionsBringing your game to the global scene - Toge Productions
Bringing your game to the global scene - Toge Productions
 
The art and science of storytelling - WPCampus Version
The art and science of storytelling - WPCampus VersionThe art and science of storytelling - WPCampus Version
The art and science of storytelling - WPCampus Version
 
Story+telling
Story+tellingStory+telling
Story+telling
 
Internet of things applications covering industrial domain
Internet of things applications covering industrial domainInternet of things applications covering industrial domain
Internet of things applications covering industrial domain
 
Bridging the Gap
Bridging the GapBridging the Gap
Bridging the Gap
 
44CON London 2015: NTFS Analysis with PowerForensics
44CON London 2015: NTFS Analysis with PowerForensics44CON London 2015: NTFS Analysis with PowerForensics
44CON London 2015: NTFS Analysis with PowerForensics
 
Fundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege EscalationFundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege Escalation
 
BSidesDC - **** it, Do It Live (PowerShell Digital Forensics)
BSidesDC - **** it, Do It Live (PowerShell Digital Forensics)BSidesDC - **** it, Do It Live (PowerShell Digital Forensics)
BSidesDC - **** it, Do It Live (PowerShell Digital Forensics)
 
ColdFusion for Penetration Testers
ColdFusion for Penetration TestersColdFusion for Penetration Testers
ColdFusion for Penetration Testers
 
Drilling deeper with Veil's PowerTools
Drilling deeper with Veil's PowerToolsDrilling deeper with Veil's PowerTools
Drilling deeper with Veil's PowerTools
 
PowerShell crashcourse
PowerShell crashcoursePowerShell crashcourse
PowerShell crashcourse
 
PowerShell crash course
PowerShell crash coursePowerShell crash course
PowerShell crash course
 
PowerShell custom properties
PowerShell custom propertiesPowerShell custom properties
PowerShell custom properties
 
PowerShell Functions
PowerShell FunctionsPowerShell Functions
PowerShell Functions
 

Similar to Pwning with powershell

Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
Boulos Dib
 
Bettercap
BettercapBettercap
Lumen
LumenLumen
Learn you some Ansible for great good!
Learn you some Ansible for great good!Learn you some Ansible for great good!
Learn you some Ansible for great good!
David Lapsley
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellSharePoint Saturday NY
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellSharePoint Saturday NY
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabricandymccurdy
 
PowerShell for SharePoint Developers
PowerShell for SharePoint DevelopersPowerShell for SharePoint Developers
PowerShell for SharePoint Developers
Boulos Dib
 
Symfony finally swiped right on envvars
Symfony finally swiped right on envvarsSymfony finally swiped right on envvars
Symfony finally swiped right on envvars
Sam Marley-Jarrett
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariJoseph Scott
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
Achieve Internet
 
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Hitesh Mohapatra
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabricandymccurdy
 
Fabric - a server management tool from Instagram
Fabric - a server management tool from InstagramFabric - a server management tool from Instagram
Fabric - a server management tool from Instagram
Jay Ren
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
adrian_nye
 
PuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into OperationsPuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into Operationsgrim_radical
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
Alessandro Franceschi
 
Build Automation 101
Build Automation 101Build Automation 101
Build Automation 101
Martin Jackson
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
David Padbury
 
Apache Spark Workshop, Apr. 2016, Euangelos Linardos
Apache Spark Workshop, Apr. 2016, Euangelos LinardosApache Spark Workshop, Apr. 2016, Euangelos Linardos
Apache Spark Workshop, Apr. 2016, Euangelos Linardos
Euangelos Linardos
 

Similar to Pwning with powershell (20)

Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
Bettercap
BettercapBettercap
Bettercap
 
Lumen
LumenLumen
Lumen
 
Learn you some Ansible for great good!
Learn you some Ansible for great good!Learn you some Ansible for great good!
Learn you some Ansible for great good!
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
PowerShell for SharePoint Developers
PowerShell for SharePoint DevelopersPowerShell for SharePoint Developers
PowerShell for SharePoint Developers
 
Symfony finally swiped right on envvars
Symfony finally swiped right on envvarsSymfony finally swiped right on envvars
Symfony finally swiped right on envvars
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Fabric - a server management tool from Instagram
Fabric - a server management tool from InstagramFabric - a server management tool from Instagram
Fabric - a server management tool from Instagram
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
PuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into OperationsPuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into Operations
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
 
Build Automation 101
Build Automation 101Build Automation 101
Build Automation 101
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
Apache Spark Workshop, Apr. 2016, Euangelos Linardos
Apache Spark Workshop, Apr. 2016, Euangelos LinardosApache Spark Workshop, Apr. 2016, Euangelos Linardos
Apache Spark Workshop, Apr. 2016, Euangelos Linardos
 

Recently uploaded

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 

Recently uploaded (20)

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 

Pwning with powershell

  • 1. Pwning with Powershell Using Powershell for recon, shells and escalation
  • 2. Hi, I’m Jared.  Sysadmin for 10 years  Likes to take pictures  Likes to break things  I write stuff occasionally here: https://words.photosandtext.com  I twitter stuff @jaredhaight
  • 3. What is Powershell? And how do I use it?
  • 4. What is Powershell?  Powershell is an object oriented scripting language  Kind of a mix between C# and bash  It is the default method to manage a lot of Windows services now  Two components included  Powershell.exe – The shell  Powershell_ise.exe – The IDE
  • 5. How do I use it?  Variable assignment  $foo = ‘bar’  For loops  ForEach ($obj in $list) {write-host $obj}  Logic  If ($obj –eq “cha-ha.com”) {write-host “those guys are pretty cool”}  RTFM  Get-help command  Get-help command -examples
  • 6. Why do I want to know this crap?  Powershell is what admins are using to manage their boxes now (the good ones at least)  It actually is powerful  Full access to .NET objects  Can interpret C# code
  • 7. Quick and Dirty Powershell Web Server #Courtesy of ObsecureSec (http://obscuresecurity.blogspot.com/2014/05/dirty-powershell- webserver.html) $Hso = New-Object Net.HttpListener $Hso.Prefixes.Add("http://+:8000/") $Hso.Start() While ($Hso.IsListening) { $HC = $Hso.GetContext() $HRes = $HC.Response $HRes.Headers.Add("Content-Type","text/plain") $Buf = [Text.Encoding]::UTF8.GetBytes((GC (Join-Path $Pwd ($HC.Request).RawUrl))) $HRes.ContentLength64 = $Buf.Length $HRes.OutputStream.Write($Buf,0,$Buf.Length) $HRes.Close() } $Hso.Stop()
  • 10. What is being done with Powershell in Infosec?  Everything  Recon  Backdoors  Shells  Exfiltration  Escalation  Incident Response  Forensics  Reverse Engineering  Big focus on “in memory” attacks. Payloads don’t touch the disk.
  • 12. Veil PowerTools  https://github.com/Veil-Framework/PowerTools  Part of the Veil Framework  Components  PewPewPew – Run command against a list of servers without touching the HDD  PowerBreach – Offers a variety of ways to trigger backdoor code  PowerPick – Allows the execution of PS code without powershell.exe  PowerUp – Assists with local escalation  PowerView – Network awareness tool
  • 13. Cool stuff in Powertools  PowerView  Invoke-SearchFiles – File search on local or remote hosts  Get-NetDomainControllers  Get-NetGroup – Gets members of a specified group  Get-NetLoggedon – Get users logged into a server  Invoke-StealthUserHunter – Finds Home Directory server and checks for active sessions from specific users accounts  Invoke-FindLocalAdminAccess – Finds machines that the current account has admins rights on  Get-ExploitableSystems – Cross references systems against common metasploit payloads
  • 14. Cool stuff in Powertools  PowerUp  Get-ServiceEXEPerms – finds services where the user has write access to the exe  Invoke-ServiceUserAdd – Generates an exe that adds a given user to a local group and replaces a service exe with it.  PowerBreach  Inoke-DeadUserBackdoor – Triggers a payload if a given user account is deleted  Invoke-EventLogBackdoor – Triggers a payload if a specific user fails an RDP login
  • 15. Cool stuff in Powertools  PewPewPew  My favorite name for anything ever.  Invoke-MassCommand – Runs a given command against a bunch of servers  Invoke-MassMimikatz – Runs mimikatz against all the things.
  • 16. PowerSploit  https://github.com/mattifestation/PowerSploit  Modules  AV Bypass  Code Execution  Exfiltration  Mayhem  Persistence  Recon  Script Modification – Modifies scripts to act as payloads (encoding, encryption)
  • 17. Cool things in Powersploit  Exfiltration  Invoke-NinjaCopy – Copies a file from NTFS by reading the raw volume and parsing NTFS structures  Inoke-Mimikatz – Loads Mimikatz into memory and runs it. Doesn’t touch disk when run against a remove computer.  Get-Keystrokes – Keystroke logger  Get-GPPPassword – Browses Group Policy and finds passwords  Get-TimedScreenshot – Takes screenshots on an interval  Code Execution  Invoke-Shellcode – Inject shellcode into a specified process
  • 18. Cool things in Powersploit  Mayhem  Set-MasterBootRecord – Writes a string to the MBR  Set-CriticalProcess - BSOD
  • 19. Nishang  https://github.com/samratashok/nishang  Modules  Too many to list  Backdoors  Escalation  Gather  Pivot  Scans  Shells  Client
  • 20. Cool things about Nishang  Client  Out-Word – Creates a word file (or infect an existing one) with a macro that downloads and runs a powershell script  Also see: Out-Excel, Out-HTA, Out-CHM, Out-Shortcut and Out-Java  Backdoors  DNS_Txt_Pwnage – A backdoor that receives commands through DNS TXT queries  Gupt-Backdoor – A backdoor that receives commands from WLAN SSIDs (without connecting)
  • 21. .DESCRIPTION Gupt looks for a specially crafted Wireless Network Name/SSID from list of all avaliable networks. It matches first four characters of each SSID with the parameter MagicString. On a match, if the 5th character is a 'c', rest of the SSID name is considered to be a command and executed. If the 5th character is a 'u', rest of the SSID is considered the id part of Google URL Shortener and a script is downloaded and executed in memory from the URL. See examples for usage.
  • 22.
  • 23. Cool things about Nishang  Gather  Copy-VSS – Copy SAM, SECURITY and AD database using Volume Shadow Copy  Get-PassHashes – Dumps local hashes  Invoke-MimikatzWdigestDowngrade – Downgrades wdigest settings so that plain text passwords can be retrieved from LSA memory (to bypass protections implemented in Windows 2012 and 8.1)  Shells  Invoke-PSGcat – Executes commands stored in a gmail account  Invoke-PowerShellTCP – Interactive bind or reverse shell  Utility  Do-Exfiltration – Send data to Pastebin, Gmail, Webserver or out as DNS TXT query
  • 24. Now a demo Taped before a live home audience.
  • 25. The Situation  Loki is a disgruntled web developer  Thor also works here, but he’s not part of this demo  Also Tony Stark is the IT guy.
  • 26. Getting local admin  Loki is an unprivileged user on his computer (He’s just in the “Domain Users” group)  Because Loki is a webdev, he has a local development environment installed on his machine.  This environment was installed with XAMPP, an easy to use package of PHP, MySQL and Apache.  In the following video, Loki finds that the Apache exe is writable. He then overwrites the Apache exe with an exe that creates a new local admin account.  Finally he restarts his computer to force the service to restart.
  • 27. Dumping hashes, exfiltrating and escalating  Now that Loki has a local admin account (“mshackman”) he can dump the hashes for the local computer  He then exfiltrates this data to pastbin  Finally he disables the wdigest protections in Windows 8.1 in preparation for tricking IT into logging into his computer.
  • 28. Dumping Active Directory  Loki convinced Tony Stark to login into his computer and is now able to dump Starks password using mimikatz  With Domain Admin credentials, Loki copies “Copy-VSS.ps1” to a Domain Control and then proceeds to dump the Active Directory database for offline assessment.
  • 29. Who to watch  @harmj0y – Veil PowerTools  @sixdub – Veil Powertools  @mattifestation (Matt Graeber)– PowerSploit  @obscuresec – Misc. Awesomeness  @clymb3r – Misc. Awesomeness  @nikhil_mitt – Nishang  @jaredcatkinson – Invoke-IR

Editor's Notes

  1. This presentation is designed to cover why Powershell is important to us red teamers and to give an overview of what people are doing with Powershell in the pentesting community.
  2. Windows admins are learning that powershell is the way to manage growing infrastructure. This means that it will be prevalent in the environments that we come across. We should learn how to use it for our needs.
  3. An example of how powerful and flexible PS is. A webserver in 13 lines of code.
  4. Mimikatz is a tool used to dump hashes and credentials out of memory on a Windows box. Invoke-MassMimikatz runs mimikatz in memory so as not to trip most AV.
  5. Description of Grupt-Backdoor from the PS file.