other
- Location
index.js:11- Finding
Unrestricted Filesystem Path Allows Analysis of Arbitrary Readable JSONL Files
- Content
View full analysis
Vulnerability Details
File Location:
index.js, lines 11–25
Vulnerability Type: Unrestricted sensitive file access
Risk Level: MediumVulnerable Code
javascript const defaultPath = path.resolve(__dirname, '../../memory/evolution/memory_graph.jsonl'); const targetPath = graphPath || defaultPath; if (!fs.existsSync(targetPath)) { return { error: `Graph file not found: ${targetPath}` }; } const events = []; const genes = {}; const failurePatterns = {}; let lastEvent = null; let streak = 0; let stagnation = false; const fileStream = fs.createReadStream(targetPath);Technical Analysis
analyzeStateaccepts an unrestricted caller-provided filesystem path. The path is passed directly tofs.existsSyncandfs.createReadStreamwithout canonicalization, containment validation, an allowlist, or authorization checks.Although input must contain valid JSONL records matching the expected event schema to produce meaningful results, the function can attempt to open any file readable by the Node.js process. Compatible files can have their gene identifiers, failure reasons, event counts, and success statistics exposed through the generated report.
The default path also accesses the Agent's persistent evolution memory. That access is consistent with the documented purpose of the skill, but it remains security-sensitive and should be explicitly constrained. This issue does not grant additional operating-system privileges; its reach is limited to the existing filesystem permissions of the hosting process.
Attack Path
- An attacker obtains the ability to invoke
analyzeStateor influence itsgraphPathargument. - The attacker supplies an absolute path, traversal path, or symlink path to a readable JSONL file outside the intended evolution-memory directory.
- The function opens and parses that file without checking whether its resolved path is inside an approved directory. 4 ...[truncated 714 chars]
- An attacker obtains the ability to invoke
- Remediation
View remediation
Remediation Suggestions
- Define an explicit, trusted base directory for evolution-memory files.
- Resolve the requested path with
path.resolveand verify that it remains inside the trusted base directory usingpath.relative. - Reject absolute paths, traversal outside the approved directory, unexpected extensions, and unsupported file types.
- Resolve and validate real paths to prevent symbolic-link escapes.
- Require explicit authorization before allowing callers to select a non-default graph.
- Run the process with a dedicated, least-privileged account that cannot read unrelated application files, credentials, or system data.
- Avoid including sensitive absolute paths in externally visible error messages.
- Log rejected path-access attempts without recording sensitive file contents.
