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

Help: wondering some code snippets' implement. #8

Open
Squirre17 opened this issue Apr 19, 2023 · 1 comment
Open

Help: wondering some code snippets' implement. #8

Squirre17 opened this issue Apr 19, 2023 · 1 comment

Comments

@Squirre17
Copy link

if (shtable[j+1].sh_addr - shtable[j].sh_addr+shtable[j].sh_size >= patch_size+stager_size) {

I plot a layout like the following:

        |------------------| <-- shtable[j].sh_addr
        |                  ||                  |                     |
        |    content of    |              shtable[j].sh_size
        |     section      |                     |
        |                  ||------------------| <-------------------|
        |      vacuum      |
        |    for  payload  |
        |      inject      |
        |------------------| <-- shtable[j+1].sh_addr

patch_size and stager_size together represent the total size of the payload. Therefore, I believe that the correct condition would be shtable[j+1].sh_addr - shtable[j].sh_addr - shtable[j].sh_size >= patch_size + stager_size. However, please let me know if I have misunderstood the implementation or if there are any errors in my statement."

@Risminator
Copy link
Contributor

I think you are absolutely right! I've been testing it for a while now, and the initial condition is, indeed, incorrect: drow says that the injection is successful when, in fact, it is not, as there is not enough space. But using your corrected condition, drow makes accurate predictions whether the injection will be successful or not, the space needed is calculated as it should be.

Tested on edge cases when the target program goes from successful execution to segmenetation fault on start.

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