Non-Root-Relative Path Overwrite (RPO) in IIS and .Net applications
ASP.NET Web Forms pages that use non-root-relative paths for stylesheets or scripts can be tricked into loading the page itself as a resource by appending path segments after the .aspx extension. An attacker could inject CSS or, in some cases, JavaScript into the page, leading to content spoofing or cross-site scripting.
soroush.me
Published on soroush.me
In this blog post, I will show you a better way to exploit non-root-relative path overwrite issues in ASP.NET Web Form applications. This is a low risk vulnerability that can be used to inject a resource such as a stylesheet or even a dynamic JavaScript into an affected web page.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application uses non-root-relative paths for resources, and the web server resolves path-info after the file extension in a way that allows the page to be loaded as a resource.
Impact
An attacker could inject CSS to alter the page's appearance or, in some cases, inject JavaScript leading to cross-site scripting, though the impact is limited and may depend on the .NET Framework version and browser quirks.
What the attacker needed
ASP.NET Web Forms application; Non-root-relative resource paths; Victim visits a crafted URL
The fix
Use root-relative paths (starting with a slash) for all resources, or ensure that the application does not allow path-info after the file extension to affect resource resolution.
How it was found
- Identify an ASP.NET page that includes a stylesheet or script using a non-root-relative path.
- Append extra path segments after the .aspx extension in the URL.
- Include a crafted input parameter that injects CSS or JavaScript into the page output.
- Load the modified URL in a browser to see the injected resource applied.
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 write-up has not been written yet. The Original tab links to the source.
Some web pages load files like stylesheets or scripts using a relative path, meaning the browser looks for them in the same folder as the current page. If an attacker adds extra slashes and text to the URL, the browser may end up loading the page itself as that file. Because the attacker can control part of the page content, they can make the page display their own styles or even run their own code.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.