CVE-2024-8551
Executive Summary
CVE-2024-8551 is a critical path traversal vulnerability (CWE-22) in the save-workflow and load-workflow functionalities of the modelscope/agentscope project. With a CVSS score of 9.1, this flaw allows an unauthenticated attacker to read and write arbitrary JSON files on the filesystem. This can lead to the exposure or modification of sensitive information such as configuration files, API keys, and hardcoded passwords. The vulnerability exists in versions prior to a fix, but the exact patched version is currently unknown. No public proof-of-concept (PoC) or exploit code has been released, and the EPSS score is 0.0%, indicating low exploitation activity in the wild. However, the high severity and potential for data breach demand immediate attention.
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
This vulnerability affects the agentscope package, which is distributed via PyPI. Organizations using this package should verify their version and apply any available patches. The lack of a known patched version increases supply chain risk, as users may unknowingly run vulnerable code. It is crucial to monitor the official repository for updates and consider temporary mitigations.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Base Score: 9.1 (Critical)
- Attack Vector: Network (AV:N) – The vulnerability can be exploited remotely.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: None (UI:N) – No user action is required.
- Scope: Unchanged (S:U) – The vulnerable component and the impacted component are the same.
- Confidentiality Impact: High (C:H) – Sensitive data can be read.
- Integrity Impact: High (I:H) – Arbitrary JSON files can be written.
- Availability Impact: High (A:H) – Potential for denial of service or system compromise.
Threat Level: Critical. The combination of remote exploitability, no authentication, and high impact on confidentiality, integrity, and availability makes this a top-priority vulnerability.
Deep Dive & Mechanics
The vulnerability resides in the save-workflow and load-workflow endpoints of the agentscope application. These endpoints are designed to serialize and deserialize workflow configurations to and from JSON files. The flaw is a classic path traversal (directory traversal) vulnerability, where user-supplied input (likely a filename or path parameter) is not properly sanitized.
Attack Vector:
An attacker can craft a request with a path containing ../ sequences to escape the intended workflow directory. For example:
save-workflowwith a filename like../../etc/config.jsoncould write arbitrary JSON data to that location.load-workflowwith a filename like../../etc/passwdcould read arbitrary files (though the endpoint expects JSON, it may still leak file contents).
Impact:
- Read Arbitrary JSON Files: An attacker can read configuration files, API keys, database credentials, and other sensitive data stored in JSON format.
- Write Arbitrary JSON Files: An attacker can overwrite configuration files, inject malicious settings, or plant backdoors. For example, overwriting a configuration file that contains API keys could lead to service compromise.
Root Cause:
The application likely uses a function like os.path.join with user input without validating that the resulting path is within an allowed directory. This is a common mistake in Python applications.
Vulnerable vs. Patched Code
Since the exact patched version is unknown, we can only describe the vulnerable pattern and the expected fix.
Vulnerable Code Pattern (Python):
import os
import json
WORKFLOW_DIR = "/app/workflows"
def save_workflow(filename, data):
filepath = os.path.join(WORKFLOW_DIR, filename)
with open(filepath, 'w') as f:
json.dump(data, f)
def load_workflow(filename):
filepath = os.path.join(WORKFLOW_DIR, filename)
with open(filepath, 'r') as f:
return json.load(f)
Patched Code Pattern:
import os
import json
WORKFLOW_DIR = os.path.abspath("/app/workflows")
def safe_path(base, user_path):
# Resolve the full path and ensure it starts with the base directory
full_path = os.path.abspath(os.path.join(base, user_path))
if not full_path.startswith(base):
raise ValueError("Invalid path")
return full_path
def save_workflow(filename, data):
filepath = safe_path(WORKFLOW_DIR, filename)
with open(filepath, 'w') as f:
json.dump(data, f)
def load_workflow(filename):
filepath = safe_path(WORKFLOW_DIR, filename)
with open(filepath, 'r') as f:
return json.load(f)
The fix uses os.path.abspath to resolve the full path and then checks that it starts with the allowed base directory. This prevents directory traversal.
Exploitation & Lab Setup
Red Team (Offensive)
Lab Setup:
Deploy a vulnerable instance of
agentscope(version prior to the fix). Use Docker for isolation:docker run -d -p 8080:8080 --name agentscope_vuln modelscope/agentscope:latest(Note: This assumes a vulnerable image exists; otherwise, build from source with an older commit.)
Identify the endpoints. Typically, they might be:
POST /api/workflow/saveGET /api/workflow/load
Exploitation Steps:
Read Arbitrary JSON File:
curl -X GET "http://target:8080/api/workflow/load?filename=../../etc/config.json"If the file is not JSON, the server may return an error, but the content might still be leaked in the error message.
Write Arbitrary JSON File:
curl -X POST "http://target:8080/api/workflow/save" \ -H "Content-Type: application/json" \ -d '{"filename": "../../tmp/backdoor.json", "data": {"malicious": true}}'Overwrite Configuration: If the application uses a JSON config file (e.g.,
config.json), an attacker could overwrite it to change API keys or other settings.
Blue Team (Defensive)
Detection:
- Monitor for requests containing
../or..%2fin parameters. - Alert on attempts to access files outside the expected workflow directory.
- Use Web Application Firewall (WAF) rules to block path traversal patterns.
Hunting:
- Search logs for
filenameparameters containing../. - Check for unexpected file writes in sensitive directories (e.g.,
/etc,/var/www).
Mitigation:
- Apply the patch as soon as it becomes available.
- If patching is not possible, implement input validation to reject paths containing
../or..\. - Restrict the application's filesystem permissions to only allow writes to the workflow directory.
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP requests with
filenameparameter containing../or..%2f. - Unusual POST requests to
/api/workflow/savewith large JSON payloads. - GET requests to
/api/workflow/loadwith suspicious paths.
- HTTP requests with
File System IOCs:
- Unexpected JSON files in
/tmp,/etc, or other sensitive directories. - Modified configuration files (e.g.,
config.json) with altered API keys or settings.
- Unexpected JSON files in
Log IOCs:
- Error messages indicating file not found or permission denied for paths outside the workflow directory.
- Repeated attempts to access
../../etc/passwdor similar files.
Detection Engineering
YARA Rule
rule CVE_2024_8551_Path_Traversal {
meta:
description = "Detects path traversal attempts targeting CVE-2024-8551 in agentscope"
author = "Valters IT"
date = "2025-03-30"
reference = "CVE-2024-8551"
strings:
$traversal1 = "../" ascii wide
$traversal2 = "..\\" ascii wide
$traversal3 = "%2e%2e%2f" ascii wide
$traversal4 = "%2e%2e%5c" ascii wide
$endpoint1 = "/api/workflow/save" ascii wide
$endpoint2 = "/api/workflow/load" ascii wide
condition:
any of ($endpoint*) and any of ($traversal*)
}
Sigma Rule
title: CVE-2024-8551 Path Traversal in agentscope
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects path traversal attempts in agentscope save-workflow and load-workflow endpoints
author: Valters IT
date: 2025-03-30
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-8551
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-uri-query|contains:
- '../'
- '..\\'
- '%2e%2e%2f'
- '%2e%2e%5c'
cs-uri-stem|contains:
- '/api/workflow/save'
- '/api/workflow/load'
condition: selection
falsepositives:
- Legitimate use of relative paths in non-vulnerable applications
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-8551 Path Traversal in agentscope"; flow:to_server; content:"/api/workflow/save" or content:"/api/workflow/load"; content:"../" or content:"..\\" or content:"%2e%2e%2f" or content:"%2e%2e%5c"; classtype:attempted-recon; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Isolate Vulnerable Systems: If possible, disconnect the affected service from the network until a patch is applied.
- Implement Input Validation: Add server-side validation to reject any filename containing
../or..\. Use a whitelist of allowed characters (e.g., alphanumeric and underscores). - Restrict Filesystem Permissions: Ensure the application runs with the least privileges necessary. The workflow directory should be the only writable location.
- Monitor Logs: Actively monitor for path traversal attempts using the detection rules above.
Long-Term Fix:
- Apply the official patch from the
modelscope/agentscoperepository once released. - If no patch is available, consider forking the repository and implementing the fix described in the "Vulnerable vs. Patched Code" section.
- Conduct a security audit of the entire codebase for similar vulnerabilities.
Workaround:
- Use a reverse proxy (e.g., Nginx) to block requests containing
../in the query string:if ($args ~* "\.\.") { return 403; }
Valters IT
Securing Digital Frontiers