Summary
DbGate improperly renders attacker-controlled SVG icon strings as raw HTML without sanitization, enabling stored cross-site scripting (XSS).
In the browser-based UI this can run arbitrary scripts in other users' sessions, and in the Electron desktop app it can escalate further to local code execution due to permissive Electron settings.
Affected context
The vulnerability occurs in DbGate installations (web or Electron) that accept and later display user-supplied SVG icon values in the UI.
When these untrusted SVG strings are inserted directly into the DOM as HTML, scripts embedded in the SVG can execute.
In the web UI, this primarily affects users who view data containing malicious icons.
In the Electron desktop app, the same rendering behavior interacts with nodeIntegration: true and contextIsolation: false, broadening the potential impact from XSS to local code execution capabilities.
Exploit preconditions
- Attack surface: DbGate UI components that render SVG icons supplied through project configuration, connection metadata, or other user-controlled inputs.
- Required access: Ability to create, modify, or otherwise influence records or settings that define SVG icon strings (e.g., through a legitimate account, shared workspace, or compromised API/channel).
- Trigger point: A victim user (or the local user in the desktop app) opens a view or screen where the malicious SVG icon is rendered by the application.
- Why exploitation is possible: The application treats SVG icon strings as trusted markup and injects them into the DOM without sanitization or content restrictions, enabling script execution within the page or Electron context.
Why this happens
The underlying flaw is a classic stored XSS pattern mapped to CWE-79: Improper Neutralization of Input During Web Page Generation.
DbGate accepts untrusted SVG icon strings and renders them directly as raw HTML/DOM content rather than as inert data.
SVG is an XML-based vector format that can include scriptable elements and event handlers, so treating attacker-controlled SVG as HTML/DOM markup allows arbitrary JavaScript to execute when the icon is displayed.
In the Electron build, this XSS occurs in an environment additionally configured with nodeIntegration: true and contextIsolation: false, effectively bridging the browser context with Node.js APIs and aligning with CWE-94: Improper Control of Generation of Code, since injected script can reach local code execution primitives.
Potential impact
- Theft of session information or authentication tokens accessible to the DbGate web context.
- Execution of arbitrary JavaScript in the context of the DbGate UI, potentially manipulating queries, connections, or displayed data.
- Installation of persistent client-side payloads that trigger whenever affected views or projects are opened.
- In the Electron app, execution of arbitrary JavaScript with access to Node APIs, which may enable reading/writing local files or spawning processes.
- Lateral movement within a shared environment, such as influencing other users who open shared configurations or projects.
General mitigation guidance
Mitigation focuses on neutralizing untrusted markup, constraining rendering surfaces, and hardening the runtime environment:
- Treat all SVG icon strings and display metadata as untrusted input, regardless of source, and apply strict sanitization before inserting into the DOM.
- Prefer safe rendering primitives such as text-only properties or attribute bindings instead of raw HTML injection (e.g., avoid APIs that bypass the framework's escaping).
- Apply an allowlist-based SVG sanitizer that strips scripting features (scripts, event handlers, external references, and dangerous elements/attributes) before rendering.
- Where possible, restrict icons to a controlled set (e.g., predefined icon sets or server-generated identifiers) instead of accepting arbitrary SVG markup from users.
- In Electron, follow secure-by-default settings: disable
nodeIntegrationin renderer processes, enablecontextIsolation, and avoid exposing broad Node.js APIs directly to web content. - Use a principle-of-least-privilege design for any bridge between the UI and the local system, exposing only minimal, validated IPC endpoints.
How teams detect issues like this
Detection strategies typically combine static analysis, code review patterns, and policy enforcement:
- Use static analysis or linters to flag any code paths that write user-controlled strings into
innerHTML,dangerouslySetInnerHTML, or equivalent raw HTML APIs, especially when handling SVG content. - During code review, look for places where display metadata (icons, labels, descriptions) is rendered without escaping or sanitization, and for custom HTML injection helpers that bypass framework defaults.
- Define secure coding guidelines that explicitly forbid direct DOM insertion of untrusted SVG or HTML, backed by automated checks in CI pipelines.
- For Electron, add configuration checks that assert
nodeIntegration: falseandcontextIsolation: trueby default, and monitor for exceptions to this rule. - Consider content security policies (for web deployments) that limit inline script execution and unsafe-eval to reduce the blast radius if markup injection occurs.

