-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail to execute #2
Comments
Hm, what is kernel.grsecurity.harden_ptrace? Alternatively if you run it as root, does it work? According to the docs that sysctl shouldn't affect ptrace in this case (because the tracee is a child process of the tracer) but Im curious. If it's enabled, does disabling it make the problem go away? When you run it verbosely, it should give you the child pid. Does that process still exist after the failed write? What does '.read 0x400000 1' return? (from inside rappel). I don't have a grsec machine handy at the moment, but will get one spun up after the weekend if we still can't resolve it. |
This seems like a really cool project, so I'll be excited to test it if the issue can be solved. |
Hm, can you try a patch for me?
|
that resulted in a hang and an eventual throw of a similar ptrace error. However, a new message shows up in
I gave a shot to setting PaX to give |
Ok, I think I know whats happening. Rappel creates an elf runs it, and rewrites it at runtime to include the result of assembled instructions. The text segment of the created elf, by default is read/execute. Normally ptrace can write to read/execute pages, because its ptrace and it doesn't really care what memory protections the tracee thinks it has. You can see some evidence of this -- the ptrace_read() call works, but the ptrace_write() fails. Im guessing this is because PaX hardens memory accesses. The patch I gave you changed the generated elf to map the text section RWX. My guess is this would remove the ptrace_write() error, but PaX kills it, probably due to MPROTECT. I'll poke at it it next week in depth and confirm this, but if this is fact the reason I don't see an easy way around it. The benefits MPROTECT provides are solid, and probably outweighs the utility of using rappel. fwiw you should still be able to use it in pipe mode, right? i.e 'echo "inc rax; inc rax" | rappel' works? |
Fair enough! running through a pipe outputs without any ptrace error and does not hang. However, it does not reflect the execution of the instructions passed (e.g.,
|
Man, I really need to test with grsec. Thanks for the report, and sorry it's been such a hassle. Will let you know when I understand a bit more whats going on. |
No worries, and thank you for the help! |
So two months later I finally got around to figuring this out. This is controlled by PAX_MPROTECT (https://pax.grsecurity.net/docs/mprotect.txt). Honestly, having PAX_MPROTECT is probably better than running rappel in interactive mode. Now to figure out why the pipe mode doesn't work... In any case, thanks a lot for the report. I'll update the readme to indicate that it's not supported under grsec. |
Well, PaX is an optional extension, so it'd be unsupported under PaX, not grsec. However, PaX allows configuration to specifically whitelist particular applications. I am happy to do so for rappel, because this is such a cool tool. Rather, I would recommend documenting whitelisting rappel in |
When I try to execute any instruction (for example,
inc rax
), I get the following output before the list of registers (which do not change).When executing with
-v
, I get the following:I am wondering if this is because of Grsec's PaX, but if it is, there was nothing registered in
dmesg
as there usually is. Any idea what might be going wrong?The text was updated successfully, but these errors were encountered: