Skip to content

Commit

Permalink
Fix nasty race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Arusekk committed Apr 29, 2021
1 parent 6b906a2 commit d90302e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pwnlib/tubes/process.py
Expand Up @@ -1014,16 +1014,18 @@ def writemem(self, address, data):
Wait for one byte of input, then write the data to stdout
>>> assembly += shellcraft.write(1, address, 1)
>>> assembly += shellcraft.read(0, 'esp', 1)
>>> assembly += shellcraft.write(1, address, 32)
>>> assembly += shellcraft.exit()
>>> asm(assembly)[32:]
b'1\xdb\x89\xe1j\x01Zj\x03X\xcd\x80j\x01[\xb9\xff\xff\xef\xff\xf7\xd1j Zj\x04X\xcd\x801\xdbj\x01X\xcd\x80'
b'j\x01[\xb9\xff\xff\xef\xff\xf7\xd1\x89\xdaj\x04X\xcd\x801\xdb\x89\xe1j\x01Zj\x03X\xcd\x80j\x01[\xb9\xff\xff\xef\xff\xf7\xd1j Zj\x04X\xcd\x801\xdbj\x01X\xcd\x80'
Assemble the binary and test it
>>> elf = ELF.from_assembly(assembly, vma=address)
>>> io = elf.process()
>>> _ = io.recvuntil(b'\x90')
>>> _ = io.writemem(address, data)
>>> io.send(b'X')
>>> io.recvall()
Expand Down

0 comments on commit d90302e

Please sign in to comment.