-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Another attempt for rop.ret2csu #1429
Conversation
…init' in elf.symbols
|
Any idea to use ret2csu automatically in |
|
@Arusekk can you update this branch and see if we can get this merged? |
|
Updated. I want to state that I am against merging it as it is now, since:
|
|
I changed this to a lazy import, and added tests (and they do work locally, I swear). |
|
I agree with @Arusekk's points. "From own import *" needs to be as fast as possible. We should probably do some benchmarking of each commit with hyper fine to see where speed regressions lie. Tests are absolutely critical for anything like this, and should definitely include at LEAST the basic case, if not also cases that do NOT work (eg missing the CSU area) to make sure things break in a clean and resumaable fashion |
|
Alrightee, I have seriously no clue about why is this working every time under python 2, while never working under python 3 on GHA. It also always works locally, so this is a total mystery. Py3 even generates the very rop chain that py2 does, and it writes the same input to the same executable file! If anyone could investigate further, this would be a great relief. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine for me on Python 3.6.9, on which version exactly it didnt work, can you please provide more details?
| nonpie = csu = None | ||
| for elf in exes: | ||
| if not elf.pie: | ||
| if '__libc_csu_init' in elf.symbols: | ||
| break | ||
| nonpie = elf | ||
| elif '__libc_csu_init' in elf.symbols: | ||
| csu = elf | ||
|
|
||
| if elf.pie: | ||
| if nonpie: | ||
| elf = nonpie | ||
| elif csu: | ||
| elf = csu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| nonpie = csu = None | |
| for elf in exes: | |
| if not elf.pie: | |
| if '__libc_csu_init' in elf.symbols: | |
| break | |
| nonpie = elf | |
| elif '__libc_csu_init' in elf.symbols: | |
| csu = elf | |
| if elf.pie: | |
| if nonpie: | |
| elf = nonpie | |
| elif csu: | |
| elf = csu | |
| for e in exes: | |
| elf = e | |
| if not e.pie: | |
| break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about all the elves having __libc_csu_init in their symbols? This code is not mine, so I have no idea of this logic and I fancy the idea of simplifying it.
Works fine for me too, on all py 3 versions from 3.6 to 3.10, does not work on the CI only. Here are the details:
|
|
Bug report (unrelated to the mysterious CI crashing): the whole section here makes assumptions about the order of .text:00000000004012D0 loc_4012D0: ; CODE XREF: __libc_csu_init+54↓j
.text:00000000004012D0 mov rdx, r14
.text:00000000004012D3 mov rsi, r13
.text:00000000004012D6 mov edi, r12d
.text:00000000004012D9 call ds:(__frame_dummy_init_array_entry - 403DF8h)[r15+rbx*8]The code hyperlinked above assumes that r13-15 are used in setting edi/rsi/rdx, but (apparently) that isn't universal. Locally, I made a hardcoded solution of changing r13-15 to r12-14, but I'm pretty sure that's not the right thing to do for the actual finalized PR. Not too familiar with capstone and I'm guessing there'll be a lot more horrible edge cases to come. |
BTW fix py3 sockets incosistency
|
Update: the core file is not dropped under python 3 at all, supposedly because there already is a |
Just an adjusted copy of #1138