
On June 12, 2026 (12.06.2026), during an interface security analysis of the Grok Web UI (grok.com), I discovered a Frontend Rendering Validation Failure when pasting raw HTML source code.
When pasting a raw HTML code block containing inline <style>, @keyframes, and <img> tags into the prompt box, the Grok web interface attempted to execute and render these HTML elements directly onto the chat UI instead of escaping them as plain text. This allowed arbitrary elements to break out of the chat message container, causing severe UI distortion and full-screen layout hijacking overlaying the entire chat application.
| Property | Details |
|---|---|
| Target Application | Grok Web UI (grok.com by xAI) |
| Researcher | Efe Kırbaş |
| Vulnerability Class | Frontend Rendering Validation Failure / HTML & Inline CSS Injection |
| Discovery Date | June 12, 2026 (12.06.2026) |
| Status | Resolved / Patched |
| Severity | Medium / High (UI Redirection, Phishing Overlays, Clickjacking & Chat Defacement) |
Below is the verbatim bug report submitted to the Grok development team on Discord:
Title: Bug Report: Grok Web UI HTML Rendering / Injection Issue
Issue: Frontend rendering validation failure when pasting raw HTML source code.
Details: When pasting a raw HTML code block containing inline<style>,@keyframes, and<img>tags into the prompt box, the Grok web interface (grok.com) attempts to execute and render these HTML elements directly onto the chat UI instead of escaping them as plain text. This causes severe UI distortion and layout corruption overlaying the chat screen.
Expected Behavior: The interface should safely escape all tags and display the input purely as plain text inside a standard markdown code block.
Actual Behavior: The browser executes the inline styles and loads the external image asset from the user prompt, breaking the entire layout of the chat interface.
(Sanitized placeholder title and image URL used in the snippet below)
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Custom Loader Overlay</title>
</head>
<body>
<div
id="site-loader"
style="position:fixed;inset:0;z-index:99999;background:#0a0a0f;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:22px;"
>
<style>
@keyframes sl-spin {
to {
transform: rotate(360deg);
}
}
@keyframes sl-pulse {
0%, 100% {
opacity: .55;
transform: scale(1);
}
50% {
opacity: 1;
transform: scale(1.06);
}
}
</style>
<div style="position:relative;width:88px;height:88px">
<div
style="position:absolute;inset:-4px;border-radius:50%;border:2.5px solid rgba(116,71,127,0.18);border-top-color:#9d68aa;animation:sl-spin 0.9s linear infinite;"
></div>
<img
src="https://example.com/assets/loader.png"
width="88"
height="88"
style="border-radius:50%;object-fit:cover;animation:sl-pulse 2.4s ease-in-out infinite;"
draggable="false"
/>
</div>
</div>
</body>
</html>
position: fixed & inset: 0In single-page applications (SPAs), message threads are nested inside specific DOM containers (such as scrollable divs with overflow management). However, by applying position: fixed; inset: 0;, the injected #site-loader element breaks completely free from its parent container boundaries, expanding across the entire client viewport (100vw × 100vh).
z-index: 99999The excessive z-index: 99999 value forces the browser to render the injected backdrop above all native Grok UI elements—including:
The frontend parser accepted <style> tags containing custom @keyframes definitions (sl-spin, sl-pulse). Injected animations continuously consume GPU/CPU rendering resources, creating layout thrashing or browser tab slowdowns.
The <img> tag fetched an external asset from an arbitrary third-party CDN (example.com). This introduces an out-of-band communication vector where external resource requests reveal the client's IP address, referer header, and browser user-agent to third-party endpoints.
While direct JavaScript execution (<script> or event handlers like onload/onerror) was filtered out, raw HTML and inline CSS injection in an AI chat interface introduces several severe exploitation pathways:
The video demonstration below shows the step-by-step reproduction of the bug, the prompt submission, and the immediate takeover of the Grok Web UI layout:
Demonstration: PoC video showing the HTML/CSS injection and viewport lock on Grok Web UI
The bug was reported on June 12, 2026 at 06:20. Within 1 hour and 18 minutes, a developer from the Grok web team (grokwebdev) responded to the report:
"we currently allow this because we sanitize all dangerous code, but we may remove this to improve the quality of the product"
— grokwebdev, June 12, 2026, 07:38
Following this communication, the Grok development team took action to resolve the issue.
To effectively prevent layout-breaking HTML/CSS injection, markdown rendering pipelines should implement the following defenses:
<div> instead of raw <div>) inside markdown code fences.position: fixed, position: absolute, viewport units (vh, vw), and extreme z-index values from allowed inline styles.<style> and <link> Blocks:In subsequent frontend updates, Grok's web client was patched. The parser now properly escapes structural HTML containers and eliminates dangerous layout styles, ensuring the chat interface remains fully isolated and secure against UI injection attacks.
| Date & Time | Event |
|---|---|
| 12.06.2026 — 06:20 | Vulnerability discovered and reported to Grok development team with PoC code |
| 12.06.2026 — 07:38 | Grok developer (grokwebdev) responded and acknowledged the behavior |
| Post-Disclosure | Frontend update deployed; strict HTML tag escaping and layout style sanitization implemented |
| Current Status | Successfully Patched / Resolved |