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

Problem with "--unique" #59

Closed
Not-C-Developer opened this issue Feb 13, 2025 · 7 comments · Fixed by #60
Closed

Problem with "--unique" #59

Not-C-Developer opened this issue Feb 13, 2025 · 7 comments · Fixed by #60

Comments

@Not-C-Developer
Copy link

Not-C-Developer commented Feb 13, 2025

Hi

It might me a problem with "--unique" parameter

Release version: 2.1.3
Windows x86

When i've tested, some ROP gadgets has been lost.

Commands for test
rp-win.exe -f "C:\Program Files\ibm\gsk8\lib\N\icc\osslib\libeay32IBM019.dll" -r 5 --bad-bytes \x00\x09\x0a\x0b\x0c\x0d\x20 > libeay32IBM019.txt
Select-String -Path libeay32IBM019.txt -Pattern ': pop ecx ; ret '|Measure-Object -Line
rp-win.exe -f "C:\Program Files\ibm\gsk8\lib\N\icc\osslib\libeay32IBM019.dll" -r 5 --bad-bytes \x00\x09\x0a\x0b\x0c\x0d\x20 --unique > libeay32IBM019_uniq.txt
Select-String -Path libeay32IBM019_uniq.txt -Pattern ': pop ecx ; ret '|Measure-Object -Line

Image
@0vercl0k
Copy link
Owner

0vercl0k commented Feb 13, 2025 via email

@Not-C-Developer
Copy link
Author

@0vercl0k
Copy link
Owner

0vercl0k commented Feb 14, 2025 via email

@0vercl0k
Copy link
Owner

0vercl0k commented Feb 15, 2025

Okay yeah I think I see the issue..🤦‍♂️

Basically uniqueness is calculated before applying the badbytes which means that if you have the same gadgets at N addresses and some of them have badbytes but some don't, the first one is picked as the 'unique' one discarding the other ones (regardless of it having badbytes or not). Then, all those unique hits are walked through & filtered for badbytes which means that now we have a gadget that has a badbyte so isn't shown; but there were duplicates that didn't have badbytes.

Anyways, give me a few days to get this fixed 😅

Cheers & thank you for the report!

@0vercl0k
Copy link
Owner

Okay I think I have a fix (it's not pretty but it'll have to do):

c:\>C:\work\codes\rp\src\build\RelWithDebInfo\rp-win.exe -r 5 -f libeay32IBM019.dll --unique --bad-bytes \x00\x09\x0a\x0b\x0c\x0d\x20 | rg ": pop ecx ; ret"
0x10011abb: pop ecx ; ret ; (283 found)

@Not-C-Developer you can try it out by grabbing the code in this branch: https://github.com/0vercl0k/rp/tree/fbl_%2359 & recompiling it yourself.

There's still this linking issue that I need to look into..

Cheers

@0vercl0k
Copy link
Owner

0vercl0k commented Feb 16, 2025

Okay actually I just fixed it - @Not-C-Developer you can also grab directly the CI artifacts if you don't want to rebuild it yourself; please give a shot to this one and let me know if it fixes your bug / if you see any other issue :)

Cheers

@0vercl0k
Copy link
Owner

All right, if I don't here anything on here before next week-end I'll get this merged on ~Sunday :)

Cheers

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