2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

お名前.comのセキュリティ診断サービスを契約したら、また脆弱性が見つかったので、対処する。

Posted at

お名前.comのセキュリティ診断サービスを契約した。

診断結果D判定でした。

image.png

ぐあぁぁぁぁ!

さぁ、対処するぞ!
頑張れ!ChatGPT!(課金してるんだからな!)

公開されるべきでない情報が閲覧可能(システム設定情報)

スクリーンショット 2025-03-01 151659.png

そもそもポート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)

image.png

最新バージョンは9.9p2らしい(2025/3/1時点)
https://www.openssh.com/releasenotes.html

image.png

ubuntu 24.04.02 LTSのsshの最新バージョンは9.6p1なので、現在の状態でubuntuとしては最新バージョンなんですけど!?

image.png

この情報をみたら、CVE-2024-6387は現在のバージョンは対処済みに見えるんですが?

たぶん誤検出でしょう。
いや、バージョンアップしろ!っていう指摘あったら、是非ください。

phpinfo()による設定情報の開示

image.png

これは簡単。(でも深刻)
phpinfo()を実行しているphpファイルが存在しているので、それを削除すれば良い。

脆弱な SSH 暗号アルゴリズムのサポート

image.png

現在の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からログインできたからヨシ!

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?