SlideShare a Scribd company logo
Externally Testing Modern Active Directory
Domains
Karl Fosaaen
Introductions
• Who am I?
‒Karl Fosaaen
• What do I do?
‒Wear lots of hats
‒Pen Testing
‒Password Cracking
‒Social Engineering
‒Blog
‒DEF CON Swag Goon
‒Pinball Repair
Slides Overview
• Intro
• Domain Enumeration
• Authentication Endpoint Enumeration
‒ Graph API
‒ ADFS
‒ Office 365
• Microsoft Online login
• Exchange
• Skype for Business
• Pivoting to the internal network
• Attack Mitigations
• Conclusions
Intro
• Standard ExPen Process
‒ Enumeration of domain info
• Services
• Username/Email recon
‒ Exploitation of issues
• Phishing
• Web Vulnerabilities
• Weak/Default logins
‒ Pivot to internal network
‒ Escalate internally
Domain Enumeration
Domain Federation Overview
Federation can mean many things
‒ Domain to Domain
‒ Domain to Microsoft
‒ Arbitrary meanings based off of forum posts
Managed Domain Overview
Diagram of (Managed) O365 federation
Federated Domain Overview
Diagram of (Federated) O365 federation
Domain Enumeration
Side Note:
• Office365 had an Authentication Bypass issue
‒ Insecure SAML assertions
‒ Affected all federated Office365 domains
‒ They called out this method in their blog post
Source:
http://www.economyofmechanism.com/office365-
authbypass.html
Domain Enumeration
• Using Microsoft Online
Domain Enumeration
• Example user check request
Domain Enumeration
• Microsoft’s Responses
‒ Federated Domain
‒ Microsoft Managed Domain
Domain Enumeration
• Grab the PowerShell script from NetSPI
• https://github.com/NetSPI/PowerShell/blob/master/Get-
FederationEndpoint.ps1
Domain Enumeration
‒ Federated Domain
‒ Microsoft Managed Domain
https://blog.netspi.com/using-powershell-identify-federated-domains/
https://github.com/NetSPI/PowerShell/blob/master/Get-FederationEndpoint.ps1
Domain Enumeration
• Multiple domains at once
https://blog.netspi.com/using-powershell-identify-federated-domains/
https://github.com/NetSPI/PowerShell/blob/master/Get-FederationEndpoint.ps1
Domain Enumeration
• What’s the current exposure?
‒ 47,455 (4.7%) of the top 1 Million have
“ms=ms*” DNS records
• Personal Experience
‒ Managed/Federated/Neither
50% 40% 10%
Authentication Endpoint
Enumeration
Graph API
Graph API Overview
• Using the Graph API
‒ This works for federated and managed
domains
Graph API – Credential Brute Forcing
• Using the Graph API
$token = Get-GraphAPIToken -TenantName
DOMAIN_GOES_HERE
Github –
https://github.com/NetSPI/PowerShell/blob/master/Get-
GraphAPIToken.ps1
*Requires Azure AD PowerShell Modules
Graph API – Credential Brute Forcing
• Using the Graph API
Graph API – User Enumeration
• Get-GraphData -Token $token -Tenant
DOMAIN_GOES_HERE -Resource users
Github –
https://github.com/NetSPI/PowerShell/blob/master/Get-
GraphAPIToken.ps1
ADFS
ADFS Overview
Active Directory Federation Services (AD FS)
“is a standards-based service that allows the
secure sharing of identity information
between trusted business partners (known
as a federation) across an extranet.”
Source:
https://msdn.microsoft.com/en-us/library/bb897402.aspx
ADFS – Credential Brute Forcing
• Get-FederationEndpoint gives us the
appropriate command to run for the domain
‒ Federated Domain
ADFS – Credential Brute Forcing
• Invoke-ADFSSecurityTokenRequest*
Invoke-ADFSSecurityTokenRequest
-ClientCredentialType UserName
-ADFSBaseUri https://adfs.example.com/
-AppliesTo https://adfs.example.com/adfs/services/trust/13/usernamemixed
-UserName 'karl.fosaaen‘
-Password 'Winter2016‘
-Domain ‘example.com‘
-OutputType Token
-SAMLVersion 2
-IgnoreCertificateErrors
https://blogs.msdn.microsoft.com/besidethepoint/2012/10/17/request-adfs-security-
token-with-powershell/
ADFS – User Enumeration
• Go back a few slides to the GraphAPI
information
Office365
Office365 Overview
• Office365
‒Azure AD
‒Exchange
‒Skype for Business
• Credential Brute Force
• User Enumeration
Setting Up Your Test Environment
• Install the Azure AD PowerShell Module
• https://msdn.microsoft.com/en-
us/library/azure/jj151815(v=azure.98).aspx
Office365 - Credential Brute Forcing
• Get-FederationEndpoint gives us the
appropriate command to run for the domain
‒ Microsoft Managed Domain
Office365 - Credential Brute Forcing
• Connect-msolservice – AzureAD PS Module
Office365 – User Enumeration
1. $msolcred = get-credential
2. connect-msolservice -credential $msolcred
3. Get-MsolUser -All | ft –AutoSize
• This also works for apps (Web/Thick) using
AzureAD for account management
Office365 - Exchange
• If the domain uses Office365, you can most
likely connect to Office365 Exchange with
PowerShell
Exchange – Credential Brute Forcing
$PWord = ConvertTo-SecureString -String
'Summer2016' -AsPlainText –Force
$credentials = New-Object -TypeName
"System.Management.Automation.PSCredential
" -ArgumentList "test@example.com", $PWord
Exchange – Credential Brute Forcing
$Session = New-PSSession -ConfigurationName
Microsoft.Exchange -ConnectionUri
https://outlook.office365.com/powershell-
liveid/ -Credential $credentials -Authentication
Basic –AllowRedirection
Import-PSSession $Session
Exchange – User Enumeration
Invoke-Command
-ConfigurationName Microsoft.Exchange
-ConnectionUri
https://outlook.office365.com/powershell-
liveid/
-Credential $Credentials
-Authentication Basic -AllowRedirection
-ScriptBlock {Get-Recipient -ResultSize
unlimited} | Export-CSV
c:tempemail_users.csv
-NoTypeInformation
Skype For Business – Overview
• Formerly Lync, now Skype for Business
• Commonly Federated with other domains
‒ Great for credential guessing, user
enumeration, and social engineering
Skype For Business – Tools
• Grab the PowerShell modules from NetSPI
• https://github.com/NetSPI/PowerShell/blob/master/Power
Skype.ps1
Skype For Business – Credential Brute Forcing
‒ Get-SkypeLoginURL
• In progress
‒ Invoke-SkypeLogin
‒ Credit to @Nyxgeek for the auth endpoints
Skype For Business – Blind User Enumeration
• Using a federated Skype account, we can
enumerate other federated Skype users
• Just open a chat with them
Skype For Business – Blind User Enumeration
• Or we can just chat with these CEOs
Skype For Business – Blind User Enumeration
• Blind User enumeration (email confirmation)
requires the SDK
‒ Also requires a signed in federated user
• You can use guessed credentials (autodiscover)
• or pay Microsoft for a cheap federated account
• ~$6/month
Skype For Business – Tools
• Install Skype for Business and the Lync SDK
‒ Requires Visual Studio 2010 for the easiest
install
https://www.microsoft.com/en-us/download/details.aspx?id=36824
Skype For Business – Blind User Enumeration
• Let’s just wrap it with PowerShell
Get-SkypeStatus -inputFile test_emails.txt | ft -AutoSize
Skype For Business – Blind User Enumeration
Skype For Business – Blind User Enumeration
Demo
• Get-SkypeStatus -inputFile
"C:TempLiveAdmins.txt" | ft -AutoSize
• It helps if we run it a couple of times…
Skype For Business – Blind User Enumeration
Skype4Business – Authenticated User Enumeration
• Or if it’s autodiscover enabled, you can list
the users from the Skype user’s contact list
Pivoting to the Internal
Network
Pivoting to the Internal Network – Exchange
• Attacking Email Accounts
‒ If Autodiscover is enabled, adding an account
can be done from anywhere
‒ Email is interesting, but I’d like a shell
‒ This can not be done programmatically with
PowerShell (*Easily)
‒ “Malicious Outlook Rules”
• Nick Landers – Silent Break Security
‒ “MAPI over HTTP and Mailrule Pwnage”
• Etienne - sensepost
Pivoting to the Internal Network – Skype
• Send messages from OWA or Skype for
Business
‒ Autodiscover is also handy here
‒ People will trust their co-workers
• “Can you look over this word doc for me?”
Pivoting to the Internal Network – Skype
Demo
• Get-SkypeStatus -email karl.fosaaen@netspi.com
• Invoke-SendSkypeMessage
-email karl.fosaaen@netspi.com
-message "Hello from Derbycon"
• for ($i = 0; $i -lt 10; $i++){Invoke-
SendSkypeMessage -email
karl.fosaaen@netspi.com -message "Hello $i"}
Pivoting to the Internal Network – Skype
Pivoting to the Internal Network – Skype
Pivoting to the Internal Network – VPN
• Single Factor VPN Example
‒ Enumerated user emails on LinkedIn
‒ Guessed passwords against MSOnline with
PowerShell
‒ Enumerated VPN interfaces
‒ Logged in with guessed credentials
‒ GPP -> Local admin on DA system
‒ DCSync
• “Store passwords using reversible encryption”
Pivoting to the Internal Network – Other
• Other Routes
‒ Single Factor Services
• Management Protocols
• RDP
• SSH
• Terminal Services – Web Based
• Citrix
• VDI
• Etc.
Pivoting to the Internal Network – OneDrive
• Malicious OneDrive Documents
‒ Can’t use macros in the online version of excel
Pivoting to the Internal Network - SharePoint
• Malicious SharePoint Documents
‒ Same concept as OneDrive, just a different
platform
‒ Backdoor a document
‒ Edit pages
Attack Mitigations
Attack Mitigations
• Enable Dual factor authentication for
external endpoints*
*On all channels
Attack Mitigations
• Limit federation to trusted domains
• Limit exposed services surface area
• Monitor your Federated and Azure endpoints
• Enforce strong password requirements
Conclusions
Conclusions
• Lots of authentication endpoints on the
Internet
• There’s always a $SEASON$YEAR password
out there
• There are several ways to pivot internally
with credentials
• MFA will help reduce your risk
Next Steps
• Yet another framework for pen testing…
‒ Enumerate all of the potential AD
authentication endpoints for a domain
• And again, AutoDiscover is handy here
‒ Include credential brute force methods for
each interface type
‒ Easy mode, autopwn, etc.
• Give it a domain, user list, and go for it
‒ Try to keep it dependency free
• Easier to use
• More portable
Questions
Questions?
Karl Fosaaen
@kfosaaen
https://blog.netspi.com
https://github.com/netspi
http://www.slideshare.net/kfosaaen

More Related Content

PPTX
Automating Attacks Against Office365 - BsidesPDX 2016
PPTX
ECS19 - Ingo Gegenwarth - Running Exchange in large environment
PPTX
Navigating the turbulence on takeoff: Setting up SharePoint on Azure IaaS the...
PPTX
PowerShell for the Anxious ITPro
PDF
Beyond the Pentest: How C2, Internal Pivoting, and Data Exfiltration Show Tru...
PPTX
Navigating the turbulence on take-off: Setting up SharePoint on Azure IaaS th...
PPTX
Covert Attack Mystery Box: A few novel techniques for exploiting Microsoft “f...
PPTX
It's just Skype for Business - THOTCON
Automating Attacks Against Office365 - BsidesPDX 2016
ECS19 - Ingo Gegenwarth - Running Exchange in large environment
Navigating the turbulence on takeoff: Setting up SharePoint on Azure IaaS the...
PowerShell for the Anxious ITPro
Beyond the Pentest: How C2, Internal Pivoting, and Data Exfiltration Show Tru...
Navigating the turbulence on take-off: Setting up SharePoint on Azure IaaS th...
Covert Attack Mystery Box: A few novel techniques for exploiting Microsoft “f...
It's just Skype for Business - THOTCON

What's hot (19)

PPTX
ECS19 - Patrick Curran - Expanding User Profiles with Line of Business Data (...
PPTX
ECS19 - Mike Ammerlaan - Integrate with OneDrive and SharePoint Files
PPTX
Installing SharePoint 2013 – Step by Step presented by Alan Richards
PPTX
Dealing with and learning from the sandbox
PPTX
Pentest Apocalypse
PDF
How to Do a Performance Audit of Your .NET Website
 
PPTX
Sps bris - Customising Office 365 on the Client side
PDF
Mind the gap - Troopers 2016
PDF
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
PDF
Coding 100-session-slides
PPTX
How to build a SaaS solution in 60 days
PDF
How Shopify Scales Rails
PPTX
Altitude SF 2017: Security at the edge
PPTX
2019 DevCon - The future of Authentication by Codrin Chirica
PDF
FaaS or not to FaaS. Visible and invisible benefits of the Serverless paradig...
PDF
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
PPTX
Azure and web sites hackaton deck
PDF
Adopting Java for the Serverless world at Serverless Meetup Singapore
PDF
Modern websites in 2020 and Joomla
ECS19 - Patrick Curran - Expanding User Profiles with Line of Business Data (...
ECS19 - Mike Ammerlaan - Integrate with OneDrive and SharePoint Files
Installing SharePoint 2013 – Step by Step presented by Alan Richards
Dealing with and learning from the sandbox
Pentest Apocalypse
How to Do a Performance Audit of Your .NET Website
 
Sps bris - Customising Office 365 on the Client side
Mind the gap - Troopers 2016
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
Coding 100-session-slides
How to build a SaaS solution in 60 days
How Shopify Scales Rails
Altitude SF 2017: Security at the edge
2019 DevCon - The future of Authentication by Codrin Chirica
FaaS or not to FaaS. Visible and invisible benefits of the Serverless paradig...
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
Azure and web sites hackaton deck
Adopting Java for the Serverless world at Serverless Meetup Singapore
Modern websites in 2020 and Joomla
Ad

Similar to Externally Testing Modern AD Domains - Arcticcon (20)

PPTX
Attacking ADFS Endpoints - DerbyCon
PDF
O365con14 - moving from on-premises to online, the road to follow
PPSX
AzureAAD
PDF
Gartner Security & Risk Management Summit 2018
PPTX
The Who, What, Why and How of Active Directory Federation Services (AD FS)
PDF
Azure saturday 2017 - Protecting cloud identities using ems
PDF
Advanced Domain Hacking
PPTX
BSides SG Practical Red Teaming Workshop
PDF
SCUGBE_Lowlands_Unite_2017_Protecting cloud identities
PPTX
PSConfEU - Offensive Active Directory (With PowerShell!)
PPTX
MCSA 70-412 Chapter 08
PPTX
Security Risk Advisors - BSides Philadelphia 2017 - MFA: It's 2017 and You're...
PDF
Tips to Remediate your Vulnerability Management Program
PDF
Managing Exchange Online using PowerShell, Tips & Tricks
PPTX
Raymond Comvalius & Sander Berkouwer - Bring your own device essentials with ...
PDF
From Workstation to Domain Admin: Why Secure Administration isn't Secure and ...
PPTX
BHUSA 2021 - Cloud with a Chance of APT
PPTX
Office 365 busting the myths
PDF
04_Extending and Securing Enterprise Applications in Microsoft Azure_GAB2019
PDF
Internal penetration test_hitchhackers_guide
Attacking ADFS Endpoints - DerbyCon
O365con14 - moving from on-premises to online, the road to follow
AzureAAD
Gartner Security & Risk Management Summit 2018
The Who, What, Why and How of Active Directory Federation Services (AD FS)
Azure saturday 2017 - Protecting cloud identities using ems
Advanced Domain Hacking
BSides SG Practical Red Teaming Workshop
SCUGBE_Lowlands_Unite_2017_Protecting cloud identities
PSConfEU - Offensive Active Directory (With PowerShell!)
MCSA 70-412 Chapter 08
Security Risk Advisors - BSides Philadelphia 2017 - MFA: It's 2017 and You're...
Tips to Remediate your Vulnerability Management Program
Managing Exchange Online using PowerShell, Tips & Tricks
Raymond Comvalius & Sander Berkouwer - Bring your own device essentials with ...
From Workstation to Domain Admin: Why Secure Administration isn't Secure and ...
BHUSA 2021 - Cloud with a Chance of APT
Office 365 busting the myths
04_Extending and Securing Enterprise Applications in Microsoft Azure_GAB2019
Internal penetration test_hitchhackers_guide
Ad

Recently uploaded (20)

PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
A Presentation on Artificial Intelligence
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Encapsulation theory and applications.pdf
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
cloud_computing_Infrastucture_as_cloud_p
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
1. Introduction to Computer Programming.pptx
PDF
Mushroom cultivation and it's methods.pdf
PDF
Approach and Philosophy of On baking technology
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
Programs and apps: productivity, graphics, security and other tools
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Web App vs Mobile App What Should You Build First.pdf
Zenith AI: Advanced Artificial Intelligence
A Presentation on Artificial Intelligence
Heart disease approach using modified random forest and particle swarm optimi...
Encapsulation theory and applications.pdf
Enhancing emotion recognition model for a student engagement use case through...
Encapsulation_ Review paper, used for researhc scholars
Assigned Numbers - 2025 - Bluetooth® Document
cloud_computing_Infrastucture_as_cloud_p
SOPHOS-XG Firewall Administrator PPT.pptx
TLE Review Electricity (Electricity).pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Hindi spoken digit analysis for native and non-native speakers
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
1. Introduction to Computer Programming.pptx
Mushroom cultivation and it's methods.pdf
Approach and Philosophy of On baking technology
A comparative analysis of optical character recognition models for extracting...
Programs and apps: productivity, graphics, security and other tools

Externally Testing Modern AD Domains - Arcticcon

  • 1. Externally Testing Modern Active Directory Domains Karl Fosaaen
  • 2. Introductions • Who am I? ‒Karl Fosaaen • What do I do? ‒Wear lots of hats ‒Pen Testing ‒Password Cracking ‒Social Engineering ‒Blog ‒DEF CON Swag Goon ‒Pinball Repair
  • 3. Slides Overview • Intro • Domain Enumeration • Authentication Endpoint Enumeration ‒ Graph API ‒ ADFS ‒ Office 365 • Microsoft Online login • Exchange • Skype for Business • Pivoting to the internal network • Attack Mitigations • Conclusions
  • 4. Intro • Standard ExPen Process ‒ Enumeration of domain info • Services • Username/Email recon ‒ Exploitation of issues • Phishing • Web Vulnerabilities • Weak/Default logins ‒ Pivot to internal network ‒ Escalate internally
  • 6. Domain Federation Overview Federation can mean many things ‒ Domain to Domain ‒ Domain to Microsoft ‒ Arbitrary meanings based off of forum posts
  • 7. Managed Domain Overview Diagram of (Managed) O365 federation
  • 8. Federated Domain Overview Diagram of (Federated) O365 federation
  • 9. Domain Enumeration Side Note: • Office365 had an Authentication Bypass issue ‒ Insecure SAML assertions ‒ Affected all federated Office365 domains ‒ They called out this method in their blog post Source: http://www.economyofmechanism.com/office365- authbypass.html
  • 10. Domain Enumeration • Using Microsoft Online
  • 11. Domain Enumeration • Example user check request
  • 12. Domain Enumeration • Microsoft’s Responses ‒ Federated Domain ‒ Microsoft Managed Domain
  • 13. Domain Enumeration • Grab the PowerShell script from NetSPI • https://github.com/NetSPI/PowerShell/blob/master/Get- FederationEndpoint.ps1
  • 14. Domain Enumeration ‒ Federated Domain ‒ Microsoft Managed Domain https://blog.netspi.com/using-powershell-identify-federated-domains/ https://github.com/NetSPI/PowerShell/blob/master/Get-FederationEndpoint.ps1
  • 15. Domain Enumeration • Multiple domains at once https://blog.netspi.com/using-powershell-identify-federated-domains/ https://github.com/NetSPI/PowerShell/blob/master/Get-FederationEndpoint.ps1
  • 16. Domain Enumeration • What’s the current exposure? ‒ 47,455 (4.7%) of the top 1 Million have “ms=ms*” DNS records • Personal Experience ‒ Managed/Federated/Neither 50% 40% 10%
  • 19. Graph API Overview • Using the Graph API ‒ This works for federated and managed domains
  • 20. Graph API – Credential Brute Forcing • Using the Graph API $token = Get-GraphAPIToken -TenantName DOMAIN_GOES_HERE Github – https://github.com/NetSPI/PowerShell/blob/master/Get- GraphAPIToken.ps1 *Requires Azure AD PowerShell Modules
  • 21. Graph API – Credential Brute Forcing • Using the Graph API
  • 22. Graph API – User Enumeration • Get-GraphData -Token $token -Tenant DOMAIN_GOES_HERE -Resource users Github – https://github.com/NetSPI/PowerShell/blob/master/Get- GraphAPIToken.ps1
  • 23. ADFS
  • 24. ADFS Overview Active Directory Federation Services (AD FS) “is a standards-based service that allows the secure sharing of identity information between trusted business partners (known as a federation) across an extranet.” Source: https://msdn.microsoft.com/en-us/library/bb897402.aspx
  • 25. ADFS – Credential Brute Forcing • Get-FederationEndpoint gives us the appropriate command to run for the domain ‒ Federated Domain
  • 26. ADFS – Credential Brute Forcing • Invoke-ADFSSecurityTokenRequest* Invoke-ADFSSecurityTokenRequest -ClientCredentialType UserName -ADFSBaseUri https://adfs.example.com/ -AppliesTo https://adfs.example.com/adfs/services/trust/13/usernamemixed -UserName 'karl.fosaaen‘ -Password 'Winter2016‘ -Domain ‘example.com‘ -OutputType Token -SAMLVersion 2 -IgnoreCertificateErrors https://blogs.msdn.microsoft.com/besidethepoint/2012/10/17/request-adfs-security- token-with-powershell/
  • 27. ADFS – User Enumeration • Go back a few slides to the GraphAPI information
  • 29. Office365 Overview • Office365 ‒Azure AD ‒Exchange ‒Skype for Business • Credential Brute Force • User Enumeration
  • 30. Setting Up Your Test Environment • Install the Azure AD PowerShell Module • https://msdn.microsoft.com/en- us/library/azure/jj151815(v=azure.98).aspx
  • 31. Office365 - Credential Brute Forcing • Get-FederationEndpoint gives us the appropriate command to run for the domain ‒ Microsoft Managed Domain
  • 32. Office365 - Credential Brute Forcing • Connect-msolservice – AzureAD PS Module
  • 33. Office365 – User Enumeration 1. $msolcred = get-credential 2. connect-msolservice -credential $msolcred 3. Get-MsolUser -All | ft –AutoSize • This also works for apps (Web/Thick) using AzureAD for account management
  • 34. Office365 - Exchange • If the domain uses Office365, you can most likely connect to Office365 Exchange with PowerShell
  • 35. Exchange – Credential Brute Forcing $PWord = ConvertTo-SecureString -String 'Summer2016' -AsPlainText –Force $credentials = New-Object -TypeName "System.Management.Automation.PSCredential " -ArgumentList "test@example.com", $PWord
  • 36. Exchange – Credential Brute Forcing $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell- liveid/ -Credential $credentials -Authentication Basic –AllowRedirection Import-PSSession $Session
  • 37. Exchange – User Enumeration Invoke-Command -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell- liveid/ -Credential $Credentials -Authentication Basic -AllowRedirection -ScriptBlock {Get-Recipient -ResultSize unlimited} | Export-CSV c:tempemail_users.csv -NoTypeInformation
  • 38. Skype For Business – Overview • Formerly Lync, now Skype for Business • Commonly Federated with other domains ‒ Great for credential guessing, user enumeration, and social engineering
  • 39. Skype For Business – Tools • Grab the PowerShell modules from NetSPI • https://github.com/NetSPI/PowerShell/blob/master/Power Skype.ps1
  • 40. Skype For Business – Credential Brute Forcing ‒ Get-SkypeLoginURL • In progress ‒ Invoke-SkypeLogin ‒ Credit to @Nyxgeek for the auth endpoints
  • 41. Skype For Business – Blind User Enumeration • Using a federated Skype account, we can enumerate other federated Skype users • Just open a chat with them
  • 42. Skype For Business – Blind User Enumeration • Or we can just chat with these CEOs
  • 43. Skype For Business – Blind User Enumeration • Blind User enumeration (email confirmation) requires the SDK ‒ Also requires a signed in federated user • You can use guessed credentials (autodiscover) • or pay Microsoft for a cheap federated account • ~$6/month
  • 44. Skype For Business – Tools • Install Skype for Business and the Lync SDK ‒ Requires Visual Studio 2010 for the easiest install https://www.microsoft.com/en-us/download/details.aspx?id=36824
  • 45. Skype For Business – Blind User Enumeration • Let’s just wrap it with PowerShell Get-SkypeStatus -inputFile test_emails.txt | ft -AutoSize
  • 46. Skype For Business – Blind User Enumeration
  • 47. Skype For Business – Blind User Enumeration Demo • Get-SkypeStatus -inputFile "C:TempLiveAdmins.txt" | ft -AutoSize • It helps if we run it a couple of times…
  • 48. Skype For Business – Blind User Enumeration
  • 49. Skype4Business – Authenticated User Enumeration • Or if it’s autodiscover enabled, you can list the users from the Skype user’s contact list
  • 50. Pivoting to the Internal Network
  • 51. Pivoting to the Internal Network – Exchange • Attacking Email Accounts ‒ If Autodiscover is enabled, adding an account can be done from anywhere ‒ Email is interesting, but I’d like a shell ‒ This can not be done programmatically with PowerShell (*Easily) ‒ “Malicious Outlook Rules” • Nick Landers – Silent Break Security ‒ “MAPI over HTTP and Mailrule Pwnage” • Etienne - sensepost
  • 52. Pivoting to the Internal Network – Skype • Send messages from OWA or Skype for Business ‒ Autodiscover is also handy here ‒ People will trust their co-workers • “Can you look over this word doc for me?”
  • 53. Pivoting to the Internal Network – Skype Demo • Get-SkypeStatus -email karl.fosaaen@netspi.com • Invoke-SendSkypeMessage -email karl.fosaaen@netspi.com -message "Hello from Derbycon" • for ($i = 0; $i -lt 10; $i++){Invoke- SendSkypeMessage -email karl.fosaaen@netspi.com -message "Hello $i"}
  • 54. Pivoting to the Internal Network – Skype
  • 55. Pivoting to the Internal Network – Skype
  • 56. Pivoting to the Internal Network – VPN • Single Factor VPN Example ‒ Enumerated user emails on LinkedIn ‒ Guessed passwords against MSOnline with PowerShell ‒ Enumerated VPN interfaces ‒ Logged in with guessed credentials ‒ GPP -> Local admin on DA system ‒ DCSync • “Store passwords using reversible encryption”
  • 57. Pivoting to the Internal Network – Other • Other Routes ‒ Single Factor Services • Management Protocols • RDP • SSH • Terminal Services – Web Based • Citrix • VDI • Etc.
  • 58. Pivoting to the Internal Network – OneDrive • Malicious OneDrive Documents ‒ Can’t use macros in the online version of excel
  • 59. Pivoting to the Internal Network - SharePoint • Malicious SharePoint Documents ‒ Same concept as OneDrive, just a different platform ‒ Backdoor a document ‒ Edit pages
  • 61. Attack Mitigations • Enable Dual factor authentication for external endpoints* *On all channels
  • 62. Attack Mitigations • Limit federation to trusted domains • Limit exposed services surface area • Monitor your Federated and Azure endpoints • Enforce strong password requirements
  • 64. Conclusions • Lots of authentication endpoints on the Internet • There’s always a $SEASON$YEAR password out there • There are several ways to pivot internally with credentials • MFA will help reduce your risk
  • 65. Next Steps • Yet another framework for pen testing… ‒ Enumerate all of the potential AD authentication endpoints for a domain • And again, AutoDiscover is handy here ‒ Include credential brute force methods for each interface type ‒ Easy mode, autopwn, etc. • Give it a domain, user list, and go for it ‒ Try to keep it dependency free • Easier to use • More portable