HAKATEMIA
02Modules

PDF export injection - using JavaScript

Easy20MIN

Sometimes PDF generators even allow the execution of JavaScript code. If it is possible to fetch server-side files and execute JavaScript code, we can steal files using JavaScript.

Do the exercise below and try to read the file /etc/passwd from the server through the PDF generator. The file contains a flag. The task is solved in the material below the lab, but try it on your own first.

Vulnerability Assessment

We start by searching for a vulnerability. The website is relatively simple in its functionality, so we can input data into four different fields, after which we can generate a PDF file from this "profile" that includes the value of each field. After a few attempts, it becomes clear that only the comment field is not cleaned before generation. The rest of the fields are filtered so that they form HTML-encoded data. The name field, on the other hand, does not allow any HTML code at all.

1 / 3
Hakatemia Pro

Learn to hack — start here

Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.