Offset data by 1
This commit is contained in:
parent
de9dadc961
commit
ea9a78d8b9
@ -111,6 +111,10 @@ class ROPMakerX86(object):
|
||||
return p
|
||||
|
||||
def __buildRopChain(self, write4where, popDst, popSrc, xorSrc, xorEax, incEax, popEbx, popEcx, popEdx, syscall):
|
||||
#print("== Gadgets ==")
|
||||
#print(self.__gadgets)
|
||||
#print("=============\n\n\n\n")
|
||||
|
||||
sects = self.__binary.getDataSections()
|
||||
dataAddr = None
|
||||
for s in sects:
|
||||
@ -123,6 +127,13 @@ class ROPMakerX86(object):
|
||||
print(f"dataAddr = 0x{dataAddr:08x}")
|
||||
print(f"int 0x80 = 0x{syscall['vaddr']:08x}")
|
||||
|
||||
# Offset address to make all addresses even.
|
||||
# This prevent having a null byte in any addresses we write to.
|
||||
if dataAddr % 2 == 0:
|
||||
dataAddr += 1
|
||||
|
||||
print(f"dataAddr = 0x{dataAddr:08x}")
|
||||
|
||||
# prepend padding
|
||||
p = bytes('A' * self.paddingLen, "ascii")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user