Headline
GHSA-pp9m-qf39-hxjc: S3-Proxy allows Reflected Cross-site Scripting (XSS) in template implementation
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 moderate 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.
Navigate to
https://your-s3-proxy.com/path-not-found
and confirm the page looks as follows:Try inserting an HTML element by changing
/path-not-found
to/<img src="x">
and confirm the page looks as follows:Now it should be possible to run any JavaScript by manipulating the
onerror
property of the img element. This should make the link look likehttps://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 moderate risk to all users who visit such URLs.
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 moderate 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.
Navigate to https://your-s3-proxy.com/path-not-found and confirm the page looks as follows:
Try inserting an HTML element by changing /path-not-found to /<img src="x"> and confirm the page looks as follows:
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 moderate risk to all users who visit such URLs.
References
- GHSA-pp9m-qf39-hxjc
- oxyno-zeta/s3-proxy@c611c74
- https://github.com/oxyno-zeta/s3-proxy/releases/tag/v4.18.1