Flowise, SQL Injection, CVE-2023-XXXX (Critical)

How the CVE Works:

The vulnerability exists in Flowise’s `importChatflows` API endpoint which insufficiently validates user-supplied input in chatflow IDs. Attackers can exploit this in two ways:
1. Path Traversal: By crafting malicious JSON with `../../` sequences in the `id` field, attackers can potentially access sensitive files like /apikey.
2. SQL Injection: The API constructs SQL queries by directly concatenating user input without proper sanitization. The vulnerable query pattern is:

SELECT cf.id FROM cf WHERE cf.id IN ('{USER-INPUT}')

When attackers supply crafted input like ') AND 1=CONVERT(int,(SELECT table_name FROM information_schema.tables))--, the backend executes arbitrary SQL commands. The provided PoC demonstrates blind SQL injection through error-based techniques, extracting sensitive data like encrypted credentials from the database.

DailyCVE Form:

Platform: Flowise
Version: <1.3.8
Vulnerability: SQL Injection
Severity: Critical
Date: 2023-XX-XX

What Undercode Say:

Exploit Detection:
curl -X POST "http://target/api/v1/chatflows/importchatflows" -H "Authorization: Bearer TOKEN" -d '{"Chatflows":[{"id":"\' OR 1=1--","name":"test","flowData":"{}"}]}'
Protection Commands:
Update Flowise
npm update flowise
WAF Rule Example:
SecRule REQUEST_URI "@contains /importchatflows" \
"id:1001,\
phase:2,\
block,\
t:urlDecode,\
msg:'SQLi Attempt'"
Database Hardening:
ALTER USER flowise WITH CONNECTION LIMIT 10;
REVOKE EXECUTE ON FUNCTION pg_sleep FROM flowise;
Input Validation Patch:
function validateChatflowId(id) {
return /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[bash][0-9a-f]{3}-[0-9a-f]{12}$/i.test(id);
}
SQL Parameterization Example:
const query = 'SELECT FROM chatflows WHERE id = $1';
pool.query(query, [bash]);
Monitoring Command:
grep -E 'importchatflows.(..\/|\')' /var/log/flowise.log
Emergency Mitigation:
iptables -A INPUT -p tcp --dport 3000 -m string --string "importchatflows" --algo bm -j DROP

References:

Reported By: https://github.com/advisories/GHSA-9c4c-g95m-c8cp
Extra Source Hub:
Undercode

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image

Scroll to Top