CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2025-45286

Reflected XSS in go-httpbin via Unsafe Content-Type Handling

Alon Barad
Alon Barad
Software Engineer

Mar 1, 2026·7 min read·95 visits

Executive Summary (TL;DR)

Unsanitized input reflection in go-httpbin allows attackers to force a text/html Content-Type response containing malicious JavaScript. Patched in version 2.18.0.

A reflected Cross-Site Scripting (XSS) vulnerability exists in mccutchen/go-httpbin (also known as httpbingo) versions prior to 2.18.0. The vulnerability allows remote attackers to execute arbitrary JavaScript in the context of a victim's browser by manipulating the 'Content-Type' header and response body content simultaneously. This issue affects endpoints designed to echo request data, such as /response-headers and /base64, where proper output encoding was not enforced for dangerous content types.

Vulnerability Overview

The go-httpbin library, a Go port of the popular httpbin.org service, is widely used by developers to test HTTP requests and responses. The service includes endpoints specifically designed to echo back data provided by the client, allowing users to inspect how their HTTP clients handle various server responses. However, versions prior to 2.18.0 contain a critical logic flaw in how these echo responses are generated, leading to Reflected Cross-Site Scripting (XSS).

The vulnerability, identified as CVE-2025-45286, arises from the application's willingness to accept a user-defined Content-Type via query parameters or path segments while simultaneously reflecting user input in the response body. By default, the application did not differentiate between safe content types (like application/json) and executable content types (like text/html).

When an attacker crafts a request that sets the Content-Type to text/html and injects HTML tags into the response body parameters, the browser interprets the server's output as an HTML document rather than a JSON object or plain text. This causes the browser to parse and execute any JavaScript embedded within the response, bypassing standard same-origin protections and granting the attacker execution context within the victim's session.

Root Cause Analysis

The root cause of this vulnerability is the failure to neutralize output based on the response context (CWE-79). Specifically, the /response-headers and /base64 endpoints in go-httpbin function as sinks that reflect untrusted input without adequate encoding when dangerous Multipurpose Internet Mail Extensions (MIME) types are specified.

In the /response-headers endpoint, the application iterates through provided query parameters to construct the HTTP response headers. Crucially, if a user provides a Content-Type parameter, the application applies it to the response header. After setting the headers, the application serializes the entire map of query parameters into a JSON object and writes it to the response body. The code implicitly assumed that because the body structure was JSON, it would be treated as data. However, browsers prioritize the Content-Type header over the body structure. If the header declares text/html, the browser attempts to render the JSON text as HTML, executing valid tags found within the JSON strings.

Similarly, the /base64 endpoint decodes a URL-provided base64 string and writes the raw bytes to the response. It also accepts a Content-Type override. An attacker can encode a malicious HTML payload in base64, append a Content-Type override, and force the server to serve a valid HTML page containing the payload. In both cases, the lack of an allowlist for content types or conditional HTML escaping for dangerous types facilitated the execution of arbitrary code.

Code Analysis

The following analysis compares the vulnerable implementation with the remediated code in version 2.18.0. The focus is on the responseHeaders handler, which processes user input to generate headers and body content.

Vulnerable Implementation

In the vulnerable version, the handler iterates over query parameters, sets them as headers, and then encodes the map directly to the response writer. No check exists to determine if the Content-Type is dangerous.

// Pre-patch logic (simplified)
func (h *Handler) responseHeaders(w http.ResponseWriter, r *http.Request) {
    // ... (logic to parse params)
 
    // 1. User input sets Content-Type header directly
    for k, v := range params {
        w.Header().Set(k, v[0])
    }
 
    // 2. User input is written to body as JSON
    // If Content-Type is text/html, browser executes scripts in JSON strings
    encoder := json.NewEncoder(w)
    encoder.Encode(params)
}

Patched Implementation

The fix introduces a safety check using mustEscapeResponse. If the requested Content-Type is not in a safe allowlist (e.g., application/json, text/plain), the application HTML-escapes the body content before writing it. This neutralizes <script> tags by converting them to &lt;script&gt;.

// Post-patch logic (Commit 0decfd1)
func (h *Handler) responseHeaders(w http.ResponseWriter, r *http.Request) {
    contentType := getContentType(params)
    
    // 1. Check if the requested content type requires escaping
    if h.mustEscapeResponse(contentType) {
        // 2. Use a buffer to encode the JSON first
        var buf bytes.Buffer
        json.NewEncoder(&buf).Encode(params)
        
        // 3. HTML Escape the entire body string before writing
        w.Write([]byte(html.EscapeString(buf.String())))
    } else {
        // Safe content types (json/plain) processed normally
        json.NewEncoder(w).Encode(params)
    }
}

The patch also defines safeContentTypes map including application/json, text/plain, and application/octet-string. Any type not in this list triggers the escaping logic.

Exploitation Methodology

Exploiting this vulnerability requires crafting a URL that sets the Content-Type to text/html and includes a JavaScript payload in a reflected parameter. This attack vector relies on the victim clicking a malicious link (Reflected XSS).

Attack Prerequisites

  1. Target Accessibility: The attacker must have network access to the vulnerable go-httpbin instance.
  2. User Interaction: A victim must be tricked into clicking a crafted URL.
  3. No CSP: The target site must not have a Content Security Policy (CSP) that strictly forbids inline scripts, or the attacker must operate within the constraints of the existing CSP.

Proof of Concept

The following URL demonstrates the attack against the /response-headers endpoint:

http://vulnerable-httpbin.com/response-headers?Content-Type=text/html&xss=<script>alert(document.domain)</script>

Execution Flow:

  1. The server parses Content-Type=text/html and sets the response header Content-Type: text/html.
  2. The server adds xss to the JSON map: {"xss": "<script>alert(document.domain)</script>", ...}.
  3. The server writes this JSON string to the body.
  4. The victim's browser receives the text/html header. It ignores the JSON syntax and scans for HTML tags.
  5. The browser encounters <script>... and executes the JavaScript payload.

Base64 Vector

A similar attack works on the /base64 endpoint by encoding the payload <html><script>alert(1)</script></html> into Base64 strings and appending it to the URL path, effectively turning go-httpbin into a malicious file host.

Impact Assessment

The impact of this vulnerability is classified as Medium (CVSS 6.1) because it requires user interaction and does not directly compromise the server's infrastructure. However, the consequences for the client/victim can be significant depending on the context in which go-httpbin is deployed.

Confidentiality Impact (Low/High): If the vulnerable instance runs on a domain that shares cookies or local storage with sensitive applications (e.g., an internal testing subdomain test.corp.com sharing context with admin.corp.com), an attacker could steal session tokens or authentication credentials. The S:C (Scope: Changed) metric in CVSS 3.1 reflects this potential to impact other resources in the browser's security context.

Integrity Impact (Low): An attacker can modify the visual presentation of the page or perform actions on behalf of the user, such as submitting unauthorized requests to other services accessible from the victim's browser (CSRF via XSS).

Availability Impact (None): This vulnerability does not allow for denial of service or server-side resource exhaustion. The server continues to function normally while serving the malicious payload.

Remediation & Mitigation

The vulnerability is addressed in go-httpbin version 2.18.0. The primary remediation strategy is to upgrade the library to this version or later. The patch enforces HTML escaping for any response where the Content-Type is not explicitly allowlisted as safe.

Configuration Changes

The patch introduces a configuration flag, UNSAFE_ALLOW_DANGEROUS_RESPONSES (or the command-line flag -unsafe-allow-dangerous-responses). This flag defaults to false. Administrators must ensure this flag remains disabled in production environments. Enabling this flag reverts the application to the vulnerable behavior, negating the security fix.

Defense in Depth

For environments where immediate patching is not feasible, the following mitigations are recommended:

  1. WAF Rules: Implement Web Application Firewall rules to block requests to /response-headers and /base64 containing Content-Type=text/html or other dangerous MIME types (e.g., image/svg+xml, text/xml).
  2. Content Security Policy (CSP): Deploy a strict CSP header via a reverse proxy sitting in front of the go-httpbin instance. A policy such as default-src 'none'; script-src 'self'; would prevent the execution of inline scripts injected via this vulnerability.
  3. Network Segmentation: Restrict access to go-httpbin instances to trusted internal networks or authenticated users via VPN/Zero Trust proxies, reducing the likelihood of a successful phishing attack.

Official Patches

mccutchen/go-httpbinFix commit implementing safe content type checks

Fix Analysis (1)

Technical Appendix

CVSS Score
6.1/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
EPSS Probability
0.01%
Top 99% most exploited

Affected Systems

mccutchen/go-httpbin < 2.18.0httpbingo

Affected Versions Detail

Product
Affected Versions
Fixed Version
go-httpbin
mccutchen
< 2.18.02.18.0
AttributeDetail
CWE IDCWE-79
CWE NameImproper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
CVSS v3.16.1 (Medium)
Attack VectorNetwork (Reflected)
EPSS Score0.00012 (1.47%)
Exploit StatusPoC Available

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1059.007Command and Scripting Interpreter: JavaScript
Execution
CWE-79
Reflected Cross-Site Scripting (XSS)

Known Exploits & Detection

NVDVulnerability details and vectors
GitHub AdvisoryOfficial advisory with PoC details

Vulnerability Timeline

Fix commit merged
2025-03-20
CVE-2025-45286 Published
2026-01-02
Analyzed by NVD
2026-01-07

References & Sources

  • [1]Release Notes v2.18.0
  • [2]OSV Entry for GO-2025-3554

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-119283
7.5

CVE-2026-119283: Unbounded JWE Recipients Array Causes CPU Exhaustion in Authlib joserfc

A resource consumption vulnerability exists in the Authlib joserfc Python library prior to version 1.7.5. When processing JSON Web Encryption (JWE) objects formatted using General JSON Serialization, the library fails to enforce an upper bound on the number of elements within the recipients array. An unauthenticated attacker can supply a JWE containing thousands of recipient entries targeting an RSA key management algorithm, forcing the server to perform an equivalent number of computationally expensive RSA private-key decryption operations per request and exhausting available CPU resources.

Alon Barad
Alon Barad
0 views•9 min read
•about 2 hours ago•CVE-2026-119284
6.9

CVE-2026-119284: Uncontrolled Resource Consumption in joserfc Compact Deserialization

CVE-2026-119284 (GHSA-9pg5-8c7x-5hfx) is an uncontrolled resource consumption vulnerability (CWE-400) in the compact serialization deserialization routines of joserfc prior to version 1.7.6. The library enforced individual segment size limits only after invoking Python's bytes.split(b'.') on untrusted input tokens. By sending oversized compact JWS or JWE tokens, an unauthenticated remote attacker can force the Python interpreter to duplicate and allocate memory for every segment before size validation executes, resulting in memory exhaustion and an Endpoint Denial of Service (DoS).

Amit Schendel
Amit Schendel
5 views•10 min read
•about 9 hours ago•GHSA-C33X-VCV4-VG3G
2.1

GHSA-c33x-vcv4-vg3g: Missing Slot Identifier Validation in Cedar Policy Language JSON Template Parser Causes Panic and Authorization Divergence

An improper input validation vulnerability (CWE-20) exists in the Entity Syntax Tree (EST) JSON deserialization component of the Cedar Policy Language (`cedar-policy` and `@cedar-policy/cedar-wasm`). When parsing JSON-formatted policy templates that define `is ... in` scope constraints on `principal` or `resource`, the parser used wildcard pattern matching that ignored the provided slot identifier (`?principal` or `?resource`). This omission allows malformed JSON templates to bypass initial deserialization validation, resulting in either a runtime panic during template linking or inverted slot bindings that alter authorization outcomes.

Amit Schendel
Amit Schendel
7 views•10 min read
•about 10 hours ago•GHSA-W9X9-J56R-H98R
8.2

GHSA-w9x9-j56r-h98r: Unauthenticated Confused Deputy Proxy in @eeacms/volto-chatbot

The @eeacms/volto-chatbot package for Plone Volto contains an unauthenticated confused deputy vulnerability (CWE-862) in versions 2.0.3 and earlier. The package registers Express middleware on wildcard proxy routes (`**/_v1_da/**` and `**/_v1_ha/**`) without verifying client authentication or restricting target endpoints. When processing incoming HTTP requests, the middleware automatically attaches server-side administrative credentials before forwarding the requests to upstream Danswer (Onyx) or Halloumi (LLMGW) API servers. This allows unauthenticated network attackers to execute arbitrary administrative API calls against the backend infrastructure.

Amit Schendel
Amit Schendel
6 views•8 min read
•about 12 hours ago•CVE-2026-9705
6.5

CVE-2026-9705: Registration Access Token Authorization Bypass in Keycloak Dynamic Client Registration

CVE-2026-9705 is an insufficient session expiration and authorization bypass vulnerability in Keycloak and Red Hat build of Keycloak. The vulnerability occurs in the OAuth 2.0 Dynamic Client Registration Management Protocol implementation, where the authentication handler fails to verify whether a target client is enabled before accepting requests authenticated with a previously issued Registration Access Token (RAT). Consequently, an actor possessing a valid RAT for an administratively disabled client can query, update, and re-enable the client configuration, restoring revoked access to realm resources.

Amit Schendel
Amit Schendel
8 views•10 min read
•about 13 hours ago•CVE-2026-9800
8.1

CVE-2026-9800: Authorization Bypass in Keycloak Policy Enforcer via Unnormalized URI Substring Matching

CVE-2026-9800 is an authorization bypass vulnerability affecting the Keycloak Policy Enforcer (org.keycloak:keycloak-policy-enforcer), which is integrated into Red Hat build of Keycloak, Red Hat build of Quarkus, Red Hat Single Sign-On 7, and Red Hat JBoss Enterprise Application Platform Expansion Pack. The flaw stems from improper comparison logic in the PolicyEnforcer.isDefaultAccessDeniedUri method, which uses loose substring matching on the full raw request URI rather than exact, normalized path comparisons against the configured access-denied landing page. Consequently, an authenticated attacker possessing any valid low-privileged token can bypass role-based, scope-based, and User-Managed Access (UMA) policy evaluations by embedding the access-denied path segment into the URL path or query parameters.

Amit Schendel
Amit Schendel
9 views•8 min read