SlideShare uma empresa Scribd logo
1 de 30
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

Mais conteúdo relacionado

Mais procurados

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 ClassRob Fuller
 
Adventures in Asymmetric Warfare
Adventures in Asymmetric WarfareAdventures in Asymmetric Warfare
Adventures in Asymmetric WarfareWill Schroeder
 
PSConfEU - Building an Empire with PowerShell
PSConfEU - Building an Empire with PowerShellPSConfEU - Building an Empire with PowerShell
PSConfEU - Building an Empire with PowerShellWill Schroeder
 
Obfuscating The Empire
Obfuscating The EmpireObfuscating The Empire
Obfuscating The EmpireRyan Cobb
 
Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017Daniel Bohannon
 
PowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege EscalationPowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege EscalationWill Schroeder
 
Kautilya: Teensy beyond shell
Kautilya: Teensy beyond shellKautilya: Teensy beyond shell
Kautilya: Teensy beyond shellNikhil Mittal
 
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 2016Russel Van Tuyl
 
Getting Started With PowerShell Scripting
Getting Started With PowerShell ScriptingGetting Started With PowerShell Scripting
Getting Started With PowerShell ScriptingRavikanth Chaganti
 
A Case Study in Attacking KeePass
A Case Study in Attacking KeePassA Case Study in Attacking KeePass
A Case Study in Attacking KeePassWill Schroeder
 
Derbycon - Passing the Torch
Derbycon - Passing the TorchDerbycon - Passing the Torch
Derbycon - Passing the TorchWill Schroeder
 
PowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue KidPowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue KidMatthew Johnson
 
More fun using Kautilya
More fun using KautilyaMore fun using Kautilya
More fun using KautilyaNikhil Mittal
 
Power of linked list
Power of linked listPower of linked list
Power of linked listPeter 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
 

Mais procurados (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)
 

Destaque

Try harder or go home
Try harder or go homeTry harder or go home
Try harder or go homejaredhaight
 
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 PowerShellkieranjacobsen
 
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 PowerShell44CON
 
Client side attacks using PowerShell
Client side attacks using PowerShellClient side attacks using PowerShell
Client side attacks using PowerShellNikhil Mittal
 
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 ProductionsTech 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 VersionDonna 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 domainDev Bhattacharya
 
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 PowerForensicsJared Atkinson
 
Fundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege EscalationFundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege Escalationnullthreat
 
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 TestersChris Gates
 
Drilling deeper with Veil's PowerTools
Drilling deeper with Veil's PowerToolsDrilling deeper with Veil's PowerTools
Drilling deeper with Veil's PowerToolsWill Schroeder
 
PowerShell Functions
PowerShell FunctionsPowerShell Functions
PowerShell Functionsmikepfeiffer
 

Destaque (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
 

Semelhante a Pwning with powershell

Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShellBoulos Dib
 
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 DevelopersBoulos Dib
 
Symfony finally swiped right on envvars
Symfony finally swiped right on envvarsSymfony finally swiped right on envvars
Symfony finally swiped right on envvarsSam 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 PuppetAchieve 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 InstagramJay Ren
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy Systemadrian_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 PuppetAlessandro Franceschi
 
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 backendDavid 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 LinardosEuangelos Linardos
 

Semelhante a 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
 

Último

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 

Último (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

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

Notas do Editor

  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.