Skip to content

Commit

Permalink
Merge branch 'beta' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Arusekk committed Jul 17, 2023
2 parents d69e294 + cc3b28b commit 42c0798
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions pwnlib/rop/rop.py
Original file line number Diff line number Diff line change
Expand Up @@ -1544,23 +1544,18 @@ def ret2csu(self, edi=Padding('edi'), rsi=Padding('rsi'),
# Prioritise non-PIE binaries so we can use _fini
exes = (elf for elf in self.elfs if not elf.library and elf.bits == 64)

nonpie = csu = None
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:
if '__libc_csu_init' in elf.symbols:
csu = elf
if not elf.pie:
break

if csu:
elf = csu
else:
log.error('No non-library binaries in [elfs]')

if elf.pie:
if nonpie:
elf = nonpie
elif csu:
elf = csu

from .ret2csu import ret2csu
ret2csu(self, elf, edi, rsi, rdx, rbx, rbp, r12, r13, r14, r15, call)

Expand Down

0 comments on commit 42c0798

Please sign in to comment.