Re:Show HN: Credentials dumper for Linux using eBPF
by citronneur on Wednesday July 06, 2022 @10:15AM
(#32001306)
I made a little fix, if you want to retry
Re:Show HN: Credentials dumper for Linux using eBPF
by evgpbfhnr on Sunday July 10, 2022 @07:03PM
(#32050098)
Thanks! This happens to work for me, but the root of the problem is the same: there's no guarantee that the handle will still be in that register when the function returns; my compiler just happens to not be clobbering that register.
Anyway, this is probably good enough as a bpf demonstration and it definitely has made its impact looking at other comments here. That's probably all that matters.
The solution for this is usually to track both probes and remember arguments, here's what it'd look like with bpftrace -- that does the same as his program, I've just hardcoded the offset for username in pam_handle struct but the repo hardcoded the struct (it's also possible to include a .h in bpftrace to stay up to date)