The Last Calling Convention SysV ABI logic quiz over a socket

pwn
flag RxR{b555344b-45f2-4c56-b4a8-b2466c5fb816}

No binary here - a single-connection logic . The service hands you a randomised SysV x86-64 ABI quiz each time you connect: an assigned function declaration plus nine captured call traces, and you have to work out which trace is healthy, which clobbers a saved register, and which only botches stack alignment, then submit a five-field report on the same socket.

Note

Verified flag: RxR{R4lly_i_g0t_216_kdn4h} sits on the instance banner with the challenge id baked in - bait, as usual. The real flag only comes back from the oracle after an accepted report, and it's a per-instance UUID that regenerates at container boot.

The console

output
abi               Read the rules used by the examiner.
exam              Find the assigned declaration.
index             List declarations and captures.
signature <id>    Read a declaration's ordered argument cards.
trace <id>        Read the captured caller and entry state.
return <id>       Compare entry and return register markers.
report <healthy-trace> <first-spill> <preserve-fault> <saved-reg> <alignment-fault>

The ABI model, as abi states it

  • Six GP argument lanes (rdi,rsi,rdx,rcx,r8,r9), eight SSE lanes (xmm0..xmm7).
  • A declaration's return=<tok> names a hidden return-buffer token that occupies GP lane 0 before any listed argument is processed - so only 5 GP lanes remain for real arguments.
  • I consumes one GP lane, F one SSE lane. M consumes one GP and one SSE lane together; if either is unavailable, both words of that M spill to the stack, using neither lane.
  • Stack words are listed in declaration order (I word first for a spilled M).
  • Caller pre-call residue = 0 mod 16, callee entry residue = 8 mod 16.
  • The variadic stub records the occupied SSE-lane count in al - audit it.
  • The return sheet watches RBX, R12, R13, RAX; the first three must match before/after, RAX may change.

1/5Gather the puzzle

exam + index give the target declaration id and the fixed set of nine trace ids (T13 T21 T32 T46 T57 T62 T74 T86 T94).

2/5Compute the correct layout

signature <target> gives the declaration; apply the GP/SSE/stack assignment algorithm above by hand to get the expected lane and stack layout.

3/5Read all nine traces

trace <T> and return <T> for each of the nine ids.

4/5Classify

  • healthy: gp/sse/stack match exactly, residues 0/8, al = correct SSE count, RBX/R12/R13 unchanged.
  • first-spill: that trace's first stack token.
  • preserve-fault: correct everywhere except exactly one of RBX/R12/R13 changed.
  • saved-reg: which register changed.
  • alignment-fault: correct everywhere except residues aren't 0/8.

5/5Report

report <healthy> <first-spill> <preserve-fault> <saved-reg> <alignment-fault>, on the same socket the puzzle was read from.

Pitfall

Send-then-read-to-the-next-prompt per command, not all commands batched and read once - the service's own prompt (abi> ) separates replies, and batching collapses them into one read. Also: the trace ids are a fixed set, but the target and every token name re-randomise per connection - never replay a previous session's answer, and chmod +x the practice binary before running it locally.

Verified both locally (Report accepted. Practice complete.) and live, one shot each.

Flag

output
RxR{b555344b-45f2-4c56-b4a8-b2466c5fb816}

Per-instance UUID, regenerates at container boot.