Following an article introducing ROP on Windows, I found that the author put some literal numbers in the ROP chain.
The code snippet generating the shellcode:
rop += struct.pack('<L',0x10013b1c) # POP EBX # RETN
rop += struct.pack('<L',0xffffffff) # will be 0x1
rop += struct.pack('<L',0x100319d3) # INC EBX # FPATAN # RETN
rop += struct.pack('<L',0x100319d3) # INC EBX # FPATAN # RETN
#------------------------------------[dwSize (0x1) -> EBX]-#
rop += struct.pack('<L',0x10030361) # POP EAX # RETN
rop += struct.pack('<L',0x90909090) # NOP
#---------------------------------------------[NOP -> EAX]-#
From my understanding, the ROP chain should consist of memory addresses that pointing to the gadget, so CPU will execute the instructions at the corresponding memory address sequentially. Yet, the author put 0xffffffff
and 0x90909090
in the gadget chain.
Can somebody explain the use of these literal numbers in the ROP chain? Thank you.