SlideShare une entreprise Scribd logo
1  sur  50
© Black Hills Information Security | @BHInfoSecurity
Mike Felch & Beau Bullock
A few novel techniques for exploiting Microsoft “features”
© Black Hills Information Security | @BHInfoSecurity
Who We Are
• Mike Felch - @ustayready
• Pentest / Red team at BHIS
• Involved w/ OWASP Orlando & BSides Orlando
• Host of Tradecraft Security Weekly
• Host of CoinSec Podcast
• Beau Bullock - @dafthack
•Pentest / Red team at BHIS
• Host of Tradecraft Security Weekly
• Host of CoinSec Podcast
• Avid OWA enthusiast
© Black Hills Information Security | @BHInfoSecurity
What We’re Covering
1. Mystery #1: Attribution
2. Mystery #2: Reconnaissance
3. Mystery #3: Persistence
4. Mystery #4: Weaponization
5. Questions / Comments
© Black Hills Information Security | @BHInfoSecurity
Mystery 1:
The curious case of
event logs with no
attribution
© Black Hills Information Security | @BHInfoSecurity
Failed Login Alerting
• Customers have vastly different alerting setups
• Some log pretty much everything they can…
• … others log nothing
• Password attack detections have been hit or
miss…
• Password spraying
• 1 attempt per user within observation window
• Doesn’t lock out accounts & usually results in a
low number of failed logins per account
Access Denied: You’ve failed to meet the minimum meme threshold
© Black Hills Information Security | @BHInfoSecurity
Blue Team Game on Par
• DomainPasswordSpray - PowerShell script
to perform password spraying within a
domain
• https://github.com/dafthack/DomainPasswo
rdSpray
• This generates failed login events at the
DC
• Had a customer who alerted
• Started thinking of new ways to evade
• What are some other protocols you can
authenticate to that are tied to AD?
Classic domain spraying...
© Black Hills Information Security | @BHInfoSecurity
Evading Failed Login
Detection
• One possibility is OWA
• Failed logins are in the IIS logs, not in the
Windows Security log
• But… are you watching the IIS logs?
• Many of our customers have seen us use or
talk about MailSniper and have adjusted
their logs accordingly.
• Where else could we try authenticating?
OWA spraying...
© Black Hills Information Security | @BHInfoSecurity
Evading Failed Login
Detection
• What about RDP?
• Tested out xFreeRDP from Linux against a
Windows Server
• To our surprise the failed login event did not
contain the source IP address…
• Hostname was in the log… but xFreeRDP has
an option to set the client hostname (wat?)
• Set out to write a spraying tool for RDP
RDP spraying?
© Black Hills Information Security | @BHInfoSecurity
NLA FTW
• Why was there no IP in the log?
• It turns out RDP w/ NLA (Network Layer Authentication) doesn’t log
source IP in the security log
• NLA pre-authenticates prior to RDP access
• Causes Logon type 3 (Network) instead of 10 (RemoteInteractive)
• Allegedly there is supposed to be a log with the IP located here:
Applications and Services Logs > Microsoft > Windows >
RemoteDesktopServices-RdpCoreTS > Operational (Event ID 140)
© Black Hills Information Security | @BHInfoSecurity
What log?
• This is what a failed RDP using NLA should look like:
• …But authenticating via NLA doesn’t <ALWAYS> generate this log…
Because this alert is very, VERY misleading.
• It turns out this alert only fires when the USER is invalid.
• Valid user + invalid password = No eventID 140 log
Remember this is an “Applications and Services Log”... not “Security”
© Black Hills Information Security | @BHInfoSecurity
DEMO:
RDPSpray PoC
© Black Hills Information Security | @BHInfoSecurity
What’s next?
• Here are some items on my “todo” list with
this:
• Build a standalone tool to do this from
Windows
• Add functionality to quickly find servers with
NLA enabled for RDP
© Black Hills Information Security | @BHInfoSecurity
How do I detect/stop this?
• Windows Server 2016 logs the IP
• For other versions:
• Correlate the Applications and Services logs
with the Security logs
• See: http://purerds.org/remote-desktop-
security/auditing-remote-desktop-services-logon-
failures-1/
• It might be worth looking at firewall logs for
alerting on access to port 3389 multiple times
from the same system
© Black Hills Information Security | @BHInfoSecurity
Mystery 2:
The mysterious Azure
Active Directory sync
© Black Hills Information Security | @BHInfoSecurity
External Active Directory
• You can query Active Directory
• Know everyone in an org
• Know AD group memberships
• Know user device & versions
• Create “guest” AD users & MFA devices
• … with only a low-privileged set of creds
• *Externally*
What if I told you, in most circumstances...
© Black Hills Information Security | @BHInfoSecurity
First, A Quick Glimpse
DirSync
Azure AD Sync
+ Forefront Identity Manager
Azure AD Connect
On-Prem: Azure AD Connect sync engine
Azure: Azure AD Connect sync service
http://www.windowstricks.in/2015/06/difference-between-dirsync-azure-ad-sync-and-azure-ad-connect.html
© Black Hills Information Security | @BHInfoSecurity
Azure Password Hashing
https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-password-hash-synchronization
Password Sync
1. MD4 hash isn't sent, SHA256 hash of hash is
2. DC sends salt
3. Avoids PTH primitive for on-prem
4. Envelope decrypted and hash stored
Authentication
1. Requires 2nd auth if not using Seamless SSO
2. MD4+usersalt+PBKDF2+HMAC-SHA256
3. Compares cloud hash with on-prem hash
4. Session created
© Black Hills Information Security | @BHInfoSecurity
So, what does this mean?
• Users: Identify Users & Read Properties
• Groups: Identify Security Groups
• Applications: Identify Attack Surfaces
• Devices: Identify Device Info for users
• Directory: Identify Domains & Partners
• Roles & Scopes: Identify All Memberships
• + more!
*Add a limited access guest account*
With a single set of phished/sprayed credentials...
https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/users-default-permissions
© Black Hills Information Security | @BHInfoSecurity
Let’s Do It!
• az login
• az ad user list
• az ad group list
• az ad group member list --group='<group name>'
• az vm list
Azure CLIAzure Portal
• Connect-AzureRmAccount
• Get-AzureRmADUser
• Get-AzureRmADGroup
• Get-AzureRmADGroupMember -GroupObjectId <group id>
• Get-AzureRmVM
AzureRM
AzureRM: https://docs.microsoft.com/en-us/powershell/azure/overview
AZ CLI: https://docs.microsoft.com/en-us/cli/azure/
© Black Hills Information Security | @BHInfoSecurity
DEMO:
Azure CLI PoC
© Black Hills Information Security | @BHInfoSecurity
Lock Things Down
Azure Portal Configuration
Azure AD Conditional Access
??? umm.. okay, now what?
© Black Hills Information Security | @BHInfoSecurity
Azure CLI Work-around
Set-MsolCompanySettings -UsersPermissionToReadOtherUsersEnabled $false
Phew! (Thanks Derrick Rauch)
© Black Hills Information Security | @BHInfoSecurity
Mystery 3:
The force-fed Microsoft
Outlook hook
© Black Hills Information Security | @BHInfoSecurity
O365 Creds, so what?
• Maybe you password sprayed
• Perhaps you phished some creds
• But is it useful to pivot internally or persist?
• You can obviously harvest data via
email/SharePoint/Azure
• You may have heard of using Outlook
“rules”
• This has been patched by Microsoft though…
• Let’s talk about some new hotness
Gained access to creds, now what?
© Black Hills Information Security | @BHInfoSecurity
Microsoft Add-Ins
• Microsoft allows for add-ins to various
products
• There are two types of Outlook Add-ins
• Legacy COM or VSTO add-ins
• Code physically installed on desktop client
• Web Add-ins
• No code installed on client
• Manifest file points to JavaScript/HTML that
loads in the browser
Let’s have a chat about Add-ins
© Black Hills Information Security | @BHInfoSecurity
Outlook Web Add-Ins
• WEB ADD-INS SYNC ACROSS WEB CLIENT
BROWSERS & DESKTOP CLIENTS
• I’ll give you a sec to contemplate life…
• … ready?
• So here is the attack path:
• Attacker gets creds
• Adds malicious Add-in to Outlook web client
• Malicious add-in syncs across victims browser
sessions and desktop client
Here’s the kicker…
© Black Hills Information Security | @BHInfoSecurity
Some Hurdles to Jump
• No.
• When you install an add-in it shows up as an
icon
• Typically the user would have to click to run
• Pinnable Taskpanes make it so the user
doesn’t even have to click anything
• Attacker opens add-in
• Clicks the pin icon
• The pinned add-in syncs to the victims browser
• Next email victim opens the pinned taskpane
runs add-in
So does the user have to click something?
© Black Hills Information Security | @BHInfoSecurity
Outlook Add-in Potential
• Well… you can literally point the browser at
any code you want.
• Every time the add-in launches it uses the
Manifest file provided to point the client at a
web server
• We can host whatever html/js we want
• Note: Outlook desktop client uses Edge
browser
• Let’s walkthrough a few examples
Ok so what can these add-ins do?
© Black Hills Information Security | @BHInfoSecurity
How to Install Add-In
Settings > Manage add-ins > My add-ins > Add a custom add-in > Add from
file and point it to your manifest.xml file
© Black Hills Information Security | @BHInfoSecurity
How to Install Add-In
• Use Visual Studio to create a new “Outlook
Web Add-In”
• Host the html/js files on your own web
server, point to it in the manifest.xml file
• Outlook requires the site be HTTPS
• Here’s a basic tutorial for creating an Add-in
that reads some attributes of email items
• https://docs.microsoft.com/en-
us/outlook/add-ins/quick-start?tabs=visual-
studio
Server-side setup
© Black Hills Information Security | @BHInfoSecurity
Outlook Add-in Backdoor
• Create an add-in that reads the content of
email
• Forward content of email to attacker
• Delete sent email so no trace of being sent
• Allows for having access to 2fa codes,
password resets etc…
• We have PoC code for doing this on desktop
client and will share web client code soon
Steal emails and other stuff...
© Black Hills Information Security | @BHInfoSecurity
Outlook Add-In Browser
Hook
• Browser Exploitation Framework (BeEF)
• Inject hook.js into add-in
• Can now utilize BeEF plugins
• Enumerate system/browser/LAN
• Makes it easy to inject additional iframes
• Can pop credential box, deploy hta, etc...
• More research is needed on the potential for
internal pivoting via browser hook
We can hook the users browser with BeEF!
© Black Hills Information Security | @BHInfoSecurity
Outlook Add-In Crypto-
Miner
• Can totally inject the Coinhive miner
• JavaScript based cryptocurrency miner
• Uses CPU to mine Monero (and others)
• Listed as #1 malware throughout this year
• This works and will demo shortly
XMR when moon sir?
© Black Hills Information Security | @BHInfoSecurity
Add-In Mass Deployment?
• O365 admin can config add-ins too
• Can deploy to all users
• Make it mandatory that it’s
installed
• They can enforce so that no user
can uninstall
• Use your imagination for how bad
this could…
What if we are an O365 admin?
© Black Hills Information Security | @BHInfoSecurity
DEMO:
Outlook Add-In PoC
© Black Hills Information Security | @BHInfoSecurity
Outlook Add-In Defense
• Ok let’s go blue team:
• All of this requires an attacker has a cred
• 2FA and strong password policy are your friends
but not perfect (See Credsniper)
• …?
• Any ideas?
Thx for the nightmares… what now?
© Black Hills Information Security | @BHInfoSecurity
Mystery 4:
The silently weaponized
Windows Kernel
© Black Hills Information Security | @BHInfoSecurity
Windows Kernel: WNF
• Publish/Subscribe Windows Subsystem
• Uses State names to track
• User-mode/Kernel Notifications
• Persistent/Volatile Data Storage
• Cross-platform Mobile/App/Xbox
• Undocumented/Potentially Undetectable
• Sub before pub!
Windows Notification Facility
*Major props to Alex Ionescu & Gabrielle Viala*
© Black Hills Information Security | @BHInfoSecurity
WNF State Details
• State names: 64-bit GUID structure
• Lifetime
• Well-known: Reserved by Windows
• Permanent: Bound beyond reboot
• Volatile: Bound until reboot
• Temporary: Bound until process exit
• Scope
• User/Process/Session/Global
• Security Descriptors / DACL
WNF State Names/Lifetime/Scope
© Black Hills Information Security | @BHInfoSecurity
WNF Kernel Fun
• Lot’s of low-level/high-level calls
• Ntdll subscribes to low-level on process behalf
• Zw* vs Rtl* / Ex* / Nt*
• Code-execution in subscriber on event
• Rtl* in host event logs :(
• Create a secret IPC layer between processes
• Across process/user/kernel boundaries
• Hide data/binary in state names
• Inject data/code into processes
© Black Hills Information Security | @BHInfoSecurity
WNF Kernel API Calls
Low-level API
Consume:
ZwQueryWnfStateData
Publish:
ZwUpdateWnfStateData
Create:
ZwCreateWnfStateName
Delete:
ZwDeleteWnfStateName
High-level API
Subscribe:
RtlSubscribeWnfStateChangeNotificatio
n
© Black Hills Information Security | @BHInfoSecurity
Research: Guidance
• State Names are found in registry
• HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlNotifications
• HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionNotifications
• HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionVolatileNotifications
• Windows Internal Names & Descriptions
• Symbols in perf_nt_c.dll via Microsoft ADK
• NT Kernel Hooks: https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/etw/callouts/hookid.htm
• NativeAPI Signatures
• *WNF*
• https://processhacker.sourceforge.io/doc/ntzwapi_8h_source.html
Get Started Researching
© Black Hills Information Security | @BHInfoSecurity
Research: CasperWNF
© Black Hills Information Security | @BHInfoSecurity
WNF Hidden Data
1. Code execution runs Stage 1 payload
2. Stage 1 checks if Stage 2 payload in State name
a. Yes: run Stage 2
b. No: Fetch Stage 2 from C2
i. Publish in State name then run
3. Stage 2 subscribe to shutdown/user-presence
a. Shutdown callback
i. Write Stage 1 to disk for start-up
b. User-presence callback
i. Change jitter? Commands? Nuke the box?
WNF Side-channel Data Persistence
© Black Hills Information Security | @BHInfoSecurity
WNF Subscriptions
Stage 1: Dropper
Stage 2: Malware
Shutdown State
WNF_SYS_SHUTDOWN_IN_PROGRESS
0x4195173EA3BC0875
User-presence State
WNF_SEB_USER_PRESENT
0x41840B3EA3BC6875
‘Nuke the box’ State
WNF_HOLO_FORCE_ROOM_BOUNDARY
0xE8A0125A3BC2835c
© Black Hills Information Security | @BHInfoSecurity
DEMO:
Weaponized WNF PoC
© Black Hills Information Security | @BHInfoSecurity
WNF Attack Mitigations
• Event Tracing for Windows
• Only works for Rtl* function calls not Zw*
• Hooks NT Kernel Logger Events
• Hooking Ntdll system calls
• Great idea if you're crazy or writing malware
• Monitor read/writes to registry keys
• System service which is loud
• Filter on specific entries? *shrug*
TLDR; we’re screwed...
© Black Hills Information Security | @BHInfoSecurity
Finishing Up:
Dear Microsoft...
© Black Hills Information Security | @BHInfoSecurity
Dear Microsoft...
A few requests...
• WNF Documentation & Native API logging
• Azure Portal locked-down by default
• Azure AD Conditional access w/o upgrade costs
• Fix the phantom host info w/ RDP NLA
• Make it easy for O365 admins to find rogue add-ins
© Black Hills Information Security | @BHInfoSecurity
Questions?
• Twitter
• Mike - @ustayready
• Beau - @dafthack
• Black Hills Information Security
• http://www.blackhillsinfosec.com/
• Code from demos
• https://github.com/ustayready/CasperStager
• https://github.com/ustayready/CasperWNF
• https://github.com/dafthack/RDPSpray

Contenu connexe

Tendances

Shopify’s $25k Bug Report, and the Cluster Takeover That Didn’t Happen
Shopify’s $25k Bug Report, and the Cluster Takeover That Didn’t HappenShopify’s $25k Bug Report, and the Cluster Takeover That Didn’t Happen
Shopify’s $25k Bug Report, and the Cluster Takeover That Didn’t HappenGreg Castle
 
A Google Event You Won't Forget
A Google Event You Won't ForgetA Google Event You Won't Forget
A Google Event You Won't ForgetBeau Bullock
 
Pwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShellPwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShellBeau Bullock
 
Travelocalypse: It's Dangerous Business, Hacker, Going Out Your Front Door
Travelocalypse: It's Dangerous Business, Hacker, Going Out Your Front DoorTravelocalypse: It's Dangerous Business, Hacker, Going Out Your Front Door
Travelocalypse: It's Dangerous Business, Hacker, Going Out Your Front DoorBeau Bullock
 
Pentest Apocalypse - SANSFIRE 2016 Edition
Pentest Apocalypse - SANSFIRE 2016 EditionPentest Apocalypse - SANSFIRE 2016 Edition
Pentest Apocalypse - SANSFIRE 2016 EditionBeau Bullock
 
How to Build Your Own Physical Pentesting Go-bag
How to Build Your Own Physical Pentesting Go-bagHow to Build Your Own Physical Pentesting Go-bag
How to Build Your Own Physical Pentesting Go-bagBeau Bullock
 
Fade from Whitehat... to Black
Fade from Whitehat... to BlackFade from Whitehat... to Black
Fade from Whitehat... to BlackBeau Bullock
 
Attacker's Perspective of Active Directory
Attacker's Perspective of Active DirectoryAttacker's Perspective of Active Directory
Attacker's Perspective of Active DirectorySunny Neo
 
Automating Attacks Against Office365 - BsidesPDX 2016
Automating Attacks Against Office365 - BsidesPDX 2016Automating Attacks Against Office365 - BsidesPDX 2016
Automating Attacks Against Office365 - BsidesPDX 2016Karl Fosaaen
 
Red Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite PerimeterRed Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite PerimeterMike Felch
 
Externally Testing Modern AD Domains - Arcticcon
Externally Testing Modern AD Domains - ArcticconExternally Testing Modern AD Domains - Arcticcon
Externally Testing Modern AD Domains - ArcticconKarl Fosaaen
 
Wi-Fi Hotspot Attacks
Wi-Fi Hotspot AttacksWi-Fi Hotspot Attacks
Wi-Fi Hotspot AttacksGreg Foss
 
Lares from LOW to PWNED
Lares from LOW to PWNEDLares from LOW to PWNED
Lares from LOW to PWNEDChris Gates
 
DevSecCon Singapore 2019: Workshop - Burp extension writing workshop
DevSecCon Singapore 2019: Workshop - Burp extension writing workshopDevSecCon Singapore 2019: Workshop - Burp extension writing workshop
DevSecCon Singapore 2019: Workshop - Burp extension writing workshopDevSecCon
 
Do you lose sleep at night?
Do you lose sleep at night?Do you lose sleep at night?
Do you lose sleep at night?Nathan Van Gheem
 
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016Chris Gates
 
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani GolandCODE BLUE
 
Prowler: BlackHat Europe Arsenal 2018
Prowler: BlackHat Europe Arsenal 2018Prowler: BlackHat Europe Arsenal 2018
Prowler: BlackHat Europe Arsenal 2018Toni de la Fuente
 
Mind the gap - Troopers 2016
Mind the gap  - Troopers 2016Mind the gap  - Troopers 2016
Mind the gap - Troopers 2016Casey Smith
 

Tendances (20)

Shopify’s $25k Bug Report, and the Cluster Takeover That Didn’t Happen
Shopify’s $25k Bug Report, and the Cluster Takeover That Didn’t HappenShopify’s $25k Bug Report, and the Cluster Takeover That Didn’t Happen
Shopify’s $25k Bug Report, and the Cluster Takeover That Didn’t Happen
 
A Google Event You Won't Forget
A Google Event You Won't ForgetA Google Event You Won't Forget
A Google Event You Won't Forget
 
Pwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShellPwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShell
 
Travelocalypse: It's Dangerous Business, Hacker, Going Out Your Front Door
Travelocalypse: It's Dangerous Business, Hacker, Going Out Your Front DoorTravelocalypse: It's Dangerous Business, Hacker, Going Out Your Front Door
Travelocalypse: It's Dangerous Business, Hacker, Going Out Your Front Door
 
OAuth 2.0 Security Reinforced
OAuth 2.0 Security ReinforcedOAuth 2.0 Security Reinforced
OAuth 2.0 Security Reinforced
 
Pentest Apocalypse - SANSFIRE 2016 Edition
Pentest Apocalypse - SANSFIRE 2016 EditionPentest Apocalypse - SANSFIRE 2016 Edition
Pentest Apocalypse - SANSFIRE 2016 Edition
 
How to Build Your Own Physical Pentesting Go-bag
How to Build Your Own Physical Pentesting Go-bagHow to Build Your Own Physical Pentesting Go-bag
How to Build Your Own Physical Pentesting Go-bag
 
Fade from Whitehat... to Black
Fade from Whitehat... to BlackFade from Whitehat... to Black
Fade from Whitehat... to Black
 
Attacker's Perspective of Active Directory
Attacker's Perspective of Active DirectoryAttacker's Perspective of Active Directory
Attacker's Perspective of Active Directory
 
Automating Attacks Against Office365 - BsidesPDX 2016
Automating Attacks Against Office365 - BsidesPDX 2016Automating Attacks Against Office365 - BsidesPDX 2016
Automating Attacks Against Office365 - BsidesPDX 2016
 
Red Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite PerimeterRed Team Tactics for Cracking the GSuite Perimeter
Red Team Tactics for Cracking the GSuite Perimeter
 
Externally Testing Modern AD Domains - Arcticcon
Externally Testing Modern AD Domains - ArcticconExternally Testing Modern AD Domains - Arcticcon
Externally Testing Modern AD Domains - Arcticcon
 
Wi-Fi Hotspot Attacks
Wi-Fi Hotspot AttacksWi-Fi Hotspot Attacks
Wi-Fi Hotspot Attacks
 
Lares from LOW to PWNED
Lares from LOW to PWNEDLares from LOW to PWNED
Lares from LOW to PWNED
 
DevSecCon Singapore 2019: Workshop - Burp extension writing workshop
DevSecCon Singapore 2019: Workshop - Burp extension writing workshopDevSecCon Singapore 2019: Workshop - Burp extension writing workshop
DevSecCon Singapore 2019: Workshop - Burp extension writing workshop
 
Do you lose sleep at night?
Do you lose sleep at night?Do you lose sleep at night?
Do you lose sleep at night?
 
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
 
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland
[CB16] Facebook Malware: Tag Me If You Can by Ido Naor & Dani Goland
 
Prowler: BlackHat Europe Arsenal 2018
Prowler: BlackHat Europe Arsenal 2018Prowler: BlackHat Europe Arsenal 2018
Prowler: BlackHat Europe Arsenal 2018
 
Mind the gap - Troopers 2016
Mind the gap  - Troopers 2016Mind the gap  - Troopers 2016
Mind the gap - Troopers 2016
 

Similaire à Covert Attack Mystery Box: A few novel techniques for exploiting Microsoft “features”

Secure your Azure Web App 2019
Secure your Azure Web App 2019Secure your Azure Web App 2019
Secure your Azure Web App 2019Frans Lytzen
 
Secure your web app presentation
Secure your web app presentationSecure your web app presentation
Secure your web app presentationFrans Lytzen
 
Getting Started in Pentesting the Cloud: Azure
Getting Started in Pentesting the Cloud: AzureGetting Started in Pentesting the Cloud: Azure
Getting Started in Pentesting the Cloud: AzureBeau Bullock
 
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
O365Con18 - Hybrid SharePoint Deep Dive - Thomas VochtenO365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
O365Con18 - Hybrid SharePoint Deep Dive - Thomas VochtenNCCOMMS
 
Hybrid SharePoint - Office 365 & On-prem SharePoint 2013 -part2
Hybrid SharePoint - Office 365 & On-prem SharePoint 2013 -part2Hybrid SharePoint - Office 365 & On-prem SharePoint 2013 -part2
Hybrid SharePoint - Office 365 & On-prem SharePoint 2013 -part2WinWire Technologies Inc
 
Sps toronto introduction to azure functions microsoft flow
Sps toronto introduction to azure functions microsoft flowSps toronto introduction to azure functions microsoft flow
Sps toronto introduction to azure functions microsoft flowVincent Biret
 
Compliance technical controls and you rva sec 2019
Compliance technical controls and you   rva sec 2019Compliance technical controls and you   rva sec 2019
Compliance technical controls and you rva sec 2019Derek Banks
 
Application Security in ASP.NET Core
Application Security in ASP.NET CoreApplication Security in ASP.NET Core
Application Security in ASP.NET CoreNETUserGroupBern
 
Safenet Authentication Service, SAS
Safenet Authentication Service, SASSafenet Authentication Service, SAS
Safenet Authentication Service, SASrobbuddingh
 
Securing .NET Core, ASP.NET Core applications
Securing .NET Core, ASP.NET Core applicationsSecuring .NET Core, ASP.NET Core applications
Securing .NET Core, ASP.NET Core applicationsNETUserGroupBern
 
AWS Chicago user group meetup on June 24, 2014
AWS Chicago user group meetup on June 24, 2014AWS Chicago user group meetup on June 24, 2014
AWS Chicago user group meetup on June 24, 2014CloudCamp Chicago
 
#Techorama belgium 2018 vincent biret deep dive with the #MicrosoftGraph
#Techorama belgium 2018 vincent biret deep dive with the #MicrosoftGraph#Techorama belgium 2018 vincent biret deep dive with the #MicrosoftGraph
#Techorama belgium 2018 vincent biret deep dive with the #MicrosoftGraphVincent Biret
 
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...Vincent Biret
 
Bp101-Can Domino Be Hacked
Bp101-Can Domino Be HackedBp101-Can Domino Be Hacked
Bp101-Can Domino Be HackedHoward Greenberg
 
Proven Practices for Office 365 Deployment, Security and Management
Proven Practices for Office 365 Deployment, Security and ManagementProven Practices for Office 365 Deployment, Security and Management
Proven Practices for Office 365 Deployment, Security and ManagementPerficient, Inc.
 
Building a fence around your Hadoop cluster
Building a fence around your Hadoop clusterBuilding a fence around your Hadoop cluster
Building a fence around your Hadoop clusterlarsfrancke
 
Make your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More SafeMake your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More SafeThuan Ng
 
Envision it SharePoint Extranet Webinar Series - Federation and Office 365
Envision it SharePoint Extranet Webinar Series - Federation and Office 365Envision it SharePoint Extranet Webinar Series - Federation and Office 365
Envision it SharePoint Extranet Webinar Series - Federation and Office 365Envision IT
 
What Does a Full Featured Security Strategy Look Like?
What Does a Full Featured Security Strategy Look Like?What Does a Full Featured Security Strategy Look Like?
What Does a Full Featured Security Strategy Look Like?Precisely
 

Similaire à Covert Attack Mystery Box: A few novel techniques for exploiting Microsoft “features” (20)

Secure your Azure Web App 2019
Secure your Azure Web App 2019Secure your Azure Web App 2019
Secure your Azure Web App 2019
 
Secure your web app presentation
Secure your web app presentationSecure your web app presentation
Secure your web app presentation
 
Getting Started in Pentesting the Cloud: Azure
Getting Started in Pentesting the Cloud: AzureGetting Started in Pentesting the Cloud: Azure
Getting Started in Pentesting the Cloud: Azure
 
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
O365Con18 - Hybrid SharePoint Deep Dive - Thomas VochtenO365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
O365Con18 - Hybrid SharePoint Deep Dive - Thomas Vochten
 
Hybrid SharePoint - Office 365 & On-prem SharePoint 2013 -part2
Hybrid SharePoint - Office 365 & On-prem SharePoint 2013 -part2Hybrid SharePoint - Office 365 & On-prem SharePoint 2013 -part2
Hybrid SharePoint - Office 365 & On-prem SharePoint 2013 -part2
 
Sps toronto introduction to azure functions microsoft flow
Sps toronto introduction to azure functions microsoft flowSps toronto introduction to azure functions microsoft flow
Sps toronto introduction to azure functions microsoft flow
 
Compliance technical controls and you rva sec 2019
Compliance technical controls and you   rva sec 2019Compliance technical controls and you   rva sec 2019
Compliance technical controls and you rva sec 2019
 
Workflows and Digital Signatures
Workflows and Digital SignaturesWorkflows and Digital Signatures
Workflows and Digital Signatures
 
Application Security in ASP.NET Core
Application Security in ASP.NET CoreApplication Security in ASP.NET Core
Application Security in ASP.NET Core
 
Safenet Authentication Service, SAS
Safenet Authentication Service, SASSafenet Authentication Service, SAS
Safenet Authentication Service, SAS
 
Securing .NET Core, ASP.NET Core applications
Securing .NET Core, ASP.NET Core applicationsSecuring .NET Core, ASP.NET Core applications
Securing .NET Core, ASP.NET Core applications
 
AWS Chicago user group meetup on June 24, 2014
AWS Chicago user group meetup on June 24, 2014AWS Chicago user group meetup on June 24, 2014
AWS Chicago user group meetup on June 24, 2014
 
#Techorama belgium 2018 vincent biret deep dive with the #MicrosoftGraph
#Techorama belgium 2018 vincent biret deep dive with the #MicrosoftGraph#Techorama belgium 2018 vincent biret deep dive with the #MicrosoftGraph
#Techorama belgium 2018 vincent biret deep dive with the #MicrosoftGraph
 
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...
#SPFestSea azr302 The SharePoint Framework and the #MicrosoftGraph under ster...
 
Bp101-Can Domino Be Hacked
Bp101-Can Domino Be HackedBp101-Can Domino Be Hacked
Bp101-Can Domino Be Hacked
 
Proven Practices for Office 365 Deployment, Security and Management
Proven Practices for Office 365 Deployment, Security and ManagementProven Practices for Office 365 Deployment, Security and Management
Proven Practices for Office 365 Deployment, Security and Management
 
Building a fence around your Hadoop cluster
Building a fence around your Hadoop clusterBuilding a fence around your Hadoop cluster
Building a fence around your Hadoop cluster
 
Make your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More SafeMake your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More Safe
 
Envision it SharePoint Extranet Webinar Series - Federation and Office 365
Envision it SharePoint Extranet Webinar Series - Federation and Office 365Envision it SharePoint Extranet Webinar Series - Federation and Office 365
Envision it SharePoint Extranet Webinar Series - Federation and Office 365
 
What Does a Full Featured Security Strategy Look Like?
What Does a Full Featured Security Strategy Look Like?What Does a Full Featured Security Strategy Look Like?
What Does a Full Featured Security Strategy Look Like?
 

Dernier

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Dernier (20)

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

Covert Attack Mystery Box: A few novel techniques for exploiting Microsoft “features”

  • 1. © Black Hills Information Security | @BHInfoSecurity Mike Felch & Beau Bullock A few novel techniques for exploiting Microsoft “features”
  • 2. © Black Hills Information Security | @BHInfoSecurity Who We Are • Mike Felch - @ustayready • Pentest / Red team at BHIS • Involved w/ OWASP Orlando & BSides Orlando • Host of Tradecraft Security Weekly • Host of CoinSec Podcast • Beau Bullock - @dafthack •Pentest / Red team at BHIS • Host of Tradecraft Security Weekly • Host of CoinSec Podcast • Avid OWA enthusiast
  • 3. © Black Hills Information Security | @BHInfoSecurity What We’re Covering 1. Mystery #1: Attribution 2. Mystery #2: Reconnaissance 3. Mystery #3: Persistence 4. Mystery #4: Weaponization 5. Questions / Comments
  • 4. © Black Hills Information Security | @BHInfoSecurity Mystery 1: The curious case of event logs with no attribution
  • 5. © Black Hills Information Security | @BHInfoSecurity Failed Login Alerting • Customers have vastly different alerting setups • Some log pretty much everything they can… • … others log nothing • Password attack detections have been hit or miss… • Password spraying • 1 attempt per user within observation window • Doesn’t lock out accounts & usually results in a low number of failed logins per account Access Denied: You’ve failed to meet the minimum meme threshold
  • 6. © Black Hills Information Security | @BHInfoSecurity Blue Team Game on Par • DomainPasswordSpray - PowerShell script to perform password spraying within a domain • https://github.com/dafthack/DomainPasswo rdSpray • This generates failed login events at the DC • Had a customer who alerted • Started thinking of new ways to evade • What are some other protocols you can authenticate to that are tied to AD? Classic domain spraying...
  • 7. © Black Hills Information Security | @BHInfoSecurity Evading Failed Login Detection • One possibility is OWA • Failed logins are in the IIS logs, not in the Windows Security log • But… are you watching the IIS logs? • Many of our customers have seen us use or talk about MailSniper and have adjusted their logs accordingly. • Where else could we try authenticating? OWA spraying...
  • 8. © Black Hills Information Security | @BHInfoSecurity Evading Failed Login Detection • What about RDP? • Tested out xFreeRDP from Linux against a Windows Server • To our surprise the failed login event did not contain the source IP address… • Hostname was in the log… but xFreeRDP has an option to set the client hostname (wat?) • Set out to write a spraying tool for RDP RDP spraying?
  • 9. © Black Hills Information Security | @BHInfoSecurity NLA FTW • Why was there no IP in the log? • It turns out RDP w/ NLA (Network Layer Authentication) doesn’t log source IP in the security log • NLA pre-authenticates prior to RDP access • Causes Logon type 3 (Network) instead of 10 (RemoteInteractive) • Allegedly there is supposed to be a log with the IP located here: Applications and Services Logs > Microsoft > Windows > RemoteDesktopServices-RdpCoreTS > Operational (Event ID 140)
  • 10. © Black Hills Information Security | @BHInfoSecurity What log? • This is what a failed RDP using NLA should look like: • …But authenticating via NLA doesn’t <ALWAYS> generate this log… Because this alert is very, VERY misleading. • It turns out this alert only fires when the USER is invalid. • Valid user + invalid password = No eventID 140 log Remember this is an “Applications and Services Log”... not “Security”
  • 11. © Black Hills Information Security | @BHInfoSecurity DEMO: RDPSpray PoC
  • 12. © Black Hills Information Security | @BHInfoSecurity What’s next? • Here are some items on my “todo” list with this: • Build a standalone tool to do this from Windows • Add functionality to quickly find servers with NLA enabled for RDP
  • 13. © Black Hills Information Security | @BHInfoSecurity How do I detect/stop this? • Windows Server 2016 logs the IP • For other versions: • Correlate the Applications and Services logs with the Security logs • See: http://purerds.org/remote-desktop- security/auditing-remote-desktop-services-logon- failures-1/ • It might be worth looking at firewall logs for alerting on access to port 3389 multiple times from the same system
  • 14. © Black Hills Information Security | @BHInfoSecurity Mystery 2: The mysterious Azure Active Directory sync
  • 15. © Black Hills Information Security | @BHInfoSecurity External Active Directory • You can query Active Directory • Know everyone in an org • Know AD group memberships • Know user device & versions • Create “guest” AD users & MFA devices • … with only a low-privileged set of creds • *Externally* What if I told you, in most circumstances...
  • 16. © Black Hills Information Security | @BHInfoSecurity First, A Quick Glimpse DirSync Azure AD Sync + Forefront Identity Manager Azure AD Connect On-Prem: Azure AD Connect sync engine Azure: Azure AD Connect sync service http://www.windowstricks.in/2015/06/difference-between-dirsync-azure-ad-sync-and-azure-ad-connect.html
  • 17. © Black Hills Information Security | @BHInfoSecurity Azure Password Hashing https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-password-hash-synchronization Password Sync 1. MD4 hash isn't sent, SHA256 hash of hash is 2. DC sends salt 3. Avoids PTH primitive for on-prem 4. Envelope decrypted and hash stored Authentication 1. Requires 2nd auth if not using Seamless SSO 2. MD4+usersalt+PBKDF2+HMAC-SHA256 3. Compares cloud hash with on-prem hash 4. Session created
  • 18. © Black Hills Information Security | @BHInfoSecurity So, what does this mean? • Users: Identify Users & Read Properties • Groups: Identify Security Groups • Applications: Identify Attack Surfaces • Devices: Identify Device Info for users • Directory: Identify Domains & Partners • Roles & Scopes: Identify All Memberships • + more! *Add a limited access guest account* With a single set of phished/sprayed credentials... https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/users-default-permissions
  • 19. © Black Hills Information Security | @BHInfoSecurity Let’s Do It! • az login • az ad user list • az ad group list • az ad group member list --group='<group name>' • az vm list Azure CLIAzure Portal • Connect-AzureRmAccount • Get-AzureRmADUser • Get-AzureRmADGroup • Get-AzureRmADGroupMember -GroupObjectId <group id> • Get-AzureRmVM AzureRM AzureRM: https://docs.microsoft.com/en-us/powershell/azure/overview AZ CLI: https://docs.microsoft.com/en-us/cli/azure/
  • 20. © Black Hills Information Security | @BHInfoSecurity DEMO: Azure CLI PoC
  • 21. © Black Hills Information Security | @BHInfoSecurity Lock Things Down Azure Portal Configuration Azure AD Conditional Access ??? umm.. okay, now what?
  • 22. © Black Hills Information Security | @BHInfoSecurity Azure CLI Work-around Set-MsolCompanySettings -UsersPermissionToReadOtherUsersEnabled $false Phew! (Thanks Derrick Rauch)
  • 23. © Black Hills Information Security | @BHInfoSecurity Mystery 3: The force-fed Microsoft Outlook hook
  • 24. © Black Hills Information Security | @BHInfoSecurity O365 Creds, so what? • Maybe you password sprayed • Perhaps you phished some creds • But is it useful to pivot internally or persist? • You can obviously harvest data via email/SharePoint/Azure • You may have heard of using Outlook “rules” • This has been patched by Microsoft though… • Let’s talk about some new hotness Gained access to creds, now what?
  • 25. © Black Hills Information Security | @BHInfoSecurity Microsoft Add-Ins • Microsoft allows for add-ins to various products • There are two types of Outlook Add-ins • Legacy COM or VSTO add-ins • Code physically installed on desktop client • Web Add-ins • No code installed on client • Manifest file points to JavaScript/HTML that loads in the browser Let’s have a chat about Add-ins
  • 26. © Black Hills Information Security | @BHInfoSecurity Outlook Web Add-Ins • WEB ADD-INS SYNC ACROSS WEB CLIENT BROWSERS & DESKTOP CLIENTS • I’ll give you a sec to contemplate life… • … ready? • So here is the attack path: • Attacker gets creds • Adds malicious Add-in to Outlook web client • Malicious add-in syncs across victims browser sessions and desktop client Here’s the kicker…
  • 27. © Black Hills Information Security | @BHInfoSecurity Some Hurdles to Jump • No. • When you install an add-in it shows up as an icon • Typically the user would have to click to run • Pinnable Taskpanes make it so the user doesn’t even have to click anything • Attacker opens add-in • Clicks the pin icon • The pinned add-in syncs to the victims browser • Next email victim opens the pinned taskpane runs add-in So does the user have to click something?
  • 28. © Black Hills Information Security | @BHInfoSecurity Outlook Add-in Potential • Well… you can literally point the browser at any code you want. • Every time the add-in launches it uses the Manifest file provided to point the client at a web server • We can host whatever html/js we want • Note: Outlook desktop client uses Edge browser • Let’s walkthrough a few examples Ok so what can these add-ins do?
  • 29. © Black Hills Information Security | @BHInfoSecurity How to Install Add-In Settings > Manage add-ins > My add-ins > Add a custom add-in > Add from file and point it to your manifest.xml file
  • 30. © Black Hills Information Security | @BHInfoSecurity How to Install Add-In • Use Visual Studio to create a new “Outlook Web Add-In” • Host the html/js files on your own web server, point to it in the manifest.xml file • Outlook requires the site be HTTPS • Here’s a basic tutorial for creating an Add-in that reads some attributes of email items • https://docs.microsoft.com/en- us/outlook/add-ins/quick-start?tabs=visual- studio Server-side setup
  • 31. © Black Hills Information Security | @BHInfoSecurity Outlook Add-in Backdoor • Create an add-in that reads the content of email • Forward content of email to attacker • Delete sent email so no trace of being sent • Allows for having access to 2fa codes, password resets etc… • We have PoC code for doing this on desktop client and will share web client code soon Steal emails and other stuff...
  • 32. © Black Hills Information Security | @BHInfoSecurity Outlook Add-In Browser Hook • Browser Exploitation Framework (BeEF) • Inject hook.js into add-in • Can now utilize BeEF plugins • Enumerate system/browser/LAN • Makes it easy to inject additional iframes • Can pop credential box, deploy hta, etc... • More research is needed on the potential for internal pivoting via browser hook We can hook the users browser with BeEF!
  • 33. © Black Hills Information Security | @BHInfoSecurity Outlook Add-In Crypto- Miner • Can totally inject the Coinhive miner • JavaScript based cryptocurrency miner • Uses CPU to mine Monero (and others) • Listed as #1 malware throughout this year • This works and will demo shortly XMR when moon sir?
  • 34. © Black Hills Information Security | @BHInfoSecurity Add-In Mass Deployment? • O365 admin can config add-ins too • Can deploy to all users • Make it mandatory that it’s installed • They can enforce so that no user can uninstall • Use your imagination for how bad this could… What if we are an O365 admin?
  • 35. © Black Hills Information Security | @BHInfoSecurity DEMO: Outlook Add-In PoC
  • 36. © Black Hills Information Security | @BHInfoSecurity Outlook Add-In Defense • Ok let’s go blue team: • All of this requires an attacker has a cred • 2FA and strong password policy are your friends but not perfect (See Credsniper) • …? • Any ideas? Thx for the nightmares… what now?
  • 37. © Black Hills Information Security | @BHInfoSecurity Mystery 4: The silently weaponized Windows Kernel
  • 38. © Black Hills Information Security | @BHInfoSecurity Windows Kernel: WNF • Publish/Subscribe Windows Subsystem • Uses State names to track • User-mode/Kernel Notifications • Persistent/Volatile Data Storage • Cross-platform Mobile/App/Xbox • Undocumented/Potentially Undetectable • Sub before pub! Windows Notification Facility *Major props to Alex Ionescu & Gabrielle Viala*
  • 39. © Black Hills Information Security | @BHInfoSecurity WNF State Details • State names: 64-bit GUID structure • Lifetime • Well-known: Reserved by Windows • Permanent: Bound beyond reboot • Volatile: Bound until reboot • Temporary: Bound until process exit • Scope • User/Process/Session/Global • Security Descriptors / DACL WNF State Names/Lifetime/Scope
  • 40. © Black Hills Information Security | @BHInfoSecurity WNF Kernel Fun • Lot’s of low-level/high-level calls • Ntdll subscribes to low-level on process behalf • Zw* vs Rtl* / Ex* / Nt* • Code-execution in subscriber on event • Rtl* in host event logs :( • Create a secret IPC layer between processes • Across process/user/kernel boundaries • Hide data/binary in state names • Inject data/code into processes
  • 41. © Black Hills Information Security | @BHInfoSecurity WNF Kernel API Calls Low-level API Consume: ZwQueryWnfStateData Publish: ZwUpdateWnfStateData Create: ZwCreateWnfStateName Delete: ZwDeleteWnfStateName High-level API Subscribe: RtlSubscribeWnfStateChangeNotificatio n
  • 42. © Black Hills Information Security | @BHInfoSecurity Research: Guidance • State Names are found in registry • HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlNotifications • HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionNotifications • HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionVolatileNotifications • Windows Internal Names & Descriptions • Symbols in perf_nt_c.dll via Microsoft ADK • NT Kernel Hooks: https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/etw/callouts/hookid.htm • NativeAPI Signatures • *WNF* • https://processhacker.sourceforge.io/doc/ntzwapi_8h_source.html Get Started Researching
  • 43. © Black Hills Information Security | @BHInfoSecurity Research: CasperWNF
  • 44. © Black Hills Information Security | @BHInfoSecurity WNF Hidden Data 1. Code execution runs Stage 1 payload 2. Stage 1 checks if Stage 2 payload in State name a. Yes: run Stage 2 b. No: Fetch Stage 2 from C2 i. Publish in State name then run 3. Stage 2 subscribe to shutdown/user-presence a. Shutdown callback i. Write Stage 1 to disk for start-up b. User-presence callback i. Change jitter? Commands? Nuke the box? WNF Side-channel Data Persistence
  • 45. © Black Hills Information Security | @BHInfoSecurity WNF Subscriptions Stage 1: Dropper Stage 2: Malware Shutdown State WNF_SYS_SHUTDOWN_IN_PROGRESS 0x4195173EA3BC0875 User-presence State WNF_SEB_USER_PRESENT 0x41840B3EA3BC6875 ‘Nuke the box’ State WNF_HOLO_FORCE_ROOM_BOUNDARY 0xE8A0125A3BC2835c
  • 46. © Black Hills Information Security | @BHInfoSecurity DEMO: Weaponized WNF PoC
  • 47. © Black Hills Information Security | @BHInfoSecurity WNF Attack Mitigations • Event Tracing for Windows • Only works for Rtl* function calls not Zw* • Hooks NT Kernel Logger Events • Hooking Ntdll system calls • Great idea if you're crazy or writing malware • Monitor read/writes to registry keys • System service which is loud • Filter on specific entries? *shrug* TLDR; we’re screwed...
  • 48. © Black Hills Information Security | @BHInfoSecurity Finishing Up: Dear Microsoft...
  • 49. © Black Hills Information Security | @BHInfoSecurity Dear Microsoft... A few requests... • WNF Documentation & Native API logging • Azure Portal locked-down by default • Azure AD Conditional access w/o upgrade costs • Fix the phantom host info w/ RDP NLA • Make it easy for O365 admins to find rogue add-ins
  • 50. © Black Hills Information Security | @BHInfoSecurity Questions? • Twitter • Mike - @ustayready • Beau - @dafthack • Black Hills Information Security • http://www.blackhillsinfosec.com/ • Code from demos • https://github.com/ustayready/CasperStager • https://github.com/ustayready/CasperWNF • https://github.com/dafthack/RDPSpray