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

Unexpected behavior when issuing ExecuteOnly permission on code #9

Open
huettenhain opened this issue Dec 7, 2024 · 0 comments
Open

Comments

@huettenhain
Copy link

Consider the following code:

from icicle import Icicle, MemoryProtection

ic = Icicle('x86_64')
ic.mem_map(0x100, 0x20, MemoryProtection.ExecuteOnly)
ic.mem_write(0x100, B'\x90')
ic.reg_write('rip', 0x100)
status = ic.step(1)

print(F'run status      : {status}')
print(F'exception code  : {ic.exception_code}')
print(F'exception value : {hex(ic.exception_value)}')

When executing this under Python 3.12.6 on Windows, using icicle-emu==0.0.5, it produces the following output:

run status      : RunStatus.UnhandledException
exception code  : ExceptionCode.ExecViolation
exception value : 0x100

I would have expected the memory protection constant ExecuteOnly to allow execution, but executing code is only possible when the memory protection is at least ExecuteRead.

PS: I can see the argument that the code needs to be read before it can be executed, but in this case the ExecuteOnly permission seems to serve no purpose that I could think of.

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

1 participant