You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even though stack canaries abort the process, an attacker still gains a **Denial-of-Service** primitive (and, with additional information leaks, possibly code-execution). The lesson is simple:
144
-
145
-
* Always provide a **maximum field width** (e.g. `%511s`).
146
-
* Prefer safer alternatives such as `snprintf`/`strncpy_s`.
143
+
Even though stack canaries abort the process, an attacker still gains a **Denial-of-Service** primitive (and, with additional information leaks, possibly code-execution).
3. By abusing **HTTP _chunked transfer-encoding_**, a client can force the request to be split into **hundreds-of-thousands of 6-byte chunks** (`"1\r\nA\r\n"`). This makes `n` grow unbounded until the stack is exhausted.
Synacktiv’s Pwn2Own 2025 chain abused a pre-auth overflow in `SYNO.BEE.AdminCenter.Auth` on port 5000. `AuthManagerImpl::ParseAuthInfo` Base64-decodes attacker input into a 4096-byte stack buffer but wrongly sets `decoded_len = auth_info->len`. Because the CGI worker forks per request, every child inherits the parent’s stack canary, so one stable overflow primitive is enough to both corrupt the stack and leak all required secrets.
198
+
199
+
#### Base64-decoded JSON as a structured overflow
200
+
The decoded blob must be valid JSON and include `"state"` and `"code"` keys; otherwise, the parser throws before the overflow is useful. Synacktiv solved this by Base64-encoding a payload that decodes to JSON, then a NUL byte, then the overflow stream. `strlen(decoded)` stops at the NUL so parsing succeeds, but `SLIBCBase64Decode` already overwrote the stack past the JSON object, covering the canary, saved RBP, and return address.
201
+
202
+
```python
203
+
pld =b'{"code":"","state":""}\x00'# JSON accepted by Json::Reader
204
+
pld +=b"A"*4081# reach the canary slot
205
+
pld += marker_bytes # guessed canary / pointer data
206
+
send_request(pld)
207
+
```
208
+
209
+
#### Crash-oracle bruteforcing of canaries & pointers
210
+
`synoscgi` forks once per HTTP request, so all children share the same canary, stack layout, and PIE slide. The exploit treats the HTTP status code as an oracle: a `200` response means the guessed byte preserved the stack, while `502` (or a dropped connection) means the process crashed. Brute-forcing each byte serially recovers the 8-byte canary, a saved stack pointer, and a return address inside `libsynobeeadmincenter.so`:
211
+
212
+
```python
213
+
defbf_next_byte(prefix):
214
+
for guess inrange(0x100):
215
+
try:
216
+
if send_request(prefix +bytes([guess])).status_code ==200:
217
+
returnbytes([guess])
218
+
except requests.exceptions.ReadTimeout:
219
+
continue
220
+
raiseRuntimeError("oracle lost sync")
204
221
```
205
222
206
-
Lessons learned:
207
-
* Never call `alloca()` with attacker-controlled sizes.
208
-
* Chunked requests can drastically change the shape of server-side buffers.
209
-
* Validate / cap any value derived from client input *before* using it in memory allocations.
223
+
`bf_next_ptr` simply calls `bf_next_byte` eight times while appending the confirmed prefix. Synacktiv parallelized these oracles with ~16 worker threads, reducing the total leak time (canary + stack ptr + lib base) to under three minutes.
224
+
225
+
#### From leaks to ROP & execution
226
+
Once the library base is known, common gadgets (`pop rdi`, `pop rsi`, `mov [rdi], rsi; xor eax, eax; ret`) build an `arb_write` primitive that stages `/bin/bash`, `-c`, and the attacker command on the leaked stack address. Finally, the chain sets up the calling convention for `SLIBCExecl` (a BeeStation wrapper around `execl(2)`), yielding a root shell without needing a separate info-leak bug.
*[Trail of Bits – Uncovering memory corruption in NVIDIA Triton](https://blog.trailofbits.com/2025/08/04/uncovering-memory-corruption-in-nvidia-triton-as-a-new-hire/)
214
231
*[HTB: Rainbow – SEH overflow to RCE over HTTP (0xdf)](https://0xdf.gitlab.io/2025/08/07/htb-rainbow.html)
0 commit comments