Offset data by 1

This commit is contained in:
Liam Dalgarno 2020-11-29 22:59:38 +00:00
parent de9dadc961
commit ea9a78d8b9

View File

@ -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")