SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
Powershell as a hacking tool
2019
Yossi Sassi
White h^t ha‫כ‬ker & InfoSec Researcher
yossi_sassi
Whoami Y1nTh35h3ll
• ~30 years of keyboard access & guitar playing
• Researcher, White h^t hacker (Finance, Military/Gov)
• Co-Founder @ CyberArt, Board Member @ Javelin Networks
• AD Protector, Pow3r5he11 consultant/trainer, CISSP, etc…
What we’ll talk about
• 10 tips (out of gazillion..) for PS for hackers
• Some of our cool research ;)
What is PowerShell?
• Perceived as “MS shell for IT/Sys admins”
–For hackers it’s a totally different story ;)
• CMD « on steroids »
• Windows LoTL heaven
• Ideal for post-exploitation
• Runs on Windows/Linux/MacOS, open source
• Based on .net fx, works with objects
1. Invoke/Execute any text stream
• Run in-memory without touching disk (fileless)
• IE (non visible)
• msxml2
• Net.WebClient
• Invoke-WebRequest (aliases: curl, wget, iwr)
2. Harness the power of .Net
• [Net.WebUtility]::UrlEncode("/insider profiles/")
• ("heLlo wOrld").ToCharArray() | % {
[char]::IsUpper($_)}
• [convert]::ToBase64String($([System.Text.Enc
oding]::Unicode.GetBytes("shutdown /r /t 0")))
3. Convert any to any
• Xml, json, html, bytes, whatever.
• Export/Import, ConvertTo/From
4. Phish admin creds one-liner
• $c = $Host.ui.PromptForCredential("Microsoft
Outlook","Please enter your
credentials","$env:userdomain$env:username","")
• Can expand it to Windows.Security.Credentials.UI
(See @Dviros CredLeaker)
Under the .net framework hood…
5. There is no spoon…
• Powershell.exe is just a spoon.
System.management.automation runs the show
• Run Powershell (code) without PowerShell(.exe)
• Run Powershell from binary without running the
binary process
6. Run C# directly, local & remote
• Add-Type
• Utilize $using, ${function:functionName} to
deliver ANY local variables & functions to remote
sessions
7. Get Objects from apps/scripts
• Convert any string output to customized objects
–Intuitive, no RegEx
• In-mem (on the fly) or template file
8. Multiple encodings, Compression,
Buffers, Threads, ShellCode…
• Prepare advanced payloads
• Investigate PowerShell attacks
But..
What about PowerShell defenses??
• Execution Policies (Signed Scripts)
• Script Block Logging
• Module Logging
• Transcriptions
• ConstrainedLanguage
• Protected Event Logging *
• + AMSI
9. (Un)Protected Event Logging
• Think “ransomware” for event logs ;)
• Leverage PS defense w/CMS for the Red team
10. Total bypass of PS defenses
• Based on research by Omer Yair & team
– Bypass AMSI / Logging / Auditing with Invisi-Shell
• Does not require administrative privileges(!)
– ICLRProfiling::AttachProfiler()
– COR_PROFILER_PATH environment variable
• Gets JIT-ed code address
• Hooks powershell (system.management.automation),
hooks system.core.dll, hooks all calls to AMSI
– No hook functions – simple replace with RET opcode
• Detaches after hooks are placed
Key Takeaways
• PowerShell Rocks!
• PS Blue Team defenses exist
– Use/Loose PS v2.0 wherever possible
• Or use invisi-Shell
– Obfuscate vs. Look for potentially malicious activity (IEX,
.DownloadString, TOKEN_ADJUST_PRIVILEGES etc)
• For Windows + Automation = ultimate choice
– Writing payloads is fun! And robust.
– Multiple powershell offensive frameworks can be found online
Links & THANKS!
– Dor Amit (co-founder @ CyberArtSecurity.com)
– Omer Yair (EndPoint Team Lead @ Symantec TDAD)
– Team @ Javelin Networks (nowadays Symantec TDAD)
– Omer’s talk in last DerbyCon
• https://www.youtube.com/watch?v=Y3oMEiySxcc
• … CHECK HIM OUT this upcoming DefCon @ main stage !
• https://github.com/YossiSassi
T.hanks!
Yossi_Sassi

Más contenido relacionado

La actualidad más candente

Linux Security, from Concept to Tooling
Linux Security, from Concept to ToolingLinux Security, from Concept to Tooling
Linux Security, from Concept to ToolingMichael Boelen
 
Nodejsvault austin2019
Nodejsvault austin2019Nodejsvault austin2019
Nodejsvault austin2019Taswar Bhatti
 
Securing Search Data in the Cloud
Securing Search Data in the CloudSecuring Search Data in the Cloud
Securing Search Data in the CloudSearchStax
 
NoSQL Exploitation Framework
NoSQL Exploitation FrameworkNoSQL Exploitation Framework
NoSQL Exploitation FrameworkFrancis Alexander
 
Bsides Puerto Rico 2017-2018
Bsides Puerto Rico 2017-2018Bsides Puerto Rico 2017-2018
Bsides Puerto Rico 2017-2018Esteban Rodriguez
 
Handling of compromised Linux systems
Handling of compromised Linux systemsHandling of compromised Linux systems
Handling of compromised Linux systemsMichael Boelen
 
Defcon Moscow #0x0A - Mikhail Firstov "Hacking routers as Web Hacker"
Defcon Moscow #0x0A - Mikhail Firstov "Hacking routers as Web Hacker"Defcon Moscow #0x0A - Mikhail Firstov "Hacking routers as Web Hacker"
Defcon Moscow #0x0A - Mikhail Firstov "Hacking routers as Web Hacker"Defcon Moscow
 
Mainframe Hacking - Derbycon 5.0
Mainframe Hacking - Derbycon 5.0Mainframe Hacking - Derbycon 5.0
Mainframe Hacking - Derbycon 5.0bigendiansmalls
 
10 tips to improve your website security
10 tips to improve your website security10 tips to improve your website security
10 tips to improve your website securitySucuri
 
Sword Slides Cetissig 120208 Public
Sword Slides Cetissig 120208 PublicSword Slides Cetissig 120208 Public
Sword Slides Cetissig 120208 PublicJISC CETIS
 
Cloud patterns forwardjs April Ottawa 2019
Cloud patterns forwardjs April Ottawa 2019Cloud patterns forwardjs April Ottawa 2019
Cloud patterns forwardjs April Ottawa 2019Taswar Bhatti
 
Securing Your MongoDB Deployment
Securing Your MongoDB DeploymentSecuring Your MongoDB Deployment
Securing Your MongoDB DeploymentMongoDB
 
SANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedSANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedMicah Hoffman
 
Understanding the Solr Security Framekwork: Presented by Anshum Gupta, IBM
Understanding the Solr Security Framekwork: Presented by Anshum Gupta, IBMUnderstanding the Solr Security Framekwork: Presented by Anshum Gupta, IBM
Understanding the Solr Security Framekwork: Presented by Anshum Gupta, IBMLucidworks
 
Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...
Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...
Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...David Timothy Strauss
 
Securing Your Web Applications in ColdFusion
Securing Your Web Applications in ColdFusionSecuring Your Web Applications in ColdFusion
Securing Your Web Applications in ColdFusionDenard Springle IV
 

La actualidad más candente (20)

Linux Security, from Concept to Tooling
Linux Security, from Concept to ToolingLinux Security, from Concept to Tooling
Linux Security, from Concept to Tooling
 
Nodejsvault austin2019
Nodejsvault austin2019Nodejsvault austin2019
Nodejsvault austin2019
 
Securing Search Data in the Cloud
Securing Search Data in the CloudSecuring Search Data in the Cloud
Securing Search Data in the Cloud
 
NoSQL Exploitation Framework
NoSQL Exploitation FrameworkNoSQL Exploitation Framework
NoSQL Exploitation Framework
 
Bsides Puerto Rico 2017-2018
Bsides Puerto Rico 2017-2018Bsides Puerto Rico 2017-2018
Bsides Puerto Rico 2017-2018
 
Handling of compromised Linux systems
Handling of compromised Linux systemsHandling of compromised Linux systems
Handling of compromised Linux systems
 
Vault 101
Vault 101Vault 101
Vault 101
 
Defcon Moscow #0x0A - Mikhail Firstov "Hacking routers as Web Hacker"
Defcon Moscow #0x0A - Mikhail Firstov "Hacking routers as Web Hacker"Defcon Moscow #0x0A - Mikhail Firstov "Hacking routers as Web Hacker"
Defcon Moscow #0x0A - Mikhail Firstov "Hacking routers as Web Hacker"
 
Mainframe Hacking - Derbycon 5.0
Mainframe Hacking - Derbycon 5.0Mainframe Hacking - Derbycon 5.0
Mainframe Hacking - Derbycon 5.0
 
Html5 hacking
Html5 hackingHtml5 hacking
Html5 hacking
 
10 tips to improve your website security
10 tips to improve your website security10 tips to improve your website security
10 tips to improve your website security
 
Sword Slides Cetissig 120208 Public
Sword Slides Cetissig 120208 PublicSword Slides Cetissig 120208 Public
Sword Slides Cetissig 120208 Public
 
Cloud patterns forwardjs April Ottawa 2019
Cloud patterns forwardjs April Ottawa 2019Cloud patterns forwardjs April Ottawa 2019
Cloud patterns forwardjs April Ottawa 2019
 
Securing Your MongoDB Deployment
Securing Your MongoDB DeploymentSecuring Your MongoDB Deployment
Securing Your MongoDB Deployment
 
SANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedSANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection Exploited
 
Vault
VaultVault
Vault
 
Understanding the Solr Security Framekwork: Presented by Anshum Gupta, IBM
Understanding the Solr Security Framekwork: Presented by Anshum Gupta, IBMUnderstanding the Solr Security Framekwork: Presented by Anshum Gupta, IBM
Understanding the Solr Security Framekwork: Presented by Anshum Gupta, IBM
 
Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...
Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...
Don't Build "Death Star" Security - O'Reilly Software Architecture Conference...
 
SQL Server 2017 CLR
SQL Server 2017 CLRSQL Server 2017 CLR
SQL Server 2017 CLR
 
Securing Your Web Applications in ColdFusion
Securing Your Web Applications in ColdFusionSecuring Your Web Applications in ColdFusion
Securing Your Web Applications in ColdFusion
 

Similar a Powershell-hacking-1nTh35h311-BSidesTLV2019

Try {stuff} Catch {hopefully not} - Evading Detection & Covering Tracks
Try {stuff} Catch {hopefully not} - Evading Detection & Covering TracksTry {stuff} Catch {hopefully not} - Evading Detection & Covering Tracks
Try {stuff} Catch {hopefully not} - Evading Detection & Covering TracksYossi Sassi
 
IoT mit Rust programmieren
IoT mit Rust programmierenIoT mit Rust programmieren
IoT mit Rust programmierenLars Gregori
 
Portable PHP
Portable PHPPortable PHP
Portable PHPweltling
 
Defcon 25 Packet Hacking Village - Finding Your Way to Domain Access
Defcon 25 Packet Hacking Village - Finding Your Way to Domain AccessDefcon 25 Packet Hacking Village - Finding Your Way to Domain Access
Defcon 25 Packet Hacking Village - Finding Your Way to Domain Accesseightbit
 
STIX Patterning: Viva la revolución!
STIX Patterning: Viva la revolución!STIX Patterning: Viva la revolución!
STIX Patterning: Viva la revolución!treyka
 
Introducing PS>Attack: An offensive PowerShell toolkit
Introducing PS>Attack: An offensive PowerShell toolkitIntroducing PS>Attack: An offensive PowerShell toolkit
Introducing PS>Attack: An offensive PowerShell toolkitjaredhaight
 
Power on, Powershell
Power on, PowershellPower on, Powershell
Power on, PowershellRoo7break
 
Lua in games
Lua in gamesLua in games
Lua in gamesSon Aris
 
EMBA - Firmware analysis DEFCON30 demolabs USA 2022
EMBA - Firmware analysis DEFCON30 demolabs USA 2022EMBA - Firmware analysis DEFCON30 demolabs USA 2022
EMBA - Firmware analysis DEFCON30 demolabs USA 2022MichaelM85042
 
Enemy at the gates: vulnerability research in embedded appliances
Enemy at the gates: vulnerability research in embedded appliances Enemy at the gates: vulnerability research in embedded appliances
Enemy at the gates: vulnerability research in embedded appliances Chris Hernandez
 
Lua in Games
Lua in GamesLua in Games
Lua in Gameswe20
 
01 Metasploit kung fu introduction
01 Metasploit kung fu introduction01 Metasploit kung fu introduction
01 Metasploit kung fu introductionMostafa Abdel-sallam
 
Unity Makes Strength SOURCE Dublin 2013
Unity Makes Strength SOURCE Dublin 2013Unity Makes Strength SOURCE Dublin 2013
Unity Makes Strength SOURCE Dublin 2013Xavier Mertens
 

Similar a Powershell-hacking-1nTh35h311-BSidesTLV2019 (20)

From P0W3R to SH3LL
From P0W3R to SH3LLFrom P0W3R to SH3LL
From P0W3R to SH3LL
 
Try {stuff} Catch {hopefully not} - Evading Detection & Covering Tracks
Try {stuff} Catch {hopefully not} - Evading Detection & Covering TracksTry {stuff} Catch {hopefully not} - Evading Detection & Covering Tracks
Try {stuff} Catch {hopefully not} - Evading Detection & Covering Tracks
 
IoT mit Rust programmieren
IoT mit Rust programmierenIoT mit Rust programmieren
IoT mit Rust programmieren
 
L27
L27L27
L27
 
Portable PHP
Portable PHPPortable PHP
Portable PHP
 
Defcon 25 Packet Hacking Village - Finding Your Way to Domain Access
Defcon 25 Packet Hacking Village - Finding Your Way to Domain AccessDefcon 25 Packet Hacking Village - Finding Your Way to Domain Access
Defcon 25 Packet Hacking Village - Finding Your Way to Domain Access
 
STIX Patterning: Viva la revolución!
STIX Patterning: Viva la revolución!STIX Patterning: Viva la revolución!
STIX Patterning: Viva la revolución!
 
Introducing PS>Attack: An offensive PowerShell toolkit
Introducing PS>Attack: An offensive PowerShell toolkitIntroducing PS>Attack: An offensive PowerShell toolkit
Introducing PS>Attack: An offensive PowerShell toolkit
 
Anatomy of PHP Shells
Anatomy of PHP ShellsAnatomy of PHP Shells
Anatomy of PHP Shells
 
Power on, Powershell
Power on, PowershellPower on, Powershell
Power on, Powershell
 
Bsides tampa
Bsides tampaBsides tampa
Bsides tampa
 
Lua in games
Lua in gamesLua in games
Lua in games
 
EMBA - Firmware analysis DEFCON30 demolabs USA 2022
EMBA - Firmware analysis DEFCON30 demolabs USA 2022EMBA - Firmware analysis DEFCON30 demolabs USA 2022
EMBA - Firmware analysis DEFCON30 demolabs USA 2022
 
Enemy at the gates: vulnerability research in embedded appliances
Enemy at the gates: vulnerability research in embedded appliances Enemy at the gates: vulnerability research in embedded appliances
Enemy at the gates: vulnerability research in embedded appliances
 
Lua in Games
Lua in GamesLua in Games
Lua in Games
 
Unity makes strength
Unity makes strengthUnity makes strength
Unity makes strength
 
01 Metasploit kung fu introduction
01 Metasploit kung fu introduction01 Metasploit kung fu introduction
01 Metasploit kung fu introduction
 
How to build an admin guy
How to build an admin guyHow to build an admin guy
How to build an admin guy
 
Attack on the Core
Attack on the CoreAttack on the Core
Attack on the Core
 
Unity Makes Strength SOURCE Dublin 2013
Unity Makes Strength SOURCE Dublin 2013Unity Makes Strength SOURCE Dublin 2013
Unity Makes Strength SOURCE Dublin 2013
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Último (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Powershell-hacking-1nTh35h311-BSidesTLV2019

  • 1. Powershell as a hacking tool 2019 Yossi Sassi White h^t ha‫כ‬ker & InfoSec Researcher yossi_sassi
  • 2. Whoami Y1nTh35h3ll • ~30 years of keyboard access & guitar playing • Researcher, White h^t hacker (Finance, Military/Gov) • Co-Founder @ CyberArt, Board Member @ Javelin Networks • AD Protector, Pow3r5he11 consultant/trainer, CISSP, etc…
  • 3. What we’ll talk about • 10 tips (out of gazillion..) for PS for hackers • Some of our cool research ;)
  • 4. What is PowerShell? • Perceived as “MS shell for IT/Sys admins” –For hackers it’s a totally different story ;) • CMD « on steroids » • Windows LoTL heaven • Ideal for post-exploitation • Runs on Windows/Linux/MacOS, open source • Based on .net fx, works with objects
  • 5. 1. Invoke/Execute any text stream • Run in-memory without touching disk (fileless) • IE (non visible) • msxml2 • Net.WebClient • Invoke-WebRequest (aliases: curl, wget, iwr)
  • 6. 2. Harness the power of .Net • [Net.WebUtility]::UrlEncode("/insider profiles/") • ("heLlo wOrld").ToCharArray() | % { [char]::IsUpper($_)} • [convert]::ToBase64String($([System.Text.Enc oding]::Unicode.GetBytes("shutdown /r /t 0")))
  • 7. 3. Convert any to any • Xml, json, html, bytes, whatever. • Export/Import, ConvertTo/From
  • 8. 4. Phish admin creds one-liner • $c = $Host.ui.PromptForCredential("Microsoft Outlook","Please enter your credentials","$env:userdomain$env:username","") • Can expand it to Windows.Security.Credentials.UI (See @Dviros CredLeaker)
  • 9. Under the .net framework hood…
  • 10.
  • 11. 5. There is no spoon… • Powershell.exe is just a spoon. System.management.automation runs the show • Run Powershell (code) without PowerShell(.exe) • Run Powershell from binary without running the binary process
  • 12. 6. Run C# directly, local & remote • Add-Type • Utilize $using, ${function:functionName} to deliver ANY local variables & functions to remote sessions
  • 13. 7. Get Objects from apps/scripts • Convert any string output to customized objects –Intuitive, no RegEx • In-mem (on the fly) or template file
  • 14. 8. Multiple encodings, Compression, Buffers, Threads, ShellCode… • Prepare advanced payloads • Investigate PowerShell attacks
  • 15. But.. What about PowerShell defenses?? • Execution Policies (Signed Scripts) • Script Block Logging • Module Logging • Transcriptions • ConstrainedLanguage • Protected Event Logging * • + AMSI
  • 16. 9. (Un)Protected Event Logging • Think “ransomware” for event logs ;) • Leverage PS defense w/CMS for the Red team
  • 17.
  • 18. 10. Total bypass of PS defenses • Based on research by Omer Yair & team – Bypass AMSI / Logging / Auditing with Invisi-Shell • Does not require administrative privileges(!) – ICLRProfiling::AttachProfiler() – COR_PROFILER_PATH environment variable • Gets JIT-ed code address • Hooks powershell (system.management.automation), hooks system.core.dll, hooks all calls to AMSI – No hook functions – simple replace with RET opcode • Detaches after hooks are placed
  • 19. Key Takeaways • PowerShell Rocks! • PS Blue Team defenses exist – Use/Loose PS v2.0 wherever possible • Or use invisi-Shell – Obfuscate vs. Look for potentially malicious activity (IEX, .DownloadString, TOKEN_ADJUST_PRIVILEGES etc) • For Windows + Automation = ultimate choice – Writing payloads is fun! And robust. – Multiple powershell offensive frameworks can be found online
  • 20. Links & THANKS! – Dor Amit (co-founder @ CyberArtSecurity.com) – Omer Yair (EndPoint Team Lead @ Symantec TDAD) – Team @ Javelin Networks (nowadays Symantec TDAD) – Omer’s talk in last DerbyCon • https://www.youtube.com/watch?v=Y3oMEiySxcc • … CHECK HIM OUT this upcoming DefCon @ main stage ! • https://github.com/YossiSassi