← All hunts high TLP:CLEAR Part 1 of 3

ActiveMQ Exploitation and Metasploit Staging

An intruder has exploited CVE-2023-46604 on an ActiveMQ server to run arbitrary code, staged a Metasploit payload, and escalated to SYSTEM privileges using named pipe impersonation.

Based on research by The DFIR Report 2026-09-23 11 steps · 4 queries T1003.001 T1055 T1059.003 T1105 T1134 T1190

Brief

Why This Hunt

The DFIR Report recently detailed an intrusion where an adversary exploited CVE-2023-46604 in Apache ActiveMQ to deploy LockBit ransomware. This exploit allows remote code execution (RCE) with the privileges of the ActiveMQ service. Because this service often runs as a high-privilege account, it provides an immediate beachhead for the attacker. We designed this hunt to find the specific footprints of the exploitation and the subsequent Metasploit staging used to consolidate control. The source article is "Apache ActiveMQ Exploit Leads to LockBit Ransomware" (https://thedfirreport.com/2026/02/23/apache-activemq-exploit-leads-to-lockbit-ransomware/).

How the Hunt Flows

The first step identifies the scope. We query the software inventory for every host running Apache ActiveMQ. This narrows the field and ensures the heavy process and network queries only run where the risk exists.

The hunt then runs two searches in parallel. The first query looks for the Java broker spawning suspicious child processes like cmd.exe or certutil.exe. The second query checks for network connections to known C2 infrastructure or the Metasploit stager IP.

An automated agent then weights these signals. It identifies hosts where the RCE attempt and the network callback align. This confirms a successful initial beachhead before we move into the escalation phase.

The next query hunts for privilege escalation. We search for Meterpreter-specific patterns, such as the 'getsystem' named-pipe echo command and rare processes running with SYSTEM integrity that originate from temp directories or lack a backing disk.

The final synthesis step combines the early and late evidence. It provides a high-confidence verdict on whether the adversary successfully transitioned from a web exploit to full system control.

Blind Spots

This hunt requires an endpoint agent on the target servers. If a server lacks telemetry, the Java broker could spawn a shell without triggering a process event. Additionally, the hunt does not see the specific LSASS memory access masks without Sysmon Event ID 10 or equivalent handle-auditing logs. We rely on the presence of the stager and its behavior to confirm the escalation.

In this series

Steps

  1. Identify ActiveMQ infrastructure

    Query · scoping

    Locate every host running Apache ActiveMQ to narrow the search for RCE signals.

    reads hb_software_inventorysql
    SELECT DISTINCT device_hostname, package_name, package_version, install_path FROM hb_software_inventory WHERE (LOWER(package_name) LIKE '%activemq%' OR LOWER(install_path) LIKE '%activemq%')

    What a hit looks like. A list of hosts hosting the targeted application. Silence suggests no ActiveMQ is present in the inventory.

  2. Anomalous ActiveMQ child processes

    Query · detection candidate

    Find the Java broker spawning shells or downloaders, which confirms RCE execution.

    reads hb_process_activitysql
    SELECT device_hostname, process_name, process_cmd_line, parent_process_name, time FROM hb_process_activity WHERE LOWER(parent_process_name) LIKE '%java.exe' AND instr(',' || '{{suspicious_utilities}}' || ',', ',' || LOWER(process_name) || ',') > 0 AND ('{{scope_hosts}}' = '' OR instr(',' || '{{scope_hosts}}' || ',', ',' || device_hostname || ',') > 0) AND time >= datetime('now', '-{{lookback_days}} days')

    What a hit looks like. The ActiveMQ service spawning a utility like certutil.exe or a shell; this is high-fidelity evidence of exploitation.

  3. Connections to Metasploit C2

    Query · enrichment

    Correlate host activity with the reported IP of the Metasploit stager.

    reads hb_network_connectionsql
    SELECT device_hostname, process_name, dst_endpoint_ip, dst_endpoint_port, time FROM hb_network_connection WHERE instr(',' || '{{c2_ips}}' || ',', ',' || dst_endpoint_ip || ',') > 0 AND ('{{scope_hosts}}' = '' OR instr(',' || '{{scope_hosts}}' || ',', ',' || device_hostname || ',') > 0) AND time >= datetime('now', '-{{lookback_days}} days')

    What a hit looks like. Outbound traffic from the beachhead to the specified C2 IP.

  4. Triage initial staging

    Agent triage

    Determine if the ActiveMQ broker successfully established a beachhead by weighting the process and network signals.

  5. Named-pipe impersonation and rare system processes

    Query · baseline

    Hunt for the follow-on escalation phase using Meterpreter-specific patterns and by baselining rare high-privilege processes.

    reads hb_process_activitysql
    SELECT LOWER(process_path) AS path, process_cmd_line, device_hostname, integrity_level, COUNT(DISTINCT device_hostname) AS hosts, MIN(time) AS first_seen FROM hb_process_activity WHERE (LOWER(process_cmd_line) LIKE '%echo % > \\.\\pipe\\%' OR on_disk = 0 OR LOWER(process_path) LIKE '%\\temp\\%') AND integrity_level = 'System' AND ('{{scope_hosts}}' = '' OR instr(',' || '{{scope_hosts}}' || ',', ',' || device_hostname || ',') > 0) AND time >= datetime('now', '-{{lookback_days}} days') GROUP BY 1, 2, 3, 4 HAVING hosts <= 3 ORDER BY hosts ASC

    What a hit looks like. Identification of the getsystem pipe echo pattern or an injected process running as SYSTEM on a single host.

  6. Synthesize the intrusion chain

    Agent triage

    Combine the early beachhead evidence with the later escalation evidence to provide a high-confidence intrusion verdict.

  7. Route on verdict

    Decision

    Route the investigation based on the presence of a confirmed high-integrity intrusion.

  8. Isolate compromised host

    Response action

    Prevent lateral movement or the deployment of ransomware by severing the beachhead.

  9. Analyst forensic review

    Analyst task

    Verify the agent's findings and document the intrusion for follow-on investigations.

  10. Close out

    Analyst task

    Ensure the vulnerability is remediated and the hunt results are recorded.

Coverage

Scenario coverage

StageCoveredHow, or why not
Apache ActiveMQ RCE Exploitation
T1190
Yes identify-activemq-hosts, activemq-child-processes
Metasploit Payload Ingress
T1105 · T1059.003
Yes network-to-c2-ingress, activemq-child-processes
Privilege Escalation via getsystem
T1134 · T1055
Yes meterpreter-escalation-signals
Credential Access via LSASS Dumping
T1003.001
Yes meterpreter-escalation-signals
Internal Discovery and Persistence
T1046 · T1018 · T1133
Out of scope Belongs to another part of the 'Apache ActiveMQ Exploit Leads to LockBit Ransomware' series.
Defense Evasion and Log Clearing
T1070.001 · T1562.001 · T1218
Out of scope Belongs to another part of the 'Apache ActiveMQ Exploit Leads to LockBit Ransomware' series.
Lateral Movement via RDP and Services
T1021.001 · T1021.002 · T1543.003
Out of scope Belongs to another part of the 'Apache ActiveMQ Exploit Leads to LockBit Ransomware' series.
LockBit Ransomware Deployment
T1486
Out of scope Belongs to another part of the 'Apache ActiveMQ Exploit Leads to LockBit Ransomware' series.

Blind spots

  • Needs an endpoint agent on every server in scope. Exploitation could occur on unmonitored servers, leaving the intrusion invisible until lateral movement begins. It would answer whether the Java process spawned a shell on hosts without telemetry.
  • Needs Sysmon Event ID 10 or equivalent handle-auditing. Standard process activity does not show the 0x1010 VMRead access described in the article; without handle logs, we rely on the presence of the injected stager alone. It would answer the specific access mask and call trace of LSASS access.

Parameters & data

Parameters

ParameterTypeDefaultWhat it is
c2_ipslist[ip]166.62.100.52C2 server IPs observed in the report.
lookback_daysnumber14Days of history to examine.
scope_hostslist[host]—Optional list of hostnames to focus on.
suspicious_utilitieslist[string]cmd.exe, powershell.exe, certutil.exeBinaries commonly spawned by the broker during RCE.

Telemetry

SourceCategoryTelemetry
Endpoint telemetry (hb_ surfaces)endpointendpoint
Network telemetrynetworknetwork

Source

Download hunt.md Definition (JSON) An open hunt.md file; it runs anywhere that reads the format.
---
analysis: While a rule can catch the exploit attempt, this hunt correlates the RCE
  with specific functional outcomes like named-pipe impersonation and rare injected
  processes across multiple surfaces (inventory, process, and network) to identify
  successful compromise.
blind_spots:
- id: missing-process-telemetry
  question: whether the Java process spawned a shell on hosts without telemetry
  requires: an endpoint agent on every server in scope
  risk: Exploitation could occur on unmonitored servers, leaving the intrusion invisible
    until lateral movement begins.
  stage: activemq-rce-exploitation
- id: lsass-handle-missing
  question: the specific access mask and call trace of LSASS access
  requires: Sysmon Event ID 10 or equivalent handle-auditing
  risk: Standard process activity does not show the 0x1010 VMRead access described
    in the article; without handle logs, we rely on the presence of the injected stager
    alone.
  stage: credential-dumping-lsass
coverage:
- stage: activemq-rce-exploitation
  status: covered
  steps:
  - identify-activemq-hosts
  - activemq-child-processes
- stage: metasploit-payload-ingress
  status: covered
  steps:
  - network-to-c2-ingress
  - activemq-child-processes
- stage: local-privilege-escalation
  status: covered
  steps:
  - meterpreter-escalation-signals
- stage: credential-dumping-lsass
  status: covered
  steps:
  - meterpreter-escalation-signals
- reason: Belongs to another part of the 'Apache ActiveMQ Exploit Leads to LockBit
    Ransomware' series.
  stage: internal-discovery-and-persistence
  status: out_of_scope
- reason: Belongs to another part of the 'Apache ActiveMQ Exploit Leads to LockBit
    Ransomware' series.
  stage: defense-evasion-and-log-clearing
  status: out_of_scope
- reason: Belongs to another part of the 'Apache ActiveMQ Exploit Leads to LockBit
    Ransomware' series.
  stage: lateral-movement-rdp
  status: out_of_scope
- reason: Belongs to another part of the 'Apache ActiveMQ Exploit Leads to LockBit
    Ransomware' series.
  stage: lockbit-ransomware-deployment
  status: out_of_scope
guardrails:
  claims: no_unsupported
  evidence: citation_required
  missing_data: not_benign
  telemetry: untrusted
hunt:
  applicability: campaign-specific
  handoff: promote-to-detection
  justification: ActiveMQ RCE allows for rapid, high-privilege ingress; confirming
    the absence of these staging patterns provides a critical negative result for
    a known ransomware entry point.
  methodology: model-assisted
  trigger: intel-report
hypothesis: An intruder has exploited CVE-2023-46604 on an ActiveMQ server to run
  arbitrary code, staged a Metasploit payload, and escalated to SYSTEM privileges
  using named pipe impersonation.
labels:
- hunt
- attack.t1190
- attack.t1105
- attack.t1059.003
- attack.t1134
- attack.t1055
- attack.t1003.001
name: ActiveMQ Exploitation and Metasploit Staging
parameters:
  c2_ips:
    default:
    - 166.62.100.52
    description: C2 server IPs observed in the report.
    from:
      kind: article
      observed: '2024-02-23'
      ref: https://thedfirreport.com/2026/02/23/apache-activemq-exploit-leads-to-lockbit-ransomware/
    type: list[ip]
  lookback_days:
    default: '14'
    description: Days of history to examine.
    type: number
  scope_hosts:
    default: []
    description: Optional list of hostnames to focus on.
    type: list[host]
  suspicious_utilities:
    default:
    - cmd.exe
    - powershell.exe
    - certutil.exe
    description: Binaries commonly spawned by the broker during RCE.
    from:
      kind: article
      observed: '2024-02-23'
      ref: https://thedfirreport.com/2026/02/23/apache-activemq-exploit-leads-to-lockbit-ransomware/
    type: list[string]
provenance:
  authors:
  - name: Huntbase hunt generation
    org: huntbase.io
  generated:
    by: huntbase-hunt-generation
    from: https://thedfirreport.com/2026/02/23/apache-activemq-exploit-leads-to-lockbit-ransomware/
    gates:
    - dry-run
    - lint
    model: hb_google/gemini-3-flash-preview
rationale: Focus on servers hosting ActiveMQ and widen the search to any Java-based
  web application if the initial scope is empty.
references:
- name: "The DFIR Report \u2014 Apache ActiveMQ Exploit Leads to LockBit Ransomware"
  url: https://thedfirreport.com/2026/02/23/apache-activemq-exploit-leads-to-lockbit-ransomware/
related:
- hunt: activemq-internal-reconnaissance
  reason: This hunt targets the beachhead; a following hunt tracks the actor's SMB
    scanning and lateral movement.
  relation: follows
scenario:
  stages:
  - name: Apache ActiveMQ RCE Exploitation
    observables:
    - CVE-2023-46604
    - org.springframework.context.support.ClassPathXmlApplicationContext
    - ActiveMQ server process java.exe parent
    - Java Spring bean configuration XML file download
    slug: activemq-rce-exploitation
    tactic: initial-access
    techniques:
    - T1190
  - name: Metasploit Payload Ingress
    observables:
    - certutil.exe -urlcache -f
    - uFSyLszKsuR.exe
    - C:\Users\\AppData\Local\Temp\uFSyLszKsuR.exe
    - 166.62.100.52
    slug: metasploit-payload-ingress
    tactic: execution
    techniques:
    - T1105
    - T1059.003
  - name: Privilege Escalation via getsystem
    observables:
    - cmd.exe /c echo kesknq > \\.\pipe\kesknq
    - Metasploit stager with SYSTEM level permissions
    - Service name kesknq
    slug: local-privilege-escalation
    tactic: privilege-escalation
    techniques:
    - T1134
    - T1055
  - name: Credential Access via LSASS Dumping
    observables:
    - lsass.exe memory access
    - GrantedAccess 0x1010 (VMRead)
    - CallTrace UNKNOWN indicative of injected code
    slug: credential-dumping-lsass
    tactic: credential-access
    techniques:
    - T1003.001
  - name: Internal Discovery and Persistence
    observables:
    - AnyDesk.exe installation
    - AnyDesk Service creation (Event ID 7045)
    - Advanced_IP_Scanner.exe
    - SMB traffic spikes (network scanning)
    slug: internal-discovery-and-persistence
    tactic: discovery
    techniques:
    - T1046
    - T1018
    - T1133
  - name: Defense Evasion and Log Clearing
    observables:
    - rdp.bat creation and deletion
    - wevtutil cl System
    - wevtutil cl Security
    - SystemSettingsAdminFlows.exe used to disable Windows Defender
    - Injected winlogon.exe creating batch files
    slug: defense-evasion-and-log-clearing
    tactic: defense-evasion
    techniques:
    - T1070.001
    - T1562.001
    - T1218
  - name: Lateral Movement via RDP and Services
    observables:
    - RDP connections using privileged service accounts
    - Remote service execution of Metasploit payloads
    - Firewall modification to allow port 3389
    slug: lateral-movement-rdp
    tactic: lateral-movement
    techniques:
    - T1021.001
    - T1021.002
    - T1543.003
  - name: LockBit Ransomware Deployment
    observables:
    - LockBit ransomware binary execution
    - Execution with specific path and password flags
    - Execution from Downloads folder via double-click
    slug: lockbit-ransomware-deployment
    tactic: impact
    techniques:
    - T1486
  summary: A threat actor exploited an internet-facing Apache ActiveMQ server using
    CVE-2023-46604 to execute code via Java Spring bean XML files, subsequently downloading
    a Metasploit stager using CertUtil. The intrusion involved privilege escalation
    via getsystem, credential dumping from LSASS, and extensive lateral movement using
    RDP and remote services before deploying LockBit ransomware.
series:
  index: 1
  slug: apache-activemq-exploit-leads-to-lockbit-ransomware
  title: Apache ActiveMQ Exploit Leads to LockBit Ransomware
  total: 3
severity: high
targets:
  analyst:
    name: Tier-2 analyst
    role: analyst
  endpoint:
    category: endpoint
    name: Endpoint telemetry (hb_ surfaces)
    telemetry:
    - endpoint
  hunter:
    agent: true
    name: Hunt agent
  network:
    category: network
    name: Network telemetry
    telemetry:
    - network
tlp: clear
type: investigation
---


# ActiveMQ Exploitation and Metasploit Staging

This hunt targets the initial breach and local consolidation phases of a ransomware intrusion. It begins by identifying the ActiveMQ footprint, then searches for anomalous process forks from the Java broker and outbound C2 connections. A follow-on phase hunts for Meterpreter-specific privilege escalation patterns, such as named-pipe impersonation and injected system processes. Two agent stages weigh the early and late evidence to confirm a beachhead and escalation before routing to containment.

## identify-activemq-hosts
<!-- Identify ActiveMQ infrastructure -->
Locate every host running Apache ActiveMQ to narrow the search for RCE signals.

```sqlite target=endpoint role=scoping
~~~yaml
expected: A list of hosts hosting the targeted application. Silence suggests no ActiveMQ
  is present in the inventory.
reads:
- device_hostname
- package_name
- package_version
- install_path
silence: not_evidence_of_absence
source: hb_software_inventory
verified: dry-run
verified_at: '2026-09-23'
~~~
SELECT DISTINCT device_hostname, package_name, package_version, install_path FROM hb_software_inventory WHERE (LOWER(package_name) LIKE '%activemq%' OR LOWER(install_path) LIKE '%activemq%')
```

## early-activity
<!-- Parallel search for RCE and C2 -->
parallel:
- → activemq-child-processes
- → network-to-c2-ingress
join: → triage-early-stage

## activemq-child-processes
<!-- Anomalous ActiveMQ child processes -->
Find the Java broker spawning shells or downloaders, which confirms RCE execution.

```sqlite target=endpoint role=detection-candidate params=(lookback_days=lookback_days, scope_hosts=scope_hosts, suspicious_utilities=suspicious_utilities)
~~~yaml
expected: The ActiveMQ service spawning a utility like certutil.exe or a shell; this
  is high-fidelity evidence of exploitation.
reads:
- device_hostname
- process_name
- process_cmd_line
- parent_process_name
- time
silence: evidence_of_absence
source: hb_process_activity
verified: dry-run
verified_at: '2026-09-23'
~~~
SELECT device_hostname, process_name, process_cmd_line, parent_process_name, time FROM hb_process_activity WHERE LOWER(parent_process_name) LIKE '%java.exe' AND instr(',' || '{{suspicious_utilities}}' || ',', ',' || LOWER(process_name) || ',') > 0 AND ('{{scope_hosts}}' = '' OR instr(',' || '{{scope_hosts}}' || ',', ',' || device_hostname || ',') > 0) AND time >= datetime('now', '-{{lookback_days}} days')
```

## network-to-c2-ingress
<!-- Connections to Metasploit C2 -->
Correlate host activity with the reported IP of the Metasploit stager.

```sqlite target=network role=enrichment params=(lookback_days=lookback_days, scope_hosts=scope_hosts, c2_ips=c2_ips)
~~~yaml
expected: Outbound traffic from the beachhead to the specified C2 IP.
reads:
- device_hostname
- process_name
- dst_endpoint_ip
- dst_endpoint_port
- time
silence: not_evidence_of_absence
source: hb_network_connection
verified: dry-run
verified_at: '2026-09-23'
~~~
SELECT device_hostname, process_name, dst_endpoint_ip, dst_endpoint_port, time FROM hb_network_connection WHERE instr(',' || '{{c2_ips}}' || ',', ',' || dst_endpoint_ip || ',') > 0 AND ('{{scope_hosts}}' = '' OR instr(',' || '{{scope_hosts}}' || ',', ',' || device_hostname || ',') > 0) AND time >= datetime('now', '-{{lookback_days}} days')
```

## triage-early-stage
<!-- Triage initial staging -->
```agent target=hunter
cite: required
context:
- activemq-child-processes
- network-to-c2-ingress
max_iterations: 4
objective: Identify hosts where ActiveMQ executed a suspicious child and contacted
  the Metasploit C2 IP.
success_criteria: A verdict for each host in the early phase context.
tools:
- endpoint
- network
```

## meterpreter-escalation-signals
<!-- Named-pipe impersonation and rare system processes -->
Hunt for the follow-on escalation phase using Meterpreter-specific patterns and by baselining rare high-privilege processes.

```sqlite target=endpoint role=baseline params=(lookback_days=lookback_days, scope_hosts=scope_hosts)
~~~yaml
baseline:
  compare: first_seen
  window: '{{lookback_days}}d'
expected: Identification of the getsystem pipe echo pattern or an injected process
  running as SYSTEM on a single host.
prevalence:
  by: device_hostname
  key:
  - process_path
  rare_below: 3
reads:
- process_path
- process_cmd_line
- device_hostname
- integrity_level
- on_disk
- time
silence: not_evidence_of_absence
source: hb_process_activity
verified: dry-run
verified_at: '2026-09-23'
~~~
SELECT LOWER(process_path) AS path, process_cmd_line, device_hostname, integrity_level, COUNT(DISTINCT device_hostname) AS hosts, MIN(time) AS first_seen FROM hb_process_activity WHERE (LOWER(process_cmd_line) LIKE '%echo % > \\.\\pipe\\%' OR on_disk = 0 OR LOWER(process_path) LIKE '%\\temp\\%') AND integrity_level = 'System' AND ('{{scope_hosts}}' = '' OR instr(',' || '{{scope_hosts}}' || ',', ',' || device_hostname || ',') > 0) AND time >= datetime('now', '-{{lookback_days}} days') GROUP BY 1, 2, 3, 4 HAVING hosts <= 3 ORDER BY hosts ASC
```

## triage-full-intrusion
<!-- Synthesize the intrusion chain -->
```agent target=hunter
cite: required
context:
- triage-early-stage
- meterpreter-escalation-signals
max_iterations: 6
objective: Confirm if a host transitioned from ActiveMQ RCE to high-integrity Metasploit
  execution.
success_criteria: A final verdict citing the specific commands and network connections
  across all phases.
tools:
- endpoint
- network
```

## route-on-verdict
<!-- Route on verdict -->
if~: "the triage-full-intrusion verdict is malicious for at least one host showing the transition to SYSTEM privileges" (confidence: high, judge=hunter)
then: → isolate-host
indeterminate: → analyst-review
unavailable: → analyst-review (blind_spot: missing-process-telemetry)
else: → close-out

## isolate-host
<!-- Isolate compromised host -->
```action target=endpoint
~~~yaml
approval: required
~~~
Isolate the host immediately. Capture the process image of any injected or rare SYSTEM processes identified in the triage.
```
→ analyst-review

## analyst-review
<!-- Analyst forensic review -->
```manual target=analyst
Review the process command lines identified in the triage steps. Check for evidence of log clearing (System Log Event ID 104) and LSASS access (Sysmon Event ID 10).
```
→ close-out

## close-out
<!-- Close out -->
```manual target=analyst
Record the findings. Verify that the Apache ActiveMQ instance has been patched to version 5.18.3 or later.
```
→ end

Run it

Take this hunt into your environment.

Open it in Huntbase to run every step against your own connections, with Scout weighing the evidence and your analysts in command. Or take the open hunt.md file anywhere that reads the format.

Machine-drafted by huntbase-hunt-generation using hb_google/gemini-3-flash-preview, gated by dry-run, lint, then reviewed by a person.