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.
Originally disclosed on GitHub Security Lab
The StringSubstitutor default interpolators may lead to unsafe script evaluation and arbitrary code execution
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.