VYPR
High severity7.7NVD Advisory· Published May 14, 2026· Updated May 14, 2026

FlowiseAI: CustomTemplate create+update mass-assignment allows cross-workspace template takeover

CVE-2026-46476

Description

Summary

Type: Mass assignment via Object.assign(entity, body) -> client-controlled workspaceId (and on create, id) overwritten on the CustomTemplate entity -> cross-workspace data takeover and IDOR. File: packages/server/src/services/marketplaces/index.ts Root cause: The CustomTemplate controller/service constructs a new CustomTemplate() 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 customtemplate entity's sibling controllers and as DocumentStore before it was patched in commit 840d2ae.

Affected

Code

File: packages/server/src/services/marketplaces/index.ts

// at line 211
Object.assign(newTemplate, body)        // <-- BUG: body.id, body.workspaceId 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

  1. 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.
  2. Attacker creates a customtemplate in workspace A via the documented API (or reuses an existing one they own). They note its entity id.
  3. Attacker issues a PUT /api/v1/customtemplates/<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.
  4. The controller calls Object.assign(updateEntity, body). The body's workspaceId overwrites the entity's workspaceId field. The persistence layer commits the row.
  5. Final state: the customtemplate 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 customtemplate 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). CustomTemplates encode reusable workflow templates scoped to a workspace. Cross-workspace movement via workspaceId overwrite makes the template appear in another workspace's marketplace listing. Preconditions: Authenticated session with edit permission for the source customtemplate. 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/6129 (allowlist pattern applied).

// Allowlist pattern (matches commit 840d2ae for DocumentStore):
const updatedCustomTemplate = new CustomTemplate()
if (body.<allowed_field_1> !== undefined) updatedCustomTemplate.<allowed_field_1> = body.<allowed_field_1>
if (body.<allowed_field_2> !== undefined) updatedCustomTemplate.<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.

Patches

1
f64047bdcf4c

Fix Mass Assignment on Save Custom Template (#6129)

https://github.com/FlowiseAI/Flowisechristopherholland-workdayApr 6, 2026via ghsa
2 files changed · +8 6
  • packages/server/src/controllers/marketplaces/index.ts+5 5 modified
    @@ -2,6 +2,7 @@ import { NextFunction, Request, Response } from 'express'
     import { StatusCodes } from 'http-status-codes'
     import { InternalFlowiseError } from '../../errors/internalFlowiseError'
     import marketplacesService from '../../services/marketplaces'
    +import { stripProtectedFields } from '../../utils/stripProtectedFields'
     
     // Get all templates for marketplaces
     const getAllTemplates = async (req: Request, res: Response, next: NextFunction) => {
    @@ -52,15 +53,14 @@ const saveCustomTemplate = async (req: Request, res: Response, next: NextFunctio
                     `Error: marketplacesService.saveCustomTemplate - body not provided!`
                 )
             }
    -        const body = req.body
    -        body.workspaceId = req.user?.activeWorkspaceId
    -        if (!body.workspaceId) {
    +        const workspaceId = req.user?.activeWorkspaceId
    +        if (!workspaceId) {
                 throw new InternalFlowiseError(
                     StatusCodes.NOT_FOUND,
    -                `Error: marketplacesController.saveCustomTemplate - workspace ${body.workspaceId} not found!`
    +                `Error: marketplacesController.saveCustomTemplate - workspace ${workspaceId} not found!`
                 )
             }
    -        const apiResponse = await marketplacesService.saveCustomTemplate(body)
    +        const apiResponse = await marketplacesService.saveCustomTemplate({ ...stripProtectedFields(req.body), workspaceId })
             return res.json(apiResponse)
         } catch (error) {
             next(error)
    
  • packages/server/src/services/marketplaces/index.ts+3 1 modified
    @@ -10,6 +10,7 @@ import { InternalFlowiseError } from '../../errors/internalFlowiseError'
     import { getErrorMessage } from '../../errors/utils'
     import { IReactFlowEdge, IReactFlowNode } from '../../Interface'
     import { getRunningExpressApp } from '../../utils/getRunningExpressApp'
    +import { stripProtectedFields } from '../../utils/stripProtectedFields'
     import chatflowsService from '../chatflows'
     
     type ITemplate = {
    @@ -208,7 +209,8 @@ const saveCustomTemplate = async (body: any): Promise<any> => {
             let flowDataStr = ''
             let derivedFramework = ''
             const customTemplate = new CustomTemplate()
    -        Object.assign(customTemplate, body)
    +        Object.assign(customTemplate, stripProtectedFields(body))
    +        customTemplate.workspaceId = body.workspaceId // re-apply: set by controller from req.user
     
             if (body.chatflowId) {
                 const chatflow = await chatflowsService.getChatflowById(body.chatflowId, body.workspaceId)
    

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

5

News mentions

0

No linked articles in our index yet.