TypeBot: Unauthenticated arbitrary s3 object write in generate-upload-url via unsanitized fileName
Description
TypeBot is a chatbot builder tool. In versions 3.16.1 and earlier, POST /api/blocks/file-input/v3/generate-upload-url is unauthenticated and uses unsanitized fileName input to construct public/ S3 object keys, while issuing presigned PUT URLs that do not bind Content-Type. As a result, any anonymous visitor to a published bot with a file input can upload attacker-controlled HTML, SVG, or JS to attacker-chosen subpaths, including other tenants’ publicly served result paths, enabling arbitrary content hosting and potential stored XSS on the storage origin. ../ traversal is blocked by S3/MinIO canonicalization (signature mismatch), but forward-slash path injection is exploitable. This issue has been fixed in version 3.17.0.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
1Patches
Vulnerability mechanics
Root cause
"The server concatenates unsanitized client-supplied fileName into the S3 object key and issues a presigned PUT URL that does not bind Content-Type, allowing forward-slash path injection and arbitrary content upload."
Attack vector
An anonymous visitor to any published Typebot that includes a file-input block can obtain a valid `sessionId` by starting the bot. They then send a `POST` to `/api/blocks/file-input/v3/generate-upload-url` with a `fileName` containing forward-slash path injection (e.g., `evil/path/inject/payload.html`). The server constructs an S3 key under the `public/` prefix using this unsanitized `fileName` and returns a presigned PUT URL that does not enforce `Content-Type`. The attacker can then `PUT` attacker-controlled HTML, SVG, or JS content with an arbitrary `Content-Type` to that URL, achieving arbitrary object write in the shared object store. This enables stored XSS when the uploaded file is served from the application's storage origin. [CWE-22] [CWE-79] [ref_id=1]
Affected code
The unauthenticated `POST /api/blocks/file-input/v3/generate-upload-url` endpoint is exposed via `builderPublicProcedure` in `packages/blocks/fileInput/src/api/router.ts:41`. The handler in `packages/blocks/fileInput/src/api/handleGenerateUploadUrl.ts` concatenates the unsanitized `fileName` input directly into the S3 object key, and `packages/lib/src/s3/generatePresignedPutUrl.ts` issues a presigned PUT URL that does not bind `Content-Type`. The same pattern exists in the deprecated V1/V2 handlers and the builder upload endpoint. [ref_id=1]
What the fix does
The advisory recommends deriving the object key server-side from a UUID and the extension from an allowed MIME type rather than using the client-supplied `fileName`. It also recommends binding and enforcing `Content-Type` in the presigned upload (e.g., via a POST policy that pins key-prefix, content-type, and size), and serving user uploads from a separate origin with `X-Content-Type-Options: nosniff` and `Content-Disposition: attachment`. The patch is not shown in the bundle, but the advisory states the issue is fixed in version 3.17.0. [ref_id=1]
Preconditions
- configThe target Typebot deployment must be version 3.16.1 or earlier
- networkThe attacker must be able to reach the public API endpoint (no authentication required)
- inputA published bot with a file-input block (or text input with attachments/audio) must exist to obtain a valid sessionId
Generated on Jun 18, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
2- github.com/baptisteArno/typebot.io/releases/tag/v3.17.0mitrex_refsource_MISC
- github.com/baptisteArno/typebot.io/security/advisories/GHSA-fp7x-6pqh-vhvfmitrex_refsource_CONFIRM
News mentions
0No linked articles in our index yet.