The MentionsParser in src/praisonai-agents/praisonaiagents/tools/mentions.py processes @file: mentions in agent prompts by reading arbitrary files from the filesystem. When a file path is not found relative to the workspace, the parser falls back to using the path as an absolute path without any validation or boundary check. This allows an attacker who can influence agent prompts (via chat messages, Telegram/Discord/Slack bot inputs, or YAML workflow configs) to read any file on the filesystem accessible to the process user.
Vulnerable code (lines 165–178):
def _process_file_mention(self, file_path: str) -> Optional[str]:
"""Process @file:path mention."""
try:
# Resolve path relative to workspace
full_path = self.workspace_path / file_path
if not full_path.exists():
# Try as absolute path
full_path = Path(file_path)
if not full_path.exists():
self._log(f"File not found: {file_path}", logging.WARNING)
return f"# File: {file_path}\n[File not found]"
content = full_path.read_text(encoding="utf-8")
The vulnerability is in the fallback at line 171–172: When the file is not found relative to workspace_path, the code constructs full_path = Path(file_path), which accepts any absolute or relative path without validation. There is no:
.. path traversal checkThe file_path parameter originates from parsing @file: mentions in user/LLM prompts. The MentionsParser is used across the framework to process mentions in agent instructions and user messages.
Contrast with skill_tools.py read_skill_file (lines 140–193), which properly validates:
# skill_tools.py line 179 — proper validation
if os.path.commonpath([full_path, skill_path]) != skill_path:
return f"Error: Path traversal detected - {file_path} is outside skill directory"
Setup: Clean checkout at commit d5f1114a.
Positive trigger — arbitrary file read via @file: mention:
import sys
sys.path.insert(0, 'src/praisonai-agents')
from praisonaiagents.tools.mentions import MentionsParser
parser = MentionsParser()
# Test 1: Absolute path read (bypasses workspace resolution)
result = parser._process_file_mention('/etc/hostname')
print(f'Absolute path read: {result[:80]}...')
# Test 2: Relative path with traversal
result = parser._process_file_mention('../../../etc/hostname')
print(f'Traversal read: {result[:80]}...')
Expected output:
Absolute path read: # File: /etc/hostname
```linux
<hostname>
```...
Traversal read: # File: ../../../etc/hostname
```linux
<hostname>
```...
Negative control — non-existent file:
result = parser._process_file_mention('/nonexistent/secret.txt')
# Returns: "# File: /nonexistent/secret.txt\n[File not found]"
Cleanup: No persistence or side effects — read-only operation.
An attacker who can inject @file: mentions into agent prompts (via chat messages in Telegram/Discord/Slack bots, user input in web UI, or YAML workflow configurations) can read any file accessible to the process user, including:
.env files, ~/.aws/credentials, ~/.ssh/id_rsa, API keys/etc/passwd, /etc/shadow (if process has read access)This is particularly dangerous in bot deployments where auto_approve_tools defaults to True and untrusted users can send messages containing @file: mentions.
workspace_path:def _process_file_mention(self, file_path: str) -> Optional[str]:
full_path = (self.workspace_path / file_path).resolve()
# Ensure resolved path is within workspace
if not str(full_path).startswith(str(self.workspace_path.resolve())):
return f"# File: {file_path}\n[Access denied: path outside workspace]"
if not full_path.exists():
return f"# File: {file_path}\n[File not found]"
content = full_path.read_text(encoding="utf-8")
Add symlink resolution via .resolve() to prevent symlink-based traversal.
Add a protected path guard (.env, .git, .ssh, keys, credentials).
Apply the same os.path.commonpath pattern used by skill_tools.py.
| Software | From | Fixed in |
|---|---|---|
praisonaiagents
|
- | 1.6.59 |
A security vulnerability is a weakness in software, hardware, or configuration that can be exploited to compromise confidentiality, integrity, or availability. Many vulnerabilities are tracked as CVEs (Common Vulnerabilities and Exposures), which provide a standardized identifier so teams can coordinate patching, mitigation, and risk assessment across tools and vendors.
CVSS (Common Vulnerability Scoring System) estimates technical severity, but it doesn't automatically equal business risk. Prioritize using context like internet exposure, affected asset criticality, known exploitation (proof-of-concept or in-the-wild), and whether compensating controls exist. A "Medium" CVSS on an exposed, production system can be more urgent than a "Critical" on an isolated, non-production host.
A vulnerability is the underlying weakness. An exploit is the method or code used to take advantage of it. A zero-day is a vulnerability that is unknown to the vendor or has no publicly available fix when attackers begin using it. In practice, risk increases sharply when exploitation becomes reliable or widespread.
Recurring findings usually come from incomplete Asset Discovery, inconsistent patch management, inherited images, and configuration drift. In modern environments, you also need to watch the software supply chain: dependencies, containers, build pipelines, and third-party services can reintroduce the same weakness even after you patch a single host. Unknown or unmanaged assets (often called Shadow IT) are a common reason the same issues resurface.
Use a simple, repeatable triage model: focus first on externally exposed assets, high-value systems (identity, VPN, email, production), vulnerabilities with known exploits, and issues that enable remote code execution or privilege escalation. Then enforce patch SLAs and track progress using consistent metrics so remediation is steady, not reactive.
SynScan combines attack surface monitoring and continuous security auditing to keep your inventory current, flag high-impact vulnerabilities early, and help you turn raw findings into a practical remediation plan.