FlowiseAI: Evaluator create+update mass-assignment allows cross-workspace evaluator takeover
Description
Summary
Type: Mass assignment via Object.assign(entity, body) -> client-controlled workspaceId (and on create, id) overwritten on the Evaluator entity -> cross-workspace data takeover and IDOR. File: packages/server/src/Interface.Evaluation.ts Root cause: The Evaluator controller/service constructs a new Evaluator() and copies the request body into it via Object.assign(...) without an explicit field allowlist. The request body therefore can include workspaceId, id, createdDate, updatedDate. The server only rebinds *some* of these after the assign (e.g. on create, it overwrites workspaceId but not id; on update, it overwrites id but not workspaceId). The remaining client-controlled values land directly on the persisted row, breaking workspace isolation. Same root pattern as the evaluator entity's sibling controllers and as DocumentStore before it was patched in commit 840d2ae.
Affected
Code
File: packages/server/src/Interface.Evaluation.ts
// at line 85
Object.assign(newEvaluator, body) // <-- BUG: body.id, body.workspaceId, body.createdDate, body.updatedDate accepted
Why it's wrong: Object.assign(target, source) copies every own enumerable property of source onto target. The TypeORM/SQL persistence layer below it does not strip ownership-bearing columns, so workspaceId set in the request body lands as the new workspaceId of the persisted row. The DocumentStore patch (commit 840d2ae) demonstrated the intended fix shape (explicit field-by-field allowlist) but it has not been applied to this entity.
Exploit
Chain
- Attacker is an authenticated member of workspace A. They have a session cookie / JWT for the Flowise web UI. State at this point: attacker can read and write entities scoped to workspace A.
- Attacker creates a evaluator in workspace A via the documented API (or reuses an existing one they own). They note its entity
id. - Attacker issues a
PUT /api/v1/evaluators/<id>(or equivalent endpoint) with a JSON body that includes"workspaceId": "<workspace-B-id>"(an arbitrary other workspace's UUID). State at this point: the request reaches the controller as a workspace-A authenticated request. - The controller calls
Object.assign(updateEntity, body). The body'sworkspaceIdoverwrites the entity'sworkspaceIdfield. The persistence layer commits the row. - Final state: the evaluator row is now owned by workspace B. Workspace B members can see it, modify it, and use it. Workspace A loses access (it no longer satisfies their workspace filter). The original creator's workspace audit shows nothing because the operation looked like a normal update.
Security
Impact
Severity: High. Cross-workspace boundary violation by any authenticated workspace member. Attacker capability: Any authenticated user with permission to update a evaluator can move it to any workspace whose UUID they can guess or enumerate (workspace UUIDs are exposed in many API responses, so enumeration is trivial). Evaluators score model outputs and can be moved into another workspace via workspaceId overwrite, making the evaluator (and its scoring rubric) appear there. Preconditions: Authenticated session with edit permission for the source evaluator. No second factor required. Workspace UUIDs are exposed via the /api/v1/workspaces listing or via any cross-referenced object's workspaceId field, so target enumeration is trivial. Differential: PoC-verified by source inspection of the original GHSA-q4pr-4r26-c69r. Patched build (with the suggested fix below) refuses the workspaceId field; vulnerable build accepts it and persists it.
Suggested
Fix
Already fixed in PR https://github.com/FlowiseAI/Flowise/pull/6050 (allowlist pattern applied).
// Allowlist pattern (matches commit 840d2ae for DocumentStore):
const updatedEvaluator = new Evaluator()
if (body.<allowed_field_1> !== undefined) updatedEvaluator.<allowed_field_1> = body.<allowed_field_1>
if (body.<allowed_field_2> !== undefined) updatedEvaluator.<allowed_field_2> = body.<allowed_field_2>
// ...whitelist only the documented fields. Never copy id, workspaceId, createdDate, updatedDate from the client.
Regression tests should assert that a request body containing workspaceId, id, createdDate, or updatedDate is rejected (or at minimum: does not change those columns on the persisted row) for both create and update paths.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
flowisenpm | < 3.1.2 | 3.1.2 |
Patches
1dc07f4062b85Fix IDOR in Evaluators and Evaluations Endpoints (#6050)
4 files changed · +21 −16
packages/server/src/Interface.Evaluation.ts+2 −1 modified@@ -1,5 +1,6 @@ // Evaluation Related Interfaces import { Evaluator } from './database/entities/Evaluator' +import { stripProtectedFields } from './utils/stripProtectedFields' export interface IDataset { id: string @@ -82,7 +83,7 @@ export class EvaluatorDTO { static toEntity(body: any): Evaluator { const newDs = new Evaluator() - Object.assign(newDs, body) + Object.assign(newDs, stripProtectedFields(body)) let config: any = {} if (body.type === 'llm') { config = {
packages/server/src/services/evaluations/index.ts+16 −14 modified@@ -1,25 +1,26 @@ -import { StatusCodes } from 'http-status-codes' import { EvaluationRunner, ICommonObject } from 'flowise-components' -import { getRunningExpressApp } from '../../utils/getRunningExpressApp' -import { InternalFlowiseError } from '../../errors/internalFlowiseError' -import { getErrorMessage } from '../../errors/utils' +import { StatusCodes } from 'http-status-codes' +import { In } from 'typeorm' +import { v4 as uuidv4 } from 'uuid' +import { ApiKey } from '../../database/entities/ApiKey' +import { Assistant } from '../../database/entities/Assistant' +import { ChatFlow } from '../../database/entities/ChatFlow' +import { Credential } from '../../database/entities/Credential' import { Dataset } from '../../database/entities/Dataset' import { DatasetRow } from '../../database/entities/DatasetRow' import { Evaluation } from '../../database/entities/Evaluation' -import { EvaluationStatus, IEvaluationResult } from '../../Interface' import { EvaluationRun } from '../../database/entities/EvaluationRun' -import { Credential } from '../../database/entities/Credential' -import { ApiKey } from '../../database/entities/ApiKey' -import { ChatFlow } from '../../database/entities/ChatFlow' -import { getAppVersion } from '../../utils' -import { In } from 'typeorm' import { getWorkspaceSearchOptions } from '../../enterprise/utils/ControllerServiceUtils' -import { v4 as uuidv4 } from 'uuid' +import { InternalFlowiseError } from '../../errors/internalFlowiseError' +import { getErrorMessage } from '../../errors/utils' +import { EvaluationStatus, IEvaluationResult } from '../../Interface' +import { getAppVersion } from '../../utils' +import { getRunningExpressApp } from '../../utils/getRunningExpressApp' +import { stripProtectedFields } from '../../utils/stripProtectedFields' +import evaluatorsService from '../evaluator' import { calculateCost, formatCost } from './CostCalculator' import { runAdditionalEvaluators } from './EvaluatorRunner' -import evaluatorsService from '../evaluator' import { LLMEvaluationRunner } from './LLMEvaluationRunner' -import { Assistant } from '../../database/entities/Assistant' const runAgain = async (id: string, baseURL: string, orgId: string, workspaceId: string) => { try { @@ -66,7 +67,8 @@ const createEvaluation = async (body: ICommonObject, baseURL: string, orgId: str try { const appServer = getRunningExpressApp() const newEval = new Evaluation() - Object.assign(newEval, body) + Object.assign(newEval, stripProtectedFields(body)) + newEval.workspaceId = workspaceId newEval.status = EvaluationStatus.PENDING const row = appServer.AppDataSource.getRepository(Evaluation).create(newEval)
packages/server/src/services/evaluator/index.ts+2 −0 modified@@ -53,6 +53,7 @@ const createEvaluator = async (body: any) => { try { const appServer = getRunningExpressApp() const newDs = EvaluatorDTO.toEntity(body) + newDs.workspaceId = body.workspaceId const evaluator = appServer.AppDataSource.getRepository(Evaluator).create(newDs) const result = await appServer.AppDataSource.getRepository(Evaluator).save(evaluator) @@ -78,6 +79,7 @@ const updateEvaluator = async (id: string, body: any, workspaceId: string) => { const updateEvaluator = EvaluatorDTO.toEntity(body) updateEvaluator.id = id + updateEvaluator.workspaceId = workspaceId appServer.AppDataSource.getRepository(Evaluator).merge(evaluator, updateEvaluator) const result = await appServer.AppDataSource.getRepository(Evaluator).save(evaluator) return EvaluatorDTO.fromEntity(result)
packages/server/src/utils/stripProtectedFields.ts+1 −1 modified@@ -2,7 +2,7 @@ * Fields that are managed exclusively by the server and must never be * overwritten by user-supplied request bodies. */ -export const PROTECTED_FIELDS = ['id', 'createdDate', 'updatedDate', 'workspaceId', 'organizationId'] as const +export const PROTECTED_FIELDS = ['id', 'createdDate', 'updatedDate', 'runDate', 'workspaceId', 'organizationId'] as const export type ProtectedField = (typeof PROTECTED_FIELDS)[number]
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
5- github.com/advisories/GHSA-wxrr-jp8m-qq7fghsaADVISORY
- github.com/FlowiseAI/Flowise/commit/dc07f4062b852033554543a3cff3daf3433b0dacghsaWEB
- github.com/FlowiseAI/Flowise/pull/6050ghsaWEB
- github.com/FlowiseAI/Flowise/releases/tag/flowise%403.1.2ghsaWEB
- github.com/FlowiseAI/Flowise/security/advisories/GHSA-wxrr-jp8m-qq7fghsaWEB
News mentions
0No linked articles in our index yet.