The vulnerability consists of two main issues: client-side script execution and a backend authorization bypass. The provided patch, commit a68f0c91790af8f52f17557f4aa202e966e7e579, primarily addresses the client-side execution vector.
The analysis of the patch reveals that before the fix, the functions executeScript and executeSetVariable in the @typebot.io/js package were vulnerable. They both used the AsyncFunction constructor to execute arbitrary JavaScript provided in a typebot's definition. When a victim previewed a malicious typebot, this code would run in their browser with their active session, allowing the script to make authenticated requests.
The exploit PoC leverages this to call the insecure /api/trpc/credentials.getCredentials API endpoint, which improperly disclosed credentials without verifying ownership. The patch mitigates the client-side vulnerability by introducing a safety flag (isUnsafe) for imported bots. When this flag is set, the scripts are executed within a sandboxed Web Worker (runUserCodeInWorker) which has restricted network capabilities (e.g., fetch calls are made without credentials), thus preventing the malicious script from accessing the sensitive API endpoints. The identified functions, executeScript and executeSetVariable, are the entry points for the code execution and would appear in a runtime profile during exploitation.