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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2022-42889 PoC — Apache Commons Text 代码注入漏洞

Source
Associated Vulnerability
Title:Apache Commons Text 代码注入漏洞 (CVE-2022-42889)
Description:Apache Commons Text是美国阿帕奇(Apache)基金会的一个专注于字符串算法的库。 Apache Commons Text 1.5至1.9版本存在安全漏洞,该漏洞源于默认的Lookup实例集包括可能导致任意代码执行或与远程服务器联系的插值器,可能容易受到远程代码执行或与远程服务器的无意接触的影响。
Description
ClusterImagePolicy demo for cve-2022-42889 text4shell  
Readme
# Text4Shell Demo
This demo shows how you can use Sigstore to validate your signed SBOMs against text4shell policies in Kubernetes or on the command line

## Option 1: Check if your remote OCI image is affected using cue with cosign 2.0
```
cosign verify-attestation --policy policy/text4shell.cue --type https://cyclonedx.org/bom --certificate-identity-regexp=.* --certificate-oidc-issuer-regexp=.* ghcr.io/chainguard-dev/text4shell-policy:main
```

## Option 2: Check using Enforce for Kubernetes with image built from this repo
```
chainctl policies create --group $DEMO_GROUP -f policy/text4shell-policy.yaml
kubectl label ns default policy.sigstore.dev/include=true --overwrite
kubectl run text4shell --image=ghcr.io/chainguard-dev/text4shell-policy:main
```
![text4shell diagnostic](https://user-images.githubusercontent.com/9351962/196332575-2ac25720-0262-4768-8854-615fb6f3c686.png)

### Clean Up
```
kubectl delete pod text4shell --grace-period=0
chainctl policy delete -y $(chainctl policy list -o json | jq -r '[.items[] | select(.name == "vuln-cve-2022-42889-text4shell")][0].id')
kubectl label ns default policy.sigstore.dev/include-
```
File Snapshot

[4.0K] /data/pocs/2cad68456c86436001c1f3bcbffd225b86bac3ab ├── [ 230] Dockerfile ├── [ 11K] LICENSE ├── [4.0K] policy │   ├── [ 473] text4shell.cue │   └── [1.0K] text4shell-policy.yaml ├── [4.5K] pom.xml ├── [1.1K] README.md ├── [ 730] slsa.csv ├── [4.0K] src │   └── [4.0K] main │   └── [4.0K] java │   └── [1.2K] Text4Shell.java └── [4.0K] target ├── [ 24K] bom.json ├── [ 20K] bom.xml ├── [4.0K] classes │   └── [2.0K] Text4Shell.class ├── [4.0K] lib │   ├── [241K] commons-beanutils-1.9.4.jar │   ├── [575K] commons-collections-3.2.2.jar │   ├── [734K] commons-collections4-4.4.jar │   ├── [319K] commons-io-2.11.0.jar │   ├── [574K] commons-lang3-3.12.0.jar │   ├── [ 60K] commons-logging-1.2.jar │   ├── [211K] commons-text-1.9.jar │   └── [233K] opencsv-5.7.0.jar ├── [4.0K] maven-archiver │   └── [ 68] pom.properties ├── [4.0K] maven-status │   └── [4.0K] maven-compiler-plugin │   └── [4.0K] compile │   └── [4.0K] default-compile │   ├── [ 17] createdFiles.lst │   └── [ 94] inputFiles.lst └── [3.4K] text4shell-1.0.0-SNAPSHOT.jar 12 directories, 23 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.