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



GHSA-528Q-4PGM-WVG2

CVE-2025-45286: Reflected Cross-Site Scripting in go-httpbin via Unrestricted Content-Type Headers

Alon Barad
Alon Barad
Software Engineer

May 26, 2026·7 min read·37 visits

Executive Summary (TL;DR)

go-httpbin versions prior to v2.18.0 are vulnerable to reflected XSS (CWE-80) on the /response-headers and /base64 endpoints due to missing Content-Type validation and output encoding. The issue is fixed in v2.18.0 via a safe-by-default content type whitelist.

A reflected Cross-Site Scripting (XSS) vulnerability in go-httpbin allows attackers to execute arbitrary JavaScript in a victim's browser. The flaw occurs because specific endpoints permit clients to dictate the response Content-Type while simultaneously reflecting user-supplied input without sanitization.

Vulnerability Overview

The go-httpbin library is a Go-based implementation of the httpbin service, widely utilized by developers for testing HTTP requests, debugging webhooks, and simulating various server responses. Versions of this library prior to v2.18.0 contain a Reflected Cross-Site Scripting (XSS) vulnerability tracked as CVE-2025-45286. The vulnerability specifically affects endpoints designed to echo client data or manipulate response formatting based on query parameters.

The core issue resides in the application's failure to neutralize script-related HTML tags before returning them in HTTP responses. This weakness is formally classified as CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page. The application inherently trusts client-provided input to define critical response headers, bypassing standard security boundaries established by modern web browsers.

When deployed in environments where the go-httpbin service shares an origin with sensitive applications, or when used in targeted phishing campaigns, this vulnerability exposes clients to script execution attacks. The vulnerability carries a CVSS 3.1 base score of 6.1, reflecting a medium severity rating due to the requirement for user interaction prior to exploitation.

Root Cause Analysis

The vulnerability manifests due to a confluence of two distinct design choices in the go-httpbin application. First, specific endpoints permit the client to arbitrarily define the Content-Type header of the HTTP response via query parameters. Second, these same endpoints reflect user-controlled data directly into the HTTP response body without applying appropriate output encoding or sanitization.

The /response-headers endpoint serves as a primary example of this mechanical failure. The endpoint is designed to take query parameters and echo them back as HTTP response headers, while simultaneously returning a JSON representation of those headers in the response body. If an attacker supplies a Content-Type query parameter with the value text/html, the application sets the corresponding response header directly.

The application then constructs a JSON object containing the echoed parameters and writes it to the response stream. Because the response header dictates a text/html MIME type, the receiving web browser parses the JSON body as an HTML document. If the JSON payload contains HTML tags or JavaScript, the browser executes those instructions within the origin's context.

The /base64 endpoint presents a similar architectural flaw. This endpoint accepts a base64-encoded string within the URL path, decodes it, and returns the raw bytes. The endpoint also accepts a content-type query parameter to dictate the response MIME type. By encoding a malicious payload and forcing an HTML content type, an attacker guarantees script execution upon URL visitation.

Code Analysis and Patch Details

The remediation applied in version v2.18.0 fundamentally alters the trust model for dynamic response generation. The patch, introduced in commit 0decfd1a2e88d85ca6bfb8a92421653f647cbc04, transitions the application from a permissive model to a default-deny architecture. This architecture evaluates requested content types against a strict whitelist before trusting the output formatting.

// Conceptual representation of the patch logic applied in v2.18.0
func handleResponse(w http.ResponseWriter, requestedType string, body string) {
    safeTypes := map[string]bool{
        "text/plain": true,
        "application/json": true,
        "application/octet-stream": true,
    }
 
    if safeTypes[requestedType] {
        w.Header().Set("Content-Type", requestedType)
        w.Write([]byte(body))
        return
    }
 
    // Fallback for dangerous or unknown content types
    w.Header().Set("Content-Type", "text/html; charset=utf-8")
    safeBody := html.EscapeString(body)
    w.Write([]byte(safeBody))
}

The developers implemented an explicit whitelist containing only intrinsically safe MIME types: text/plain, application/json, and application/octet-stream. When a client requests a Content-Type that falls outside this predefined list, the application intercepts the response construction phase. The application subsequently processes the reflected output through the Go standard library's html.EscapeString() function.

This sanitization function replaces sensitive HTML characters with their corresponding safe HTML entities. For example, the < character becomes &lt;, neutralizing any attempt to initiate an HTML tag. To maintain backward compatibility for specialized testing scenarios, the maintainers introduced the UNSAFE_ALLOW_DANGEROUS_RESPONSES environment variable. When explicitly enabled, this flag bypasses the whitelist and sanitization routines, restoring the legacy vulnerable behavior.

Exploitation Methodology

Exploiting CVE-2025-45286 requires the attacker to construct a specialized URL and deliver it to a target user. The attack methodology relies on social engineering or secondary injection vectors to coerce the victim's browser into initiating an HTTP GET request to the vulnerable go-httpbin instance. No authentication is required to interact with the vulnerable endpoints.

For the /response-headers endpoint, the attacker constructs a query string containing the target Content-Type and a secondary parameter carrying the malicious payload. The following proof-of-concept demonstrates this specific vector.

GET /response-headers?Content-Type=text/html&xss=<script>alert('CVE-2025-45286')</script>

Upon receiving this request, the server responds with a Content-Type: text/html header. The response body contains the JSON representation of the query parameters, including the unescaped script tag. The browser processes the entire JSON string as HTML, locates the script tags, and executes the contained JavaScript code.

The /base64 endpoint requires an encoding step prior to payload delivery. The attacker generates an HTML payload, such as <img src=x onerror=alert(1)>, and encodes it to PGltZyBzcmM9eCBvbmVycm9yPWFsZXJ0KDEpPg==. The attacker appends this encoded string to the URL path and specifies the content type via query parameters.

GET /base64/PGltZyBzcmM9eCBvbmVycm9yPWFsZXJ0KDEpPg==?content-type=text/html

Impact Assessment

The execution of arbitrary JavaScript within the victim's browser session constitutes the primary security impact of this vulnerability. The script executes within the context of the domain hosting the go-httpbin application. If the application is hosted on a shared domain alongside sensitive administrative interfaces or internal services, the attacker gains the ability to interact with those services under the guise of the authenticated victim.

The attacker leverages this execution context to exfiltrate session tokens, manipulate client-side application states, or force the user's browser to issue unauthorized API requests. This technique, commonly documented as Cross-Site Request Forgery via XSS, circumvents standard anti-CSRF protections because the attacker's script operates from within the trusted origin.

The Common Vulnerability Scoring System (CVSS) v3.1 vector is CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N, yielding a base score of 6.1. The Exploit Prediction Scoring System (EPSS) indicates a score of 0.00016, translating to a 3.96% percentile. This metric suggests a low probability of broad automated exploitation in the wild, largely constrained by the bespoke nature of the application and the firm requirement for targeted victim interaction.

Remediation Guidance

Organizations utilizing the go-httpbin package must update their dependencies to version v2.18.0 or later. This update inherently resolves the vulnerability by enforcing the secure-by-default response handling architecture. Dependency managers such as Go modules handle this upgrade via the standard go get command specifying the patched version.

System administrators must audit their deployment configurations to ensure the UNSAFE_ALLOW_DANGEROUS_RESPONSES environment variable remains undefined or explicitly set to false. Enabling this variable in a production environment entirely negates the security benefits introduced in the v2.18.0 patch and reintroduces the cross-site scripting attack vector.

For environments where immediate patching is procedurally restricted, administrators implement Web Application Firewall (WAF) rules to mitigate the attack surface. These rules inspect HTTP GET requests targeting the /response-headers and /base64 paths. The WAF drops requests containing common HTML tags or JavaScript event handlers when combined with content-type manipulation parameters.

Official Patches

GitHub AdvisoryOfficial GitHub Security Advisory
GitHub CommitSource code patch fixing the vulnerability

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.02%
Top 96% most exploited

Affected Systems

github.com/mccutchen/go-httpbingithub.com/mccutchen/go-httpbin/v2

Affected Versions Detail

Product
Affected Versions
Fixed Version
go-httpbin
mccutchen
< 2.18.02.18.0
AttributeDetail
CWE IDCWE-80
Attack VectorNetwork
CVSS 3.1 Score6.1 (Medium)
EPSS Score0.00016
ImpactArbitrary JavaScript Execution (XSS)
Exploit StatusProof of Concept (PoC)
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1059.007Command and Scripting Interpreter: JavaScript
Execution
CWE-80
Improper Neutralization of Script-Related HTML Tags in a Web Page

Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)

Known Exploits & Detection

Proof of ConceptPublic PoC demonstrating XSS via /response-headers and /base64 endpoints.

Vulnerability Timeline

Vulnerability fixed in commit 0decfd1
2025-03-20
GHSA-528q-4pgm-wvg2 published by the maintainer
2025-03-20
CVE-2025-45286 published in the NVD
2026-01-02
NVD record updated with technical analysis
2026-01-07

References & Sources

  • [1]NVD Record for CVE-2025-45286
  • [2]Go Vulnerability Database Entry
  • [3]GitHub Security Advisory GHSA-528q-4pgm-wvg2
Related Vulnerabilities
CVE-2025-45286

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

•6 days ago•CVE-2026-9354
6.9

CVE-2026-9354: Arbitrary Mass Mention Bypass in NousResearch hermes-agent Slack and Mattermost Adapters

A vulnerability in the Slack and Mattermost platform adapters for NousResearch hermes-agent permits an unauthenticated remote attacker to execute arbitrary mass mentions. By leveraging prompt injection, an attacker can bypass output sanitization logic and trigger workspace-wide notification exhaustion.

Alon Barad
Alon Barad
35 views•6 min read
•7 days ago•CVE-2026-9306
6.3

CVE-2026-9306: Unauthenticated Insecure Direct Object Reference (IDOR) in QuantumNous new-api Midjourney Relay

CVE-2026-9306 is a critical unauthenticated Insecure Direct Object Reference (IDOR) vulnerability located in the QuantumNous new-api application, affecting versions up to and including 0.12.1. The flaw is caused by improper middleware ordering combined with a lack of object-level authorization checks. This allows remote, unauthenticated attackers to retrieve sensitive Midjourney images belonging to other users by supplying a valid task identifier.

Amit Schendel
Amit Schendel
13 views•5 min read
•7 days ago•GHSA-GGXF-37HM-9WQF
6.5

GHSA-GGXF-37HM-9WQF: Session Leakage via Unsafe Challenge Path Parsing in instagrapi

The instagrapi library prior to version 2.6.9 contains an improper input validation vulnerability within its challenge handling mechanism. Maliciously crafted server responses can manipulate the client into forwarding session cookies and credentials to an external attacker-controlled domain.

Amit Schendel
Amit Schendel
21 views•6 min read
•8 days ago•GHSA-QQQM-5547-774X
9.1

GHSA-QQQM-5547-774X: Unauthenticated Path Traversal in FileBrowser Quantum PATCH Handler

GHSA-QQQM-5547-774X is a critical path traversal vulnerability in the FileBrowser Quantum application, specifically within the Go backend package. The vulnerability resides in the HTTP handler responsible for processing bulk file modifications via the public API. Unauthenticated attackers can exploit an order-of-operations flaw in the path sanitization logic to bypass intended directory restrictions. This allows adversaries to arbitrarily read, move, and overwrite files on the underlying filesystem by supplying specially crafted HTTP PATCH requests.

Alon Barad
Alon Barad
9 views•6 min read
•8 days ago•CVE-2026-8723
5.3

CVE-2026-8723: Synchronous Denial of Service in qs npm Package via TypeError

The qs query string parsing and serialization library for Node.js is vulnerable to a synchronous Denial of Service (DoS) attack. The vulnerability manifests as a process-terminating TypeError when processing arrays with null or undefined elements under specific configuration parameters.

Amit Schendel
Amit Schendel
37 views•7 min read
•8 days ago•GHSA-7M8F-HGJQ-8GC9
7.5

GHSA-7M8F-HGJQ-8GC9: Pre-Authentication Denial of Service via Insecure Deserialization Order in aiosend

The aiosend library prior to version 3.0.6 contains a pre-authentication Denial of Service (DoS) vulnerability in its webhook handling mechanism. The software processes and deserializes incoming JSON payloads before verifying the cryptographic signature, allowing unauthenticated attackers to exhaust server CPU and memory resources by sending large, complex payloads.

Amit Schendel
Amit Schendel
4 views•6 min read