Skip to content
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

Gadgets from non-executable pages returned #17

Open
k4lizen opened this issue May 12, 2024 · 2 comments
Open

Gadgets from non-executable pages returned #17

k4lizen opened this issue May 12, 2024 · 2 comments

Comments

@k4lizen
Copy link

k4lizen commented May 12, 2024

I was doing this challenge: https://2020.ctf.link/assets/files/kernel-rop-bf9c106d45917343.tar.xz
and the gadget 0xffffffff8246dc83: push rax; ret; is returned for the extracted vmlinux. I used it in a ROP chain and got
[ 2.990604] kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
so the gadget is stored in a NX page. Without the gadget, the script works and there is no error.

Its hard to tell which gadgets are in NX pages just by looking at the addresses, since there are hundereds / thousands of duplicates in the kernel image, there should be some way to filter them out.

@Ben-Lichtman
Copy link
Owner

The easy workaround to this is to filter by address ranges.

Is there an easy way to determine which pages are executable otherwise?

@k4lizen
Copy link
Author

k4lizen commented May 13, 2024

pwntools may have something like that, I know it fetches some information about an elf by patching it to read /proc/self/maps and running it once. Not sure if that would work on the kernel though which is my usecase.
This may be interesting:

The easy workaround to this is to filter by address ranges.

But how do I know which address ranges are executable? By debugging the kernel? I haven't tried filtering by looking at the memory mappings but it sounds non-trivial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants