{"schema_version":"1.9.0","id":"GHSA-vcc4-2c75-vc9v","published":"2026-06-16T21:28:55Z","modified":"2026-07-24T19:11:47.063874212Z","aliases":["CVE-2026-52846","GO-2026-5660"],"summary":"Caddy: stripHTML template function bypass","details":"### Summary\nCaddy’s `stripHTML` template function cannot reliably remove all HTML tags from input strings. Certain malformed HTML, such as `<<>img src=x onerror=alert()>`, can bypass the tag-stripping logic, potentially leaving dangerous content in the output if it is later rendered as HTML. This may allow client-side XSS in cases where untrusted strings are rendered unsafely.\n\n---\n\n### Details\nThe vulnerability originates from `funcStripHTML` in:\n\n[caddy/caddy/caddyhttp/templates/tplcontext.go](https://github.com/caddyserver/caddy/blob/77e9ce7404c4a76853e101a9f5687a929ee56654/modules/caddyhttp/templates/tplcontext.go)\n\n```go\nfunc (TemplateContext) funcStripHTML(s string) string {\n var buf bytes.Buffer\n var inTag, inQuotes bool\n var tagStart int\n for i, ch := range s {\n if inTag {\n if ch == '>' && !inQuotes {\n inTag = false\n } else if ch == '<' && !inQuotes {\n // false start\n buf.WriteString(s[tagStart:i])\n tagStart = i\n } else if ch == '\"' {\n inQuotes = !inQuotes\n }\n continue\n }\n if ch == '<' {\n inTag = true\n tagStart = i\n continue\n }\n buf.WriteRune(ch)\n }\n if inTag {\n // false start\n buf.WriteString(s[tagStart:])\n }\n return buf.String()\n}\n```\n\n### POC\n\nCaddyfile setup\n\n```\n:8080 {\n root * ./site\n file_server\n templates\n}\n```\n\nTemplate file (index.html)\n\n```html\n\n\n
\n \n{{ stripHTML \"<<>img src=x onerror=alert('XSS')>\" }}
\n\n\n```\n\nThe payload exploits the false start branch to smuggle a literal < back into the output, then uses the following > to terminate the parser’s tag state, leaving a valid