Skip to content
RCE Write-up Intermediate

iTop – Template Injection inside customer Portal

An authenticated portal user could change the form layout type from xhtml to twig and inject Twig expressions into the form content, leading to server-side template injection. This allowed the attacker to execute operating system commands on the server.

Markus Krell Follow

Published on markus-krell.de

iTop is an open-source web application and stands for “IT Operations Portal”. According to the company it is an ITIL, web-based service management tool including a fully customizable CMDB, a helpdesk system and a document management tool.

Markus Krell (@MarkusKrell), on markus-krell.de

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 server accepted a user-controlled layout type and content and rendered it with Twig without sanitising the template expressions.

What the attacker needed

An authenticated portal account

The fix

The issue was fixed in version 2.7.6.

How it was found

  1. Log in as a portal user and open the customer account profile page.
  2. Submit a profile edit and intercept the POST request containing formmanager_data.
  3. Change the layout type from xhtml to twig in formmanager_data.
  4. Insert a Twig expression into the data-field-id attribute inside the content.
  5. Send the request and observe command output in the error log.

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 application lets users customise how their profile form looks by sending a layout description. The server used a template engine called Twig to render that layout, and the user could put Twig code inside it. Because the server ran that code, the user could make the server run system commands.

What is RCE?

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

More by Markus Krell

View all

2 more disclosed reports, best first.

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.