Executive Summary: CVE-2025-8972, a critical vulnerability in Apache ActiveMQ, allows attackers to execute arbitrary code and achieve lateral movement within Kubernetes (K8s) clusters. This flaw, with a CVSS score of 9.8, stems from improper deserialization in the OpenWire protocol handler, enabling unauthenticated remote code execution (RCE). When exploited, it grants adversaries the ability to pivot across containerized workloads, exfiltrate sensitive data, and escalate privileges. Given the widespread adoption of ActiveMQ in microservices architectures, this vulnerability poses a severe risk to cloud-native environments, particularly those leveraging K8s for orchestration.
Apache ActiveMQ’s OpenWire protocol is designed for efficient message brokering between clients and brokers. However, the protocol’s deserialization logic fails to validate serialized Java objects, trusting untrusted input. Attackers can craft malicious OpenWire frames containing serialized gadget chains (e.g., using libraries like CommonsCollections) to trigger arbitrary method execution during deserialization.
The vulnerability is triggered when a malicious client connects to the ActiveMQ broker and sends a specially crafted CONNECT or SEND message via OpenWire. The broker deserializes the payload without proper checks, executing attacker-controlled code in the context of the ActiveMQ process (typically running as activemq user).
In K8s environments, ActiveMQ is often deployed as a StatefulSet or Deployment, exposing the OpenWire port via a ClusterIP or NodePort service. Once CVE-2025-8972 is exploited, attackers gain a foothold within the cluster with the following capabilities:
activemq user may have access to K8s service accounts or secrets, enabling API token theft (e.g., via kubectl commands embedded in the payload).kubectl run --image=alpine) or exploit other vulnerable services (e.g., exposed databases, APIs) within the cluster.For example, an attacker could:
/var/run/secrets/kubernetes.io/serviceaccount.K8s introduces unique attack surfaces that amplify the risk of CVE-2025-8972:
cluster-admin) grant attackers full control over the cluster.Consider a production cluster running Apache ActiveMQ 5.17.0 (vulnerable to CVE-2025-8972) in the messaging namespace. The ActiveMQ pod is exposed via a NodePort service on port 30616. An attacker with network access to the cluster performs the following steps:
nmap or masscan, identifying the vulnerable service.ysoserial to generate a gadget chain targeting CommonsCollections6. The payload is sent to the ActiveMQ OpenWire port (61616/TCP).activemq user.kubectl to list secrets in other namespaces, including database-credentials.default namespace using the stolen credentials:
kubectl run attacker-pod --image=alpine --command -- sleep infinity
kubectl cp /tmp/malware.sh attacker-pod:/malware.sh
kubectl exec attacker-pod -- /malware.sh
Organizations must adopt a multi-layered defense strategy to mitigate CVE-2025-8972 and prevent lateral movement in K8s environments:
helm upgrade active-mq bitnami/activemq --version 10.1.1
activemq.openwire.enabled=false
in the broker configuration.apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: