お名前.comのセキュリティ診断サービスを契約した。
診断結果D判定でした。
ぐあぁぁぁぁ!
さぁ、対処するぞ!
頑張れ!ChatGPT!(課金してるんだからな!)
公開されるべきでない情報が閲覧可能(システム設定情報)
そもそもポート8443が開いているのがおかしい。
iptableを確認。
$ sudo iptables -nL --line-numbers
Chain INPUT (policy DROP)
num target prot opt source destination
:
:
15 ACCEPT 6 -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8443
なのでiptableの15番を削除
$ sudo iptables -D INPUT 15
$ sudo iptables-save
既知の脆弱性が存在するソフトウェアの利用(OpenSSH)
最新バージョンは9.9p2らしい(2025/3/1時点)
https://www.openssh.com/releasenotes.html
ubuntu 24.04.02 LTSのsshの最新バージョンは9.6p1なので、現在の状態でubuntuとしては最新バージョンなんですけど!?
この情報をみたら、CVE-2024-6387は現在のバージョンは対処済みに見えるんですが?
たぶん誤検出でしょう。
いや、バージョンアップしろ!っていう指摘あったら、是非ください。
phpinfo()による設定情報の開示
これは簡単。(でも深刻)
phpinfo()を実行しているphpファイルが存在しているので、それを削除すれば良い。
脆弱な SSH 暗号アルゴリズムのサポート
現在のsshの設定を確認。
$ sudo grep -E 'KexAlgorithms|MACs|Ciphers' /etc/ssh/sshd_config
何も表示されない場合はデフォルト設定なので、以下のコマンドでデフォルト設定の内容を出力
$ ssh -Q kex
diffie-hellman-group1-sha1
diffie-hellman-group14-sha1
diffie-hellman-group14-sha256
diffie-hellman-group16-sha512
diffie-hellman-group18-sha512
diffie-hellman-group-exchange-sha1
diffie-hellman-group-exchange-sha256
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
curve25519-sha256
curve25519-sha256@libssh.org
sntrup761x25519-sha512@openssh.com
$ ssh -Q cipher
3des-cbc
aes128-cbc
aes192-cbc
aes256-cbc
aes128-ctr
aes192-ctr
aes256-ctr
aes128-gcm@openssh.com
aes256-gcm@openssh.com
chacha20-poly1305@openssh.com
$ ssh -Q mac
hmac-sha1
hmac-sha1-96
hmac-sha2-256
hmac-sha2-512
hmac-md5
hmac-md5-96
umac-64@openssh.com
umac-128@openssh.com
hmac-sha1-etm@openssh.com
hmac-sha1-96-etm@openssh.com
hmac-sha2-256-etm@openssh.com
hmac-sha2-512-etm@openssh.com
hmac-md5-etm@openssh.com
hmac-md5-96-etm@openssh.com
umac-64-etm@openssh.com
umac-128-etm@openssh.com
ChatGPTによると、脆弱なアルゴリズムが含まれているので、設定追加が必要とのこと。
SSH設定ファイルを開いて、安全なアルゴリズムを指定する
$ sudo vi /etc/ssh/sshd_config
# 安全な鍵交換アルゴリズム
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,sntrup761x25519-sha512@openssh.com
# 安全な暗号アルゴリズム
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
# 安全なMAC
MACs hmac-sha2-256,hmac-sha2-512,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com
sshを再起動
$ sudo systemctl restart ssh
なんかteratermがこのアルゴリズムに対応していないみたいなんですけど???
バージョンが古いのかな?
とりあえず、Powershellからログインできたからヨシ!