概要
TryHackMe「Slingshot」のWalkthroughです。
Task1
Q1.What was the attacker's IP?
Webサーバーにアクセスするとログイン画面が表示されるので、Username: elastic,Password: raCK0W**BLlW66oNlKAkでログインします。
Elasticというサービスを利用していると分かります。
Analytics->Duscoverページに移動し右上のカレンダーマークから攻撃が観測された2023 年 7 月 26 日に設定します。
そうするとログが見られます。
左のバナーからtransaction.remote_addressをみると10.0.2.15から多くのリクエストが飛んできていると分かります。
A.10.0.2.15
Q2.What was the first scanner that the attacker ran against the web server?
Sort Old-Newでソートします。
スキャンツールはUser-Agentをツール名に設定している場合があります。
左のバナーからrequest.headers.User-Agentを追加してログを見ていくと、Nmapの痕跡を発見しました。
A.Nmap Scripting Engine
Q3.What was the User Agent of the directory enumeration tool that the attacker used on the web server?
そのままログを見ていくとGobusterの痕跡を発見しました。
A.Mozilla/5.0 (Gobuster)
Q4.In total, how many requested resources on the web server did the attacker fail to find?
fail to findなのでレスポンスのステータスコードが404の場合でフィルタリングします。
response.statusから404を追加して数を集計できます。
A.1867
Q5.What is the flag under the interesting directory the attacker found?
レスポンスのステータスコードを200,攻撃者のIPアドレスでフィルタリングしURLを見ていくと、攻撃者がアクセスしたFlagのパスを見つけました。
A.a76637b62ea99acda12f5859313f539a
Q6.What login page did the attacker discover using the directory enumeration tool?
ディレクトリ列挙ツールのGobusterでフィルタリングしてURLを見ていきます。
A./admin-login.php
Q7.What was the user agent of the brute-force tool that the attacker used on the admin panel?
/admin-login.phpが分かったので、このパスでフィルタリングしてUser-Agentをみると使用されたツールが分かります。
A.Mozilla/4.0 (Hydra)
Q8.What username:password combination did the attacker use to gain access to the admin page?
/admin-login.php,Hydraでフィルタリングしresponse.statusコードを見ると200のコードが0.2%あると分かったので、401をNOTイコールでフィルタリングします。
そうすると一件のログがヒットしました。
右のボタンからJSON形式で内容を表示できます。
request.headers.AuthorizationからBase64エンコードされた文字列を発見を発見しました。
デコードするとユーザー名とパスワードの組み合わせを発見できます。
$ echo -n "YWRtaW46dGh4MTEzOA==" | base64 -d
admin:thx1138
A.admin:thx1138
Q9.What flag was included in the file that the attacker uploaded from the admin directory?
上部のフィルタリングフォームにhttp.url : *upload*を入力してuploadに関係するパスでフィルタリングします。
/admin/upload.php?action=uploadを見つけたので一番ひりのボタンから詳細を確認するとrequest.bodyからフラグを確認できました。
A.THM{ecb012e53a58818cbd17a924769ec447}
Q10.What was the first command the attacker ran on the web shell?
ログの内容からcmdパラメータでコマンドを実行していると分かったので、http.url : *cmd*で検索をかけます。
A.whoami
Q11.What file location on the web server did the attacker extract database credentials from using Local File Inclusion?
その他のログから相対パスでファイルを指定していると分かったので、http.url : *../../*で検索をかけます。
A./etc/phpmyadmin/config-db.php
Q12.What directory did the attacker use to access the database manager?
データベースへのアクセスなのでhttp.url : *db*で検索をかけます。
A./phpmyadmin
Q13.What was the name of the database that the attacker exported?
エクスポートしているログを探すのでhttp.url : *export*で検索をかけます。
A.customer_credit_cards
Q14.What flag does the attacker insert into the database?
DBにinsertしているのでhttp.url : *insert*で検索しましたが、ヒットしませんでした。
http.url : *import*で検索すると/phpmyadmin/import.phpを発見しました。
request bodyを抽出します。
sql_queryをURLデコードします。
インサートされた値がわかりました。
A.c6aa3215a7d519eeb40a660f3b76e64c























