Skip to content

S3-Proxy allows Reflected Cross-site Scripting (XSS) in template implementation

High severity GitHub Reviewed Published Feb 20, 2025 in oxyno-zeta/s3-proxy • Updated Feb 21, 2025

Package

gomod github.com/oxyno-zeta/s3-proxy/cmd/s3-proxy (Go)

Affected versions

<= 0.0.0-20250212215955-2873011f7c42

Patched versions

0.0.0-20250220214310-c611c741ed48

Description

Summary

A Reflected Cross-site Scripting (XSS) vulnerability enables attackers to create malicious URLs that, when visited, inject scripts into the web application. This can lead to session hijacking or phishing attacks on a trusted domain, posing a high risk to all users.

Details

Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer.
It's possible to inject html elements, including scripts through the folder-list template. It seems like the .Request.URL.Path variable is not escaped.

I did some research and found it might be due to the text/template import being used in the template implementation, instead of the safer html/template.

PoC

Complete instructions, including specific configuration details, to reproduce the vulnerability.
Using the default template configuration, the vulnerability can be reproduced with the following steps.

  1. Navigate to https://your-s3-proxy.com/path-not-found and confirm the page looks as follows:
    image

  2. Try inserting an HTML element by changing /path-not-found to /<img src="x"> and confirm the page looks as follows:
    image

  3. Now it should be possible to run any JavaScript by manipulating the onerror property of the img element. This should make the link look like https://your-s3-proxy.com/<img src="x" onerror="alert(1)">. Confirm that going to this URL will in fact shows an alert in the browser.

Impact

The affected template allows users to interact with the URL path provided by the Request.URL.Path variable, which is then rendered directly into the HTML without proper sanitization or escaping. This can be abused by attackers who craft a malicious URL containing injected HTML or JavaScript. When users visit such a URL, the malicious script will be executed in the user's context, leading to potential risks such as:

  • Session Hijacking: Malicious scripts could be used to steal session cookies or other sensitive information.
  • Phishing Attacks: JavaScript could be injected to trick users into submitting sensitive information, such as login credentials.

This vulnerability can be exploited by attackers who craft URLs containing malicious payloads, which would then execute in the user's browser when they access the affected page. This poses a high risk to all users who visit such URLs.

References

@oxyno-zeta oxyno-zeta published to oxyno-zeta/s3-proxy Feb 20, 2025
Published to the GitHub Advisory Database Feb 20, 2025
Reviewed Feb 20, 2025
Published by the National Vulnerability Database Feb 20, 2025
Last updated Feb 21, 2025

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v4 base metrics

Exploitability Metrics
Attack Vector Network
Attack Complexity Low
Attack Requirements None
Privileges Required None
User interaction Passive
Vulnerable System Impact Metrics
Confidentiality High
Integrity None
Availability None
Subsequent System Impact Metrics
Confidentiality High
Integrity High
Availability None

CVSS v4 base metrics

Exploitability Metrics
Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity.
Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system.
Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system.
Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack.
User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner.
Vulnerable System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
Subsequent System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:N/VA:N/SC:H/SI:H/SA:N

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(18th percentile)

Weaknesses

CVE ID

CVE-2025-27088

GHSA ID

GHSA-pp9m-qf39-hxjc

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.