GHSA-r55h-3rwj-hcmg WeKnora has Remote Code Execution (RCE) via Command Injection in MCP Stdio Configuration Validation
SummaryA critical unauthenticated remote code execution (RCE) vulnerability exists in the MCP stdio configuration validation introduced in version 2.0.5.The application allows unrestricted user registration, meaning any attacker can create an account and exploit the command injection flaw. Despite implementing a whitelist for allowed commands (`npx`, `uvx`) and blacklists for dangerous arguments and environment variables, the validation can be bypassed using the `-p` flag with `npx node`. This allows any attacker to execute arbitrary commands with the application's privileges, leading to complete system compromise.The vulnerability remained unfixed across multiple releases (2.0.6-2.0.9) before being silently patched in version 2.0.10, without a published CVE, potentially leaving customers unaware.DetailsThe application's open registration policy, combined with the vulnerable MCP stdio configuration, creates an unrestricted attack surface. Any attacker can:Register a new account without restrictions (no email verification, approval process, or rate limiting mentioned)Obtain API authentication credentialsExploit the command injection vulnerability to execute arbitrary codeThe security patch introduced in commit f7900a5e9a18c99d25cec9589ead9e4e59ce04bb attempts to prevent command injection through:**Command Whitelist**: Only `uvx` and `npx` are allowed**Argument Blacklist**: Blocks dangerous patterns including shells, command chaining, and path traversal**Environment Variable Blacklist**: Restricts sensitive variables like `LD_PRELOAD`, `PATH`, etc.However, the patch has a critical flaw: the `-p` flag in `npx node` is not explicitly blocked in the `DangerousArgPatterns` regex list. The `-p` flag allows Node.js to evaluate and execute arbitrary JavaScript code, effectively bypassing the argument validation.The vulnerable code flow:`ValidateStdioConfig()` calls `ValidateStdioArgs(args)``ValidateStdioArgs()` checks each argument against `DangerousArgPatterns`The pattern list does not include `-p` or similar execution flagsArguments like `["node", "-p", "require('fs').writeFileSync(...)"]` pass validationWhen executed, `npx node -p <payload>` executes the JavaScript payload**Timeline of Concern:****Version 2.0.5**: Initial patch introducing validation (incomplete/bypassable)**Versions 2.0.6-2.0.9**: Vulnerability persists with no public notification**Version 2.0.10** (commit 57d6fea8bc265ad28b385e0158957c870cff4b50): Stdio-based MCP server is disabled entirely.**Issue**: The hot fix was deployed silently without a CVE publication or security advisory, meaning customers using versions 2.0.5-2.0.9 remained unaware of the critical vulnerabilityThis silent fix pattern poses significant risks:Customers may not know to update immediatelySecurity scanning tools may not flag the vulnerability without a published CVEOrganisations relying on vendor advisories have no record of the issueThere is no documented attack history or mitigation guidance for affected versionsPoC**Step 1: Register a new account (unauthenticated)****Step 2: Create a malicious MCP service**Response will contain the service ID (e.g., 087854f4-bde3-4468-8702-4aeb95c868da)**Step 3: Trigger the RCE by testing the service****Step 4: Verify exploitation**On the server, the file `/tmp/pwned.txt` will be created with content "Hacked by attacker", confirming arbitrary command execution.Impact**Severity**: CriticalUnauthenticated RCE allowing complete server compromise. An attacker can register an account and execute arbitrary commands with full application privileges.Full data breach and system compromiseInstall malware, backdoors, ransomwareLateral movement to internal systemsVersions 2.0.5-2.0.9 vulnerable without notification**Immediate Actions**:Upgrade to 2.0.10+ immediatelyReview logs for exploitation since 2.0.5Check for suspicious MCP configurationsMonitor for unauthorized file creationAssume breach if compromise suspected
CVSS v3.1 score: 10