Road to SSRF : PDF generation and filter bypass on ASP.net application
The application's PDF export feature rendered user-controlled profile fields without proper sanitisation, and a security filter blocked common HTML tags. By encoding payloads in full-width Unicode characters, the filter was bypassed and the server-side PDF renderer executed injected HTML, allowing the attacker to read local files and internal network resources.
Toggle
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 PDF generation component embedded user input into HTML without proper output encoding, and the input filter only checked for standard ASCII characters, missing full-width Unicode equivalents that the parser later normalised.
Impact
The attacker could read local files, enumerate directories, access network shares, and steal NTLMv2 hashes, potentially leading to further compromise.
What the attacker needed
Access to profile editing; PDF export feature
How it was found
- Identify the PDF export feature that includes profile fields.
- Test basic HTML injection like bold tags and observe a 500 error from the security filter.
- Encode the payload using full-width Unicode characters to bypass the filter.
- Confirm the payload is normalised and executed in the generated PDF.
- Use an iframe to trigger a callback to an external server.
- Use iframe with file:// URLs to read local files and list directories.
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.
When a website creates a PDF from your profile, it may insert your text into a web page before converting it. If that text is not cleaned, you can add HTML tags that make the PDF generator fetch other files or web addresses. Here, a filter tried to block such tags, but using special wide characters (like full-width '<') slipped past the filter and the server converted them back to normal characters.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.