DEV Community

CVE Reports
CVE Reports

Posted on Originally published at cvereports.com

CVE-2026-122244: CVE-2026-122244: Stored Cross-Site Scripting in Budibase Builder Formula Evaluation

CVE-2026-122244: Stored Cross-Site Scripting in Budibase Builder Formula Evaluation

Vulnerability ID: CVE-2026-122244
CVSS Score: 7.7
Published: 2026-11-20

CVE-2026-122244 (GHSA-r2q3-7m4h-63qg) is a high-severity cross-privilege Stored Cross-Site Scripting (XSS) vulnerability in Budibase prior to version 3.50.0. The flaw occurs due to defective character escaping in the JSON formatter utility combined with raw HTML rendering via Svelte's {@html} directive in the Budibase Builder interface. A low-privileged application user or an unauthenticated form visitor can store malicious HTML markup in a shared datasource, which subsequently executes arbitrary JavaScript in the browser session of an administrator or application builder inspecting Handlebars formula bindings.

TL;DR

A defective sanitization routine in Budibase's JSON formatter fails to escape raw HTML strings and JSON object keys before rendering them via Svelte's {@html} directive in the Builder UI. Low-privileged users can store malicious payloads in shared datasources to achieve arbitrary JavaScript execution in the context of an administrator's session, leading to full account takeover and workspace compromise.


⚠️ Exploit Status: POC

Technical Details

  • Vulnerability Type: Stored Cross-Site Scripting (CWE-79 / CWE-116)
  • CVSS v3.1 Score: 7.7 High (CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N)
  • Affected Component: packages/frontend-core/src/utils/jsonFormatter.ts & EvaluationSidePanel.svelte
  • Attack Vector: Network (Low-privileged or public write to shared datasource)
  • Impact: Arbitrary JS execution in Admin Builder session, account takeover, data exfiltration
  • Exploit Status: Proof-of-Concept (PoC)
  • Patched Versions: 3.50.0, 4.0.0
  • CISA KEV Status: Not Listed

Affected Systems

  • Budibase (packages/frontend-core)
  • Budibase (packages/builder)
  • Budibase: < 3.50.0 (Fixed in: 3.50.0)

Code Analysis

Commit: 5f37fb4

fix: escape builder evaluation output

diff --git a/packages/frontend-core/src/utils/jsonFormatter.test.ts b/packages/frontend-core/src/utils/jsonFormatter.test.ts
new file mode 100644
index 000000000000..be5c2e189183
--- /dev/null
+++ b/packages/frontend-core/src/utils/jsonFormatter.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from "vitest"
+import { format } from "./jsonFormatter"
+
+describe("JSON formatter", () => {
+  it("escapes markup in raw string values", () => {
+    const formatted = format("<img src=x onerror=alert(window.xssproof)>")
+
+    expect(formatted).toContain(
+      "&lt;img src&#x3D;x onerror&#x3D;alert(window.xssproof)&gt;"
+    )
+    expect(formatted).not.toContain("<img")
+  })
+
+  it("escapes markup in JSON string values and keys", () => {
+    const formatted = format({
+      "<script>": "<img src=x>",
+    })
+
+    expect(formatted).not.toContain("<script>")
+    expect(formatted).not.toContain("<img")
+  })
+})
diff --git a/packages/frontend-core/src/utils/jsonFormatter.ts b/packages/frontend-core/src/utils/jsonFormatter.ts
index 6b25d7d83c88..a2bb956e6cf6 100644
--- a/packages/frontend-core/src/utils/jsonFormatter.ts
+++ b/packages/frontend-core/src/utils/jsonFormatter.ts
@@ -39,33 +39,39 @@ export function format(json: JSONValue, colorOptions: ColorsOptions = {}) {
   let jsonString =
     typeof json === "string" ? json : JSON.stringify(json, null, 2) || valueType
   let colors = Object.assign({}, defaultColors, colorOptions)
-  jsonString = jsonString
-    .replace(/&/g, "&")
-    .replace(/</g, "<")
-    .replace(/>/g, ">")
-  return jsonString.replace(
-    /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+]?\d+)?)/g,
-    (match: string) => {
-      let color = colors.numberColor
-      let style = ""
-      if (/^"/.test(match)) {
-        if (/:$/.test(match)) {
-          color = colors.keyColor
-        } else {
-          color = colors.stringColor
-          match = '"' + escapeHtml(match.substr(1, match.length - 2)) + '"'
-          style = "word-wrap:break-word;white-space:pre-wrap;"
-        }
-      } else {
-        color = /true/.test(match)
-          ? colors.trueColor
-          : /false/.test(match)
-            ? colors.falseColor
-            : /null/.test(match)
-              ? colors.nullColor
-              : color
+  const tokenRegex =
+    /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+]?\d+)?)/g
+  const formatToken = (token: string) => {
+    let color = colors.numberColor
+    let style = ""
+    let formattedToken = token
+    if (/^"/.test(token)) {
+      color = /:$/.test(token) ? colors.keyColor : colors.stringColor
+      formattedToken = escapeHtml(token)
+      if (!/:$/.test(token)) {
+        style = "word-wrap:break-word;white-space:pre-wrap;"
       }
-      return `<span style="${style}color:${color}">${match}</span>`
+    } else {
+      color = /true/.test(token)
+        ? colors.trueColor
+        : /false/.test(token)
+          ? colors.falseColor
+          : /null/.test(token)
+            ? colors.nullColor
+            : color
+      formattedToken = escapeHtml(token)
     }
-  )
+    return `<span style="${style}color:${color}">${formattedToken}</span>`
+  }
+
+  let formatted = ""
+  let lastIndex = 0
+  let match: RegExpExecArray | null
+  while ((match = tokenRegex.exec(jsonString)) !== null) {
+    formatted += escapeHtml(jsonString.slice(lastIndex, match.index))
+    formatted += formatToken(match[0])
+    lastIndex = tokenRegex.lastIndex
+  }
+
+  return formatted + escapeHtml(jsonString.slice(lastIndex))
 }
Enter fullscreen mode Exit fullscreen mode

Mitigation Strategies

  • Upgrade Budibase to version 3.50.0 or 4.0.0 to apply proper HTML entity escaping across all JSON tokens, keys, and raw string slices in jsonFormatter.ts.
  • Enforce a strict Content Security Policy (CSP) header on the /builder/ route at the reverse proxy (e.g., Nginx) to block inline JavaScript execution and unauthorized outbound data exfiltration.
  • Audit shared external datasources and internal CouchDB/SQLite tables writable by low-privileged users or public forms for stored HTML markup and inline event handlers.

Remediation Steps:

  1. Pull the patched Budibase container image (docker pull budibase/budibase:3.50.0 or budibase/budibase:4.0.0) and restart the deployment.
  2. Configure upstream Nginx or ingress controllers to inject Content-Security-Policy: default-src 'self'; script-src 'self'; on all /builder/* paths.
  3. Run SQL or NoSQL inspection queries against user-populated columns to identify and purge records matching <script, <img, onerror=, or onload=.

References


Read the full report for CVE-2026-122244 on our website for more details including interactive diagrams and full exploit analysis.

Top comments (0)