Skip to content
RCE Advisory Intermediate CVE-2022-42889

GHSL-2022-018: Arbitrary Code Execution in Apache Commons Text - CVE-2022-42889

The default interpolators in Apache Commons Text's StringSubstitutor allow unsafe script evaluation, so if untrusted data reaches the replace or replaceIn methods, an attacker can execute arbitrary code. This may lead to remote code execution.

Alvaro Muñoz Follow

Originally disclosed on GitHub Security Lab

The StringSubstitutor default interpolators may lead to unsafe script evaluation and arbitrary code execution

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

Impact

This issue may lead to Remote Code Execution (RCE).

What the attacker needed

Untrusted input reaches replace or replaceIn; application uses default interpolators

The fix

Apache Commons Text version 1.10.0 was released with script interpolation disabled by default.

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.

Apache Commons Text is a Java library that helps replace placeholders in strings. Its default settings included a feature that could run scripts, so if a program passed user input into it, an attacker could make the server run commands. This is dangerous because it can lead to full control of the server.

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.