CVE-2021-22160
📋 TL;DR
This vulnerability in Apache Pulsar allows attackers to bypass JWT token authentication by using tokens with the 'none' algorithm, which are not properly validated. It affects any Apache Pulsar instance configured to use JWT-based authentication, potentially enabling unauthorized access as any user, including administrators. The issue stems from improper JWT signature validation, making it critical for organizations using Pulsar with JWT authentication.
💻 Affected Systems
- Apache Pulsar
📦 What is this software?
Pulsar by Apache
⚠️ Risk & Real-World Impact
Worst Case
An attacker gains full administrative access to the Pulsar cluster, allowing them to read, modify, or delete data, disrupt services, or escalate privileges across connected systems.
Likely Case
Unauthorized users impersonate legitimate users to access sensitive data or perform unauthorized operations within the Pulsar environment, leading to data breaches or service manipulation.
If Mitigated
If proper controls like network segmentation and strict access policies are in place, impact may be limited to isolated components, but authentication bypass still poses a significant risk.
🎯 Exploit Status
Exploitation is straightforward as it involves crafting a JWT token with the 'none' algorithm, requiring no special tools or deep technical knowledge.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Apache Pulsar 2.7.2
Vendor Advisory: https://lists.apache.org/thread.html/r347650d15a3e9c5f58b83e918b6ad6dedc2a63d3eb63da8e6a7be87e@%3Cusers.pulsar.apache.org%3E
Restart Required: Yes
Instructions:
1. Download Apache Pulsar version 2.7.2 or later from the official Apache website. 2. Stop the Pulsar service. 3. Replace the existing installation with the new version. 4. Restart the Pulsar service and verify it is running correctly.
🔧 Temporary Workarounds
Disable JWT Authentication
allTemporarily disable JWT-based authentication in Pulsar configuration to prevent exploitation until patching is possible.
Edit the Pulsar configuration file (e.g., broker.conf) and set 'authenticationEnabled=false' or remove JWT-specific settings.
Implement Network Access Controls
linuxRestrict network access to Pulsar instances to trusted IP addresses only, reducing exposure to potential attackers.
Use firewall rules (e.g., iptables on Linux: 'iptables -A INPUT -p tcp --dport 6650 -s trusted_ip -j ACCEPT' and 'iptables -A INPUT -p tcp --dport 6650 -j DROP') or similar on other platforms.
🧯 If You Can't Patch
- Monitor logs for unusual authentication attempts or JWT tokens with 'none' algorithm and block suspicious IPs.
- Enforce multi-factor authentication or additional security layers for Pulsar access to mitigate unauthorized entry.
🔍 How to Verify
Check if Vulnerable:
Check if JWT authentication is enabled in Pulsar configuration and verify the version is between 2.7.0 and 2.7.1; attempt to authenticate with a JWT token using 'none' algorithm to test bypass.
Check Version:
On the Pulsar server, run: 'pulsar-admin brokers version' or check the Pulsar binary with './bin/pulsar version'.
Verify Fix Applied:
After patching to version 2.7.2 or later, attempt to authenticate with a JWT token using 'none' algorithm; it should be rejected, and logs should show proper validation.
📡 Detection & Monitoring
Log Indicators:
- Failed authentication attempts with JWT tokens, especially those mentioning 'none' algorithm or unexpected user impersonations in Pulsar logs.
Network Indicators:
- Unusual traffic patterns to Pulsar ports (e.g., 6650, 8080) from untrusted sources, or spikes in authentication requests.
SIEM Query:
Example query for Splunk or similar: 'source="pulsar.log" ("JWT" AND "none") OR ("authentication failed" AND "token")' to detect exploitation attempts.
🔗 References
- https://lists.apache.org/thread.html/r347650d15a3e9c5f58b83e918b6ad6dedc2a63d3eb63da8e6a7be87e%40%3Cusers.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/r8e545559781231a83bf0644548c660255859e52feb86bbfcd42590da%40%3Cdev.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/r9a12b4da2f26ce9b8f7e7117a879efaa973dab7e54717bbc7923fab1%40%3Cdev.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/ra49cb62105154e4795b259c79a6b27d63bfa2ab5787ff8529b089550%40%3Cdev.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/ra49cb62105154e4795b259c79a6b27d63bfa2ab5787ff8529b089550%40%3Cusers.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/rbe845aa1573a61769b9c5916c62971f4b10de87c2ea5f38a97f0cf84%40%3Cdev.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/rca54f4b26ba5e6f2e39732b47ec51640e89f57e3b6a38ac3bab314df%40%3Cdev.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/rf2e90942996dceebac8296abf39257cfeb5ae918f82f7af3d37a48c5%40%3Cdev.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/r347650d15a3e9c5f58b83e918b6ad6dedc2a63d3eb63da8e6a7be87e%40%3Cusers.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/r8e545559781231a83bf0644548c660255859e52feb86bbfcd42590da%40%3Cdev.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/r9a12b4da2f26ce9b8f7e7117a879efaa973dab7e54717bbc7923fab1%40%3Cdev.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/ra49cb62105154e4795b259c79a6b27d63bfa2ab5787ff8529b089550%40%3Cdev.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/ra49cb62105154e4795b259c79a6b27d63bfa2ab5787ff8529b089550%40%3Cusers.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/rbe845aa1573a61769b9c5916c62971f4b10de87c2ea5f38a97f0cf84%40%3Cdev.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/rca54f4b26ba5e6f2e39732b47ec51640e89f57e3b6a38ac3bab314df%40%3Cdev.pulsar.apache.org%3E
- https://lists.apache.org/thread.html/rf2e90942996dceebac8296abf39257cfeb5ae918f82f7af3d37a48c5%40%3Cdev.pulsar.apache.org%3E