Skip to main content

Caddy EUVDEUVD-2026-38556

| CVE-2026-52846 MEDIUM
Improper Encoding or Escaping of Output (CWE-116)
2026-06-16 https://github.com/caddyserver/caddy GHSA-vcc4-2c75-vc9v
4.2
CVSS 3.1 · Vendor: https://github.com/caddyserver/caddy
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft malformed HTML payload `<<>img src=x onerror=...>`
  2. Delivery
    Submit via user-controlled input to Caddy template endpoint
  3. Exploit
    `stripHTML` false-start branch emits literal `<` into output buffer
  4. Execution
    Empty pseudo-tag `<>` exits parser tag-state, remaining payload written as text
  5. Persist
    Browser reassembles valid `<img>` tag
  6. Impact
    onerror handler executes JavaScript in victim session

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding for downstream
Exploitation Conditions

Exploitation requires all of the following non-default conditions to be simultaneously true: (1) Caddy's templates middleware must be explicitly enabled via the templates directive in the Caddyfile - it is not active by default; (2) a template must invoke the stripHTML function on a string that includes attacker-controlled input; (3) the output of stripHTML must be rendered as raw/unescaped HTML in the browser, bypassing any downstream auto-escaping that Go's html/template package would otherwise apply. Limiting factors include required victim user interaction (UI:R) - a user must load the page - and the necessity of the specific templates configuration described above. The vulnerability does NOT apply to Caddy deployments used purely as a reverse proxy or static file server without the templates module.

Impact

The NVD-assigned CVSS 3.1 score of 4.2 (Medium) with vector AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N reflects a real-world risk that is meaningfully constrained by multiple prerequisite conditions. AC:H is well-justified: Caddy's templates module is not enabled in default deployments, stripHTML must be explicitly invoked in a template on untrusted user-controlled input, and the processed output must be rendered as raw HTML without downstream escaping. The PR:N metric is accurate - the attacker does not need authentication; the payload is delivered as ordinary user input. UI:R correctly captures that a victim must load the affected page. EPSS data is not available in the provided intelligence, so probabilistic exploitation likelihood cannot be quantified. No CISA KEV listing confirms no known mass exploitation. A POC exists and is publicly documented in the GitHub advisory, lowering the barrier to exploitation for any deployment meeting the prerequisite conditions. The practical priority is low for most Caddy deployments but elevated for sites explicitly using the templates module with user-controlled data passed to stripHTML.

Exploit ScenarioDerived

An attacker submits the payload <<>img src=x onerror=alert(document.cookie)> as a user-controlled string (query parameter, form field, or stored value) to a Caddy-hosted application that passes it through stripHTML in a template and renders the output as raw HTML. Because stripHTML fails to strip the malformed tag, the browser reconstructs a valid <img> element whose onerror handler executes, stealing session tokens or performing actions in the victim's browser context. A working POC for this exact input is publicly documented in GHSA-vcc4-2c75-vc9v against Caddy v2.11.3.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 17, 2026

The stripHTML template function in Caddy web server can be bypassed with malformed HTML input such as <<>img src=x onerror=alert()>, allowing injected HTML tags to survive sanitization and reach the browser as executable markup, resulting in client-side XSS. Affected versions are Caddy v2 <= 2.11.3 and Caddy v1 <= 1.0.5; exploitation requires the templates middleware to be active and untrusted input to be processed via stripHTML and rendered without further escaping. A publicly available proof-of-concept exists per the GitHub security advisory GHSA-vcc4-2c75-vc9v; no active exploitation is confirmed in CISA KEV at time of analysis.

RemediationAI

For Caddy v2 deployments, upgrade to version 2.11.4 or later, which contains the upstream fix per the GHSA-vcc4-2c75-vc9v advisory at https://github.com/caddyserver/caddy/security/advisories/GHSA-vcc4-2c75-vc9v. No vendor-released patch is available for Caddy v1 (1.0.5 and earlier); v1 users should migrate to the v2 branch where feasible. As immediate compensating controls: disable the Caddy templates middleware entirely if not required (remove the templates directive from the Caddyfile), avoiding the attack surface completely with no functional trade-off for static file serving. If templates are required, avoid passing untrusted user input through stripHTML for security-sensitive sanitization; instead use Go's html/template auto-escaping or a dedicated HTML sanitization library such as bluemonday. Do not rely on stripHTML as a security boundary - it is a display-formatting helper, not a sanitizer.

Affected VersionsENISA

caddy < 2.11.4

Affected Packages

go github.com/caddyserver/caddy no fix
go github.com/caddyserver/caddy/v2 fix: 2.11.4
euvd caddy fix: 2.11.4

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 3 packages in go, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The vulnerability is rooted in CWE-116 (Improper Encoding or Escaping of Output). The affected code is funcStripHTML in modules/caddyhttp/templates/tplcontext.go, which implements a hand-rolled character-scanning HTML stripper in Go. The parser tracks state using inTag and tagStart variables: when a < is encountered inside an existing tag context, it is treated as a 'false start' and the substring from tagStart to the current position is flushed to the output buffer - including the original < character. The crafted payload <<>img src=x onerror=alert()> exploits this: the first < sets inTag=true, the second < triggers the false start branch and writes a literal < to the buffer while resetting tagStart, the following > then closes what is effectively the empty pseudo-tag <>, and the remaining img src=x onerror=alert()> is written as non-tag content. The browser reassembles this as a fully valid <img> element. The affected packages are pkg:go/github.com_caddyserver_caddy_v2 and pkg:go/github.com_caddyserver_caddy.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/caddyserver/caddy) PRIMARY 4.2 MEDIUM
AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N
vuln.today AI 4.2 MEDIUM

AC:H reflects non-default configuration prerequisites (templates enabled, stripHTML on untrusted input); UI:R required as victim must render the output; no availability impact applies.

3.1 AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N
4.0 AV:N/AC:H/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N
SUSE MEDIUM
Red Hat 4.2 MEDIUM

Primary rating from Vendor (https://github.com/caddyserver/caddy).

CVSS VectorVendor: https://github.com/caddyserver/caddy

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
None

DescriptionCVE.org

Summary

Caddy’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.

---

Details

The vulnerability originates from funcStripHTML in:

caddy/caddy/caddyhttp/templates/tplcontext.go

go
func (TemplateContext) funcStripHTML(s string) string {
    var buf bytes.Buffer
    var inTag, inQuotes bool
    var tagStart int
    for i, ch := range s {
        if inTag {
            if ch == '>' && !inQuotes {
                inTag = false
            } else if ch == '<' && !inQuotes {
                // false start
                buf.WriteString(s[tagStart:i])
                tagStart = i
            } else if ch == '"' {
                inQuotes = !inQuotes
            }
            continue
        }
        if ch == '<' {
            inTag = true
            tagStart = i
            continue
        }
        buf.WriteRune(ch)
    }
    if inTag {
        // false start
        buf.WriteString(s[tagStart:])
    }
    return buf.String()
}

POC

Caddyfile setup

:8080 {
    root * ./site
    file_server
    templates
}

Template file (index.html)

html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>StripHTML Bypass Test</title>
</head>
<body>
    <p>{{ stripHTML "<<>img src=x onerror=alert('XSS')>" }}</p>
</body>
</html>

The 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 <img ...> tag behind.

Tested in v2.11.3

Impact

Malformed HTML can bypass stripHTML, potentially allowing arbitrary HTML or JavaScript to be rendered if the output is used unsafely, leading to client-side XSS.

AI Disclosure

AI assisted in writing the report description; however, the discovery of the issue has been done manually.

Threat Intelligence Overview

EPSS Score
0.1%
Top 96% exploitable
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High
EUVD NVD CVE.org EPSS GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

21
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +21
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
SUSE Linux Enterprise High Performance Computing 12 Not-Affected
SUSE Linux Enterprise High Performance Computing 15 SP7 Not-Affected
SUSE Linux Enterprise Module for Containers 15 SP7 Not-Affected
SUSE Linux Enterprise Server 15 SP7 Not-Affected
SUSE Linux Enterprise Server 16.1 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy