Skip to content
RCE Write-up Intermediate

text4shell Poc Cve 2022 42889

The Apache Commons Text library versions 1.5 to 1.9 allow remote code execution when an application processes untrusted input containing a string interpolation pattern. An attacker could execute arbitrary commands on the server.

Nol White Hat Follow

Published on infosecwriteups.com

In this PoC, we will use a Dockerized test application “text4shell-poc.jar”. This test application was created by U J Karthik, an ethical hacker / developer from Delhi (https://github.com/karthikuj).

Nol White Hat, on infosecwriteups.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

Impact

An attacker could execute arbitrary code on the server, potentially leading to full system compromise.

What the attacker needed

Application uses Apache Commons Text 1.5-1.9; Application passes untrusted input to the library; Network access to the vulnerable endpoint

The fix

Upgrade Apache Commons Text to version 1.10 or later.

How it was found

  1. Install OpenJDK, Maven, and Docker on the victim machine.
  2. Download and build the PoC application using Maven.
  3. Build and run the Docker container for the vulnerable application.
  4. Test the application by sending a benign search parameter.
  5. Send a crafted search parameter containing a string interpolation pattern to execute a command.
  6. Verify command execution by checking for a created file inside the container.

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.

This bug is in a Java library that many programs use to handle text. If a program passes user input to this library without checking it, an attacker can sneak in a special code that makes the server run commands. That means the attacker can take 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 Nol White Hat

View all

8 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.