CVE-2025-6167
Path traversal in themanojdesai python-a2a <= 0.5.5, api.py create_workflow.
- CVSS 5.1
- CWE-22
- Design Defects
- Remote
A vulnerability classified as critical has been found in themanojdesai python-a2a up to 0.5.5. Affected is the function create_workflow of the file python_a2a/agent_flow/server/api.py. The manipulation leads to path traversal. Upgrading to version 0.5.6 is able to address this issue. It is recommended to upgrade the affected component.
- CWE
- CWE-22
- CVSS base score
- 5.1
- Published
- 2025-06-17
- OWASP
- A01 Broken Access Control
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Functionality
- Category
- Design Defects
- Subcategory
- Path Traversal
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Affected component
- python-a2a
- Fixed by upgrading
- Yes
Solution
Upgrade to version 0.5.6.
Vulnerable code sample
import os
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/create_workflow', methods=['POST'])
def create_workflow():
"""
Creates a workflow based on user input.
"""
data = request.get_json()
workflow_name = data.get('workflow_name')
workflow_definition = data.get('workflow_definition')
if not workflow_name or not workflow_definition:
return jsonify({'error': 'Workflow name and definition are required'}), 400
# Vulnerable code: Path traversal vulnerability
filepath = os.path.join("workflows", workflow_name + ".json") # Missing sanitization. Could be manipulated with "../"
try:
with open(filepath, 'w') as f:
f.write(workflow_definition)
return jsonify({'message': 'Workflow created successfully'}), 201
except Exception as e:
return jsonify({'error': f'Failed to create workflow: {str(e)}'}), 500
if __name__ == '__main__':
# Create workflows directory if it doesn't exist
if not os.path.exists("workflows"):
os.makedirs("workflows")
app.run(debug=True)Patched code sample
import os
def create_workflow(workflow_name, workflow_definition, base_path="/app/workflows"):
"""
Creates a workflow directory and definition file. Mitigates path traversal.
Args:
workflow_name (str): The name of the workflow.
workflow_definition (str): The workflow definition (e.g., JSON).
base_path (str): The base directory for workflows.
Returns:
str: Path to the created workflow file, or None on error.
"""
# Sanitize the workflow name to prevent path traversal
safe_workflow_name = os.path.basename(workflow_name) # Extract filename only
if safe_workflow_name != workflow_name:
print(f"Warning: Workflow name '{workflow_name}' contained potentially unsafe characters. Using '{safe_workflow_name}' instead.")
workflow_dir = os.path.join(base_path, safe_workflow_name)
# Prevent creating directory outside of base path
normalized_path = os.path.normpath(workflow_dir)
if not normalized_path.startswith(os.path.normpath(base_path)):
print("Error: Attempted path traversal. Workflow creation blocked.")
return None
try:
os.makedirs(workflow_dir, exist_ok=True) # Create directory if it doesn't exist
workflow_file_path = os.path.join(workflow_dir, "workflow.json") # Fixed filename
with open(workflow_file_path, "w") as f:
f.write(workflow_definition)
return workflow_file_path
except OSError as e:
print(f"Error creating workflow: {e}")
return NonePayload
../../../../../../../../../../etc/passwd
Cite this entry
@misc{vaitp:cve20256167,
title = {{Path traversal in themanojdesai python-a2a <= 0.5.5, api.py create_workflow.
}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2025},
note = {VAITP Python Vulnerability Dataset, entry CVE-2025-6167},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2025-6167/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
