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
{{ message }}
Repository navigation
expkit: Add or Document better the way to put PushIndirect pivot into Payload. #34
In order to port exp65 for lts-6.1.36 to use Expkit I had to construct a Payload buffer with PushIndirect pivot being stored in first 8 bytes of the Payload.
NOTE: If you need more details on why we need to do so, check description of stack pivot provided in Issue #33
Right now, in I'm achieving this in a following way:
Payloadpayload(512);
payload.Reserve(0, 8);
PivotFinderpivot_finder(target.pivots, Register::RSI, payload);
auto rop_pivot=pivot_finder.PivotToRop(rop);
rop_pivot.PrintDebugInfo();
// Put PushIndirect at the very beginning of Payloadpayload.Release(0, 8);
payload.Set(0, kernel_base+rop_pivot.pivot.GetGadgetOffset());
printf("[+] Payload:\n");
HexDump::Print(payload.GetUsedData());
in essence I have to Release() first 8 bytes before trying to put PushIndirect gadget there as Set() method is aware of Reserved bytes. At the same time I could not skip Reserving bytes as it'll take those 8 bytes by the rest of Stack Pivot as a result of generation with pivot_finder.PivotToRop(rop);
It would be nice to have some easier way to add PushIndirect into Payload.
Currently it's a documentation issue as there is no layout planner implemented which would be aware of the fake structures, Qdisc in this case and its enqueue pointer, so you have to handle that manually as you did with Reserve'ing the first 8 bytes.
But you don't have to Release and then Set, the Reserve function already supports setting the reserved pointer as you can see in the sample exploit: reserving the slot then setting it.
And for payload.Reserve(0, 8) I would use the offset (0) and size (8) of Qdisc.enqueue from the structs data, as the intention is more visible that way and in theory you cannot be sure that the enqueue ptr is at offset 0x00 in all kernel releases.
Activity
koczkatamas commentedon Apr 9, 2025
Currently it's a documentation issue as there is no layout planner implemented which would be aware of the fake structures,
Qdiscin this case and itsenqueuepointer, so you have to handle that manually as you did withReserve'ing the first 8 bytes.But you don't have to
Releaseand thenSet, theReservefunction already supports setting the reserved pointer as you can see in the sample exploit: reserving the slot then setting it.And for
payload.Reserve(0, 8)I would use the offset (0) and size (8) ofQdisc.enqueuefrom the structs data, as the intention is more visible that way and in theory you cannot be sure that theenqueueptr is at offset 0x00 in all kernel releases.chanijindal1 commentedon Apr 21, 2025
Merging my payload builder should help handling this.