Closed 0x4d5a-ctf closed 2 years ago
Thanks for your report!
TBH it might not be clear which set of constraints is easier to achieve:
address rbp-0x78 is writable
[rsi] == NULL || rsi == NULL
[rdx] == NULL || rdx == NULL
vs
[rsp+0x70] == NULL
[r9] == NULL || r9 == NULL
rdx == NULL || (s32)[rdx+0x4] <= 0
But let me check whether I should properly tune my scoring system of gadgets' constraints.
True, the "easier to achieve" rating was quite subjective for my special use case. I still think that, from my limited personal experience, constraints on the stack are harder to fulfill.
Thanks for taking a look into it and the fast response!
With the PR it becomes:
0x50a37 posix_spawn(rsp+0x1c, "/bin/sh", 0, rbp, rsp+0x60, environ)
constraints:
rsp & 0xf == 0
rcx == NULL
rbp == NULL || (u16)[rbp] == NULL
0xebcf1 execve("/bin/sh", r10, [rbp-0x70])
constraints:
address rbp-0x78 is writable
[r10] == NULL || r10 == NULL
[[rbp-0x70]] == NULL || [rbp-0x70] == NULL
0xebcf5 execve("/bin/sh", r10, rdx)
constraints:
address rbp-0x78 is writable
[r10] == NULL || r10 == NULL
[rdx] == NULL || rdx == NULL
0xebcf8 execve("/bin/sh", rsi, rdx)
constraints:
address rbp-0x78 is writable
[rsi] == NULL || rsi == NULL
[rdx] == NULL || rdx == NULL
This result looks better to me as well
Released v1.8.1
Seems like version 1.8.0 prefers the
posix_spawn
gadgets and does not listexecve
-gadgets with default output-level 0. Thoseposix_spawn
gadgets have much harder contraints and shouldn't be displayed instead of the easierexecve
-gadgets.Tests were conducted on the libc of the Ubuntu Docker:
FROM ubuntu@sha256:a02c32cf0c2a7e8743c74deef66637aa70e063c9bd40e9e1f8c0b3ea0750b0ba
Output with one_gadget 1.7.4:
Output with 1.8.0: