POC详情: 70724a81ca2b7592be97f4f4536de4dd70c5541a

来源
关联漏洞
标题: Apache Commons Text 代码注入漏洞 (CVE-2022-42889)
描述:Apache Commons Text是美国阿帕奇(Apache)基金会的一个专注于字符串算法的库。 Apache Commons Text 1.5至1.9版本存在安全漏洞,该漏洞源于默认的Lookup实例集包括可能导致任意代码执行或与远程服务器联系的插值器,可能容易受到远程代码执行或与远程服务器的无意接触的影响。
描述
This repository contains a Python script to automate the process of testing for a vulnerability known as Text4Shell, referenced under the CVE id: CVE-2022-42889.  
介绍
# CVE-2022-42889 (Text4Shell) Testing Script

This repository contains a Python script to automate the process of testing for a vulnerability known as Text4Shell, referenced under the CVE id: CVE-2022-42889.  

## About Text4Shell (CVE-2022-42889)  

Text4Shell is a critical vulnerability that affects a wide range of systems. The vulnerability lies in the way these systems parse text strings and allows for the execution of arbitrary code or SSRF attacks.  The vulnerability is exploited through crafted strings, where either JavaScript code is executed (leading to Remote Code Execution (RCE)) or URLs are fetched (leading to Server-Side Request Forgery (SSRF)).  

From [Tarlogic](https://www.tarlogic.com/blog/cve-2022-42889-text4shell-vulnerability/):

- **Exploitation requirements**:
- The application accepts user-controlled input that is subsequently processed by one of the following methods of the affected component:

	- StringLookupFactory.INSTANCE.interpolatorStringLookup().lookup()
	- StringSubstitutor.createInterpolator().replace()

- Java versions equal or greater than Java 15 would not be susceptible to remote code execution, since the Nashorn engine is disabled and the “script” prefix would not be available. However, other attacks via the “url” and “dns” prefixes would be possible.

## Script Usage  

This Python script helps in testing the presence of the Text4Shell vulnerability in a system. The scope of this script includes: testing of script and url prefixes.

The script has two modes of operation: RCE and SSRF, controlled by the `-m` or `--mode` command-line argument. It constructs a URL incorporating a crafted string based on the selected mode and makes a GET request to the URL.  

### RCE Mode  

In RCE mode, the script creates a crafted string that attempts to execute a JavaScript command. The command to be executed is passed as a command-line argument using `-c` or `--command`.  

```bash
python text4shell.py -u 'http://example.com/search?query=' -c 'your_command' -m 'rce'
```

### SSRF Mode

In SSRF mode, the script creates a crafted string that includes a URL fetch command.

```bash
python text4shell.py -u 'http://example.com/search?query=' -m 'ssrf' -s 'http://example.com/resource'
```

### Response

The script makes a GET request to the constructed URL and prints the HTTP response status code and body.
文件快照

[4.0K] /data/pocs/70724a81ca2b7592be97f4f4536de4dd70c5541a ├── [2.3K] README.md └── [1.5K] text4shell.py 0 directories, 2 files
神龙机器人已为您缓存
备注
    1. 建议优先通过来源进行访问。
    2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
    3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。