Skip to content
RCE Write-up Beginner

Template Injection in PDF Certificate

A user's username was rendered into a generated PDF certificate through a server-side template without sanitisation, so template expressions in the name were evaluated. An attacker could run operating system commands on the server and read files such as the password file and the flag.

medium.com

Published on medium.com

This challenge is from the HackTheBox CTF “Hack The System — Bug Bounty CTF” held on June 29, 2025. The name of the challenge is JijaCare, and it is categorized as having very easy difficulty.

Hemant Kumar, on medium.com

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 certificate generator passed the user-controlled username into a Jinja2 template and rendered it, instead of treating it as plain data.

Impact

An attacker with an account could execute arbitrary commands on the server and read any file the service could access, including the flag.

What the attacker needed

A free account; ability to change the username

How it was found

  1. Sign in and open the dashboard that offers the certificate download.
  2. Change the username to a template expression that evaluates to a number.
  3. Download the certificate and confirm the number appears in place of the name.
  4. List the available Python subclasses to find the index of the command-running class.
  5. Correct the index after an error and run a command to read the password file.
  6. Run a command to read the flag file.

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.

The site builds a PDF certificate by filling a template with your profile details, such as your name. It put the name into the template as if it were part of the template's own instructions, so a name containing special template code got executed by the server instead of just printed. That let the author run commands on the server and read its files.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.