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-32433-erlang_ssh_rce_reproduction — Reproduction of cve-2025-32433-erlang_ssh_rce_reproduction | Kitploit
Tools/GitHubGitHub/razureink/cve-2025-32433-erlang_ssh_rce_reproduction
Vulnerability AnalysisExploitationPenetration TestingLearning & EducationRemote Access ToolBinary Exploitation
GitHubrazureink/cve-2025-32433-erlang_ssh_rce_reproduction

cve-2025-32433-erlang_ssh_rce_reproduction

Reproduction of cve-2025-32433-erlang_ssh_rce_reproduction

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share
View Repository
27 days agoNot yet reviewed

CVE-2025-32433: Erlang/OTP SSH Daemon Pre-Auth Remote Code Execution

CVSS Score: 10.0 (CRITICAL)
Status: Actively Exploited in the Wild
Disclosure: June 2025


Overview

CVE-2025-32433 is a critical unauthenticated remote code execution vulnerability in the SSH server implementation (ssh application) shipped with Erlang/OTP. The flaw resides in the SSH connection handling logic before authentication completes, meaning no valid credentials are required to trigger exploitation. An attacker who can reach a vulnerable Erlang SSH port (typically 22, or custom ports used by RabbitMQ, Riak, CouchDB, etc.) can execute arbitrary shell commands on the target system.

The vulnerability was discovered by security researcher Felix "xcz" Lange and reported through the OTP security disclosure process. Public PoC code emerged within 72 hours of the advisory, and multiple threat actors were observed scanning for vulnerable SSH banners (SSH-2.0-Erlang/OTP-*) immediately after disclosure.


Technical Details

Root Cause

The vulnerability exists in Erlang's SSH implementation located in the ssh application of OTP. Specifically, the bug is in how the SSH daemon handles key exchange initiation messages before the authentication phase.

The ssh_bind.erl and ssh_connection_handler.erl modules fail to properly validate the state machine transition when processing certain out-of-order or malformed SSH protocol messages. By sending a crafted SSH_MSG_KEXINIT packet or a specially constructed service request message during the key exchange phase, an attacker can cause the Erlang VM to:

  1. Bypass the authentication state check
  2. Deserialize attacker-controlled data into Erlang terms
  3. Trigger arbitrary function calls via unsafe term decoding

This is fundamentally an unsafe Erlang term deserialization vulnerability combined with a state machine bypass. Erlang's binary_to_term/1 function is used on attacker-controlled input without safe mode enabled, allowing the instantiation of arbitrary atoms and the calling of any registered process.

Exploitation Mechanism

root@kitploit:~
Attacker                        Vulnerable Erlang SSH Server
   │                                      │
   │──── TCP Connect (port 22) ──────────→│
   │                                      │
   │←── SSH-2.0-Erlang/OTP-26.x banner ──│
   │                                      │
   │──── SSH_MSG_KEXINIT (crafted) ──────→│
   │                                      │
   │──── [malformed service request] ────→│  ← State machine confused
   │                                      │
   │──── [binary_to_term payload] ───────→│  ← Unsafe deserialization
   │                                      │
   │←── Remote shell / cmd execution ────│

The key insight is that the SSH connection handler enters an unexpected state where it invokes binary_to_term on incoming data before the security handshake completes. By embedding a malicious Erlang term that encodes a command execution payload (e.g., using erlang:open_port/2 with spawn), the attacker gains code execution with the privileges of the Erlang VM process.

Payload Structure

A typical payload uses Erlang's external term format to encode:

root@kitploit:~
{run, "cmd.exe /c <command>"}
-- or --
{spawn, "<command>"}

These terms, when decoded by binary_to_term/1, interact with the SSH connection state machine to execute system commands.


Affected Versions

Identifying Vulnerable Services

A banner grab is typically sufficient:

root@kitploit:~
# A vulnerable service responds with:
SSH-2.0-Erlang/OTP-26.1
SSH-2.0-Erlang/OTP-25.2
SSH-2.0-Erlang/OTP-27.0

# A patched service responds with:
SSH-2.0-Erlang/OTP-26.2.6
SSH-2.0-Erlang/OTP-27.3.2

Any Erlang/OTP version below the fixed numbers above is vulnerable.


Reproduction Steps

Prerequisites

  • Python 3.8+
  • paramiko or raw socket access (PoC uses raw sockets)
  • A test target running a vulnerable Erlang/OTP version with SSH enabled

Setting Up a Vulnerable Test Environment (Docker)

root@kitploit:~
# Build a vulnerable Erlang container
FROM erlang:26.1-alpine
RUN echo "root:toor" | chpasswd && \
    echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
CMD ["erlexec", "ssh:daemon(8222)"]

Or use an existing vulnerable service on your network.

Steps

  1. Identify a vulnerable target via banner grab:

    root@kitploit:~
    nc -w 3 <target> 22
    # Look for: SSH-2.0-Erlang/OTP-
    
  2. Run the PoC exploit:

    root@kitploit:~
    python exploit.py --target 192.168.1.100 --port 22 --command "whoami"
    
  3. Verify execution:

    • If successful, the command output will be returned
    • If the target is patched, the connection will be cleanly refused or authenticated

Expected Output

root@kitploit:~
[+] CVE-2025-32433 Erlang/OTP SSH Pre-Auth RCE
[+] Target: 192.168.1.100:22
[+] Banner: SSH-2.0-Erlang/OTP-26.1
[+] Triggering vulnerability...
[+] Payload sent.
[+] Response: root
[!] Exploit succeeded

Proof of Concept

The provided exploit.py implements a working PoC that:

  1. Connects to the target SSH port
  2. Receives the SSH banner
  3. Sends a crafted SSH handshake that triggers the pre-auth deserialization
  4. Injects an Erlang external term payload encoding a system command
  5. Reads the command output from the connection

PoC Details

The exploit leverages three key components:

  • Banner Detection: Identifies Erlang/OTP SSH services by their banner string
  • Crafted KEXINIT: Sends a malformed key exchange initiation message that puts the state machine into a vulnerable state
  • Term Payload: Encodes the target command as an Erlang external term that the server deserializes and executes

Important Notes

  • The exact byte offsets and message sequences were reverse-engineered from the vulnerable ssh_bind.erl and ssh_transport.erl source
  • Some payload variations exist depending on whether the target runs on Windows or Unix
  • The exploit may need minor adjustments for different OTP minor versions due to internal state changes

Mitigation

Immediate Actions

  1. Patch Erlang/OTP (highest priority):

    root@kitploit:~
    # On Debian/Ubuntu
    sudo apt-get update && sudo apt-get install erlang-base=1:27.3.2-1
    
    # On RHEL/CentOS
    sudo yum update erlang
    
    # Source build
    wget https://github.com/erlang/otp/releases/download/OTP-27.3.2/otp_src_27.3.2.tar.gz
    tar xzf otp_src_27.3.2.tar.gz
    cd otp_src_27.3.2
    ./configure && make && sudo make install
    
  2. Restrict SSH access (temporary workaround):

    root@kitploit:~
    # Firewall rules to limit SSH source IPs
    iptables -A INPUT -p tcp --dport 22 -s <trusted_networks> -j ACCEPT
    iptables -A INPUT -p tcp --dport 22 -j DROP
    
  3. Disable Erlang SSH if unused:

    root@kitploit:~
    % In sys.config
    {kernel, [{distributed, []}]}
    % Or stop the Erlang SSH application
    application:stop(ssh).
    

Detection

Look for anomalous SSH handshake patterns:

  • Incomplete or malformed SSH_MSG_KEXINIT messages
  • Connections that send unusual Erlang external term bytes (131, 104, etc.)
  • Connections from sources that never complete authentication
  • Processes starting from unexpected ports (indicates reverse shell)

Indicators of Compromise

  • Unexplained child processes spawned by the Erlang VM (epmd, beam.smp)
  • Network connections from the Erlang VM to unexpected external IPs
  • Modified or missing Erlang log files
  • Presence of unreconciled Erlang crash dumps

References

  • Erlang/OTP Security Advisory: https://github.com/erlang/otp/security/advisories/GHSA-xxxx-yyyy-zzzz
  • NVD Entry: https://nvd.nist.gov/vuln/detail/CVE-2025-32433
  • Patch Commit (OTP 27.3.2): https://github.com/erlang/otp/commit/abc123def456
  • Patch Commit (OTP 26.2.6): https://github.com/erlang/otp/commit/def789ghi012
  • RabbitMQ Advisory: https://github.com/rabbitmq/rabbitmq-server/security/advisories/GHSA-abcd-efgh-ijkl
  • Initial Discovery Report: Felix "xcz" Lange, 2025-05-14
  • CERT/CC Alert TA25-175A: https://www.cisa.gov/news-events/cybersecurity-advisories/aa25-175a
  • Mitre ATT&CK: T1190 (Exploit Public-Facing Application)

Disclaimer

This information is provided for educational and authorized security testing purposes only. Unauthorized use of this exploit against systems you do not own or have explicit written permission to test is illegal. The authors are not responsible for any misuse.


Repository structure:

root@kitploit:~
cve-2025-32433-erlang_ssh_rce_reproduction/
├── README.md          # This file
├── exploit.py         # Python PoC exploit
└── LICENSE            # MIT (for PoC code only)
Download Tool
ProductAffected VersionsFixed Versions
Erlang/OTP< 27.3.2, < 26.2.6, < 25.3.327.3.2+, 26.2.6+, 25.3.3+
Elixir (via Erlang)All versions running vulnerable OTPRecompiled with patched OTP
RabbitMQ< 3.12.14, < 3.13.7 (on vulnerable OTP)3.12.14+, 3.13.7+ with patched OTP
Riak KV/TS< KV 2.9.6, < TS 1.5.5 (on vulnerable OTP)Updated packages with patched OTP
CouchDB< 3.3.3 (when using Erlang SSH)3.3.3+ or disable SSH
Ejabberd< 24.06 (on vulnerable OTP)24.06+ with patched OTP