Skip to content
RCE Advisory Advanced

GHSL-2020-066: Server-Side Template Injection (SSTI) leading to Remote Code Execution (RCE) in Apache OfBiz

Apache OfBiz was vulnerable to server-side template injection in the renderSortField function, allowing an authenticated attacker to execute arbitrary commands on the server. The flaw arose because a previous fix was incomplete and later partially removed.

Alvaro Muñoz Follow

Originally disclosed on GitHub Security Lab

Apache OfBiz is vulnerable to Server-Side Template Injection (SSTI) leading to Remote Code Execution (RCE)

pwntester, on GitHub Security Lab

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 report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the incomplete escaping of user input in the renderSortField function allowed breaking out of a FreeMarker string context and injecting template code.

Impact

An authenticated attacker could execute arbitrary commands on the server, leading to remote code execution.

What the attacker needed

Authenticated user with access to sortable fields

The fix

The issue was addressed in version 17.12.05.

How it was found

  1. Log in to the backend application with sufficient permissions.
  2. Craft a URL to the FindRequest endpoint with a malicious 'foo' parameter containing FreeMarker code.
  3. Visit the URL; the injected code executes and its output appears alongside sortable fields.

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 report has not been written yet. The Original tab links to the source.

Server-side template injection happens when user input is inserted into a template that the server processes, and the input can contain template code. Here, an attacker could craft a URL that made the server run system commands, like 'id', and show the output on the page. This requires being logged in with certain permissions.

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 Alvaro Muñoz

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

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.