Skip to content

Add 3 critical security vulnerabilities for training purposes - #11

Open
sust4in wants to merge 1 commit into
developfrom
feature/add-critical-vulnerabilities
Open

Add 3 critical security vulnerabilities for training purposes#11
sust4in wants to merge 1 commit into
developfrom
feature/add-critical-vulnerabilities

Conversation

@sust4in

@sust4in sust4in commented May 29, 2026

Copy link
Copy Markdown
Owner
  • RCE via OS command injection in /accounts/:username/export
  • NoSQL injection with password exposure in /accounts/search
  • Path traversal via unsanitized filename in /files/:filename

- RCE via OS command injection in /accounts/:username/export
- NoSQL injection with password exposure in /accounts/search
- Path traversal via unsanitized filename in /files/:filename

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@zeropath-ai

zeropath-ai Bot commented May 29, 2026

Copy link
Copy Markdown

2 possible security or compliance issues detected. Reviewed everything up to 1e0e44d.

The following issues were found:

Security Overview
Detected Code Changes
Change Type Relevant files
Bug Fix ► app.js
    Implement file reading functionality
► accounts.js
    Implement account export functionality
    Implement account search functionality

Comment on lines +34 to +38
exec(`echo Exporting notes for ${req.params.username} in ${format} format`, (error, stdout, stderr) => {
if (error) {
return res.status(500).json({ error: stderr });
}
res.status(200).json({ output: stdout });

@zeropath-ai zeropath-ai Bot May 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OS Command Injection in Account Export Endpoint (Severity: HIGH)

Remote Code Execution is possible because user-supplied input from the 'format' query parameter and 'username' path parameter is passed directly to the exec function without sanitization. This allows an attacker to inject arbitrary OS commands, leading to potential compromise of the server.
View details in ZeroPath

Suggested fix

Unable to apply as inline suggestion. Download .diff and apply from repo root with git apply ed00d5d9.diff

diff --git a/packages/services/api/src/routes/accounts.js b/packages/services/api/src/routes/accounts.js
--- a/packages/services/api/src/routes/accounts.js
+++ b/packages/services/api/src/routes/accounts.js
@@ -31,7 +31,7 @@
 // User-supplied input is passed directly to exec() without sanitization
 router.get('/accounts/:username/export', auth, async (req, res, next) => {
     const format = req.query.format || 'json';
-    exec(`echo Exporting notes for ${req.params.username} in ${format} format`, (error, stdout, stderr) => {
+    exec('echo Exporting notes for ' + JSON.stringify(req.params.username) + ' in ' + JSON.stringify(format) + ' format', (error, stdout, stderr) => {
         if (error) {
             return res.status(500).json({ error: stderr });
         }

Comment on lines +93 to +97
{ email: query },
{ password: 1, email: 1, name: 1 }
).exec();

res.status(200).json(accounts);

@zeropath-ai zeropath-ai Bot May 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sensitive Credential Exposure in Account Search Results (Severity: HIGH)

Passwords are exposed in API responses, which can lead to unauthorized account access if intercepted. The Account.find function in accounts.js inadvertently includes the 'password' field in search results, causing sensitive credential exposure.
View details in ZeroPath

Suggested change
{ email: query },
{ password: 1, email: 1, name: 1 }
).exec();
res.status(200).json(accounts);
{ email: query },
{ password: 0, email: 1, name: 1 }
).exec();
res.status(200).json(accounts);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant