bandswidth range requests on a 1 TiB file

web
flag d4rk{4kb_isn't_all_that_bad_tbh_1t's_much_b3tter_th4n_n0thing...}

d4rk{4kb_isn't_all_that_bad_tbh_1t's_much_b3tter_th4n_n0thing...}

Summary

The challenge is a single endpoint, https://<target>, advertising a Content-Length of 1099511627776 bytes — exactly 1 TiB (2^40). The point of the name is that you must not download it: the server throttles to roughly 200-250 KB/s, so a full GET would take months. Instead the server sets Accept-Ranges: bytes, so the 1 TiB body can be sampled with Range requests. The flag sits in a tiny cluster of non-zero bytes near the end of the file, reachable with one ranged GET once the useful window is located. A 1 MiB cap on a single range (larger ranges get HTTP 416) forces a little care about how the window is chosen.

Solution / Exploit

1. Fingerprint the endpoint

bash
1$ curl -sI https://<target>
2HTTP/1.1 200 OK
3Content-Type: application/octet-stream
4Content-Length: 1099511627776
5Accept-Ranges: bytes

1099511627776 = 2^40. The root path confirms the fiction:

bash
1$ curl -s https://<target>
2{"challenge":"BANDSWIDTH","download_size":1099511627776,"unit":"bytes"}

Server is gunicorn, and a fresh bw_session cookie is issued on every request (there is no per-session state to abuse). Endpoint/parameter enumeration (/health, /api, /hint, /source, ...) is a dead end — only /health answers, and it says nothing.

2. Confirm ranges work and probe the ends

bash
1$ curl -s -r 0-4095 --max-time 60 \
2    https://<target> -o work/bw_head.bin     # 4096 x 0x00
3$ curl -s -r -4096 --max-time 60 \
4    https://<target> -o work/bw_tail.bin     # 4096 x 0x00

Both the first 4 KiB and the last 4 KiB are all zeros. A full GET was started and aborted after ~4.5 MiB (work/bw_full_head.bin), also all zeros — so the needle is neither at the start nor inside the final few KB.

3. Find the range cap (bisection)

bash
1$ curl -s -o /dev/null -w '%{http_code}\n' -r 0-1048575 .../download   # 206
2$ curl -s -o /dev/null -w '%{http_code}\n' -r 0-1048576 .../download   # 416
3$ curl -s -r 0-1048576 .../download
4Requested range too large

The maximum single range is 0x100000 = 1 MiB. Multi-range requests (bytes=0-1,5-6) and open-ended ranges return 416 Invalid or unsatisfiable range.

4. Fetch the last 1 MiB and look for non-zero bytes

Because the tail did not match, the natural place to look next is the last full 1 MiB window:

bash
1$ curl -s -r 1099510579200-1099511627775 --max-time 60 \
2    https://<target> -o work/bw_last1MiB.bin

Scanning that window:

output
len 1048576 nonzero 65
first 1046528 last 1046592
bytes: b"d4rk{4kb_isn't_all_that_bad_tbh_1t's_much_b3tter_th4n_n0thing...}"

65 non-zero bytes, clustered at window index 1046528..1046592 (absolute file offsets 1099511625728..1099511625792), i.e. ending about 183 bytes before EOF.

5. Minimal proof

An exact range returns the flag verbatim:

bash
1$ curl -s -r 1099511625728-1099511625792 --max-time 60 \
2    https://<target>
3d4rk{4kb_isn't_all_that_bad_tbh_1t's_much_b3tter_th4n_n0thing...}

The flag itself is 65 bytes and sits entirely inside the final 1 MiB region.

Flag(s)

output
d4rk{4kb_isn't_all_that_bad_tbh_1t's_much_b3tter_th4n_n0thing...}

(The flag keeps its trailing ... exactly as the server emits it.)

Notes / Pitfalls

  • Do not download the whole file. 1 TiB at the server's ~200-250 KB/s throttle is not a plan. Every step above is a ranged GET of at most 1 MiB.
  • The flag is above the last 4 KiB. curl -r -4096 misses it, which is the trap: the instinct after "not at the start" is to grab the final 4 KiB, and that window is all zeros. Fetch the full 1 MiB suffix (-r 1099510579200-1099511627775) instead.
  • Max single range is 1 MiB. Anything larger (-r 0-1048576) returns 416 Requested range too large; multi-range and open-ended ranges return 416 Invalid or unsatisfiable range.
  • Params/endpoints are a decoy. A discovery wordlist (work/bw_wl.txt) of the usual names (/source, /flag.txt, /hint, .env, robots.txt, ...) turns up nothing but /health.
  • No outbound callbacks, no scoring-platform contact — only gentle ranged GETs against the challenge host.