Should ssh-audit Scan for User Key Algorithms?

Đang mở
#128 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 17 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
security

Hướng nghiên cứu

Start by reading the SSH authentication protocol details to determine whether user key signature algorithms can be discovered during an audit; the issue names no project files or tests. The examples show that host key algorithms do not establish which algorithms user authentication uses. Done would mean determining whether ssh-audit can reliably scan these algorithms and what information it can report.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I was recently working on a project where GoAnywhere Managed File Transfer was used as an SFTP file transfer client. I noticed a feature that I've never seen in a file transfer client before which is the ability to configure the RSA Key Signature Algorithm that's used when authentication is performed with an RSA key pair (instead of a password).

This got me thinking about something...

The algorithm that's used in conjunction with a host key is not necessarily the same as the algorithm that's used in conjunction with a user key (for authentication). So for example, on an OpenSSH server instance you may have disabled ssh-rsa being used in conjunction with host keys but it can probably still be used in conjunction with user keys.

The question I'm uncertain about is from a security perspective is should we care which algorithms can potentially be used by a client or server in conjunction with user keys? If we should care about this then is it possible for ssh-audit to scan for this?

My understanding is that host key algorithms are easy to identify because they're advertised as part of the Key Exchange Initalization (SSH_MSG_KEXINIT). But I'm uncertain whether the algorithms used in conjunction with user keys are so easily identifiable?

See examples below demonstrating the effect of changing the RSA Key Signature Algorithm value in GoAnywhere Managed File Transfer:

EXAMPLES

Example 1: OpenSSH 8.2p1 on Ubuntu 20.04 LTS using WSL2

To prove that the host key algorithms have no influence on the the algorithms used in conjunction with a user key, the only enabled host key algorithm on both the client and the server was ecdsa-sha2-nistp256, see ssh-audit excerpts below:

--------------------------------------------------------------------------------
Client
======

# host-key algorithms
(key) ecdsa-sha2-nistp256                   -- [fail] using weak elliptic curves
                                            `- [warn] using weak random number generator could reveal the key
                                            `- [info] available since OpenSSH 5.7, Dropbear SSH 2013.62
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Server
======

# host-key algorithms
(key) ecdsa-sha2-nistp256                   -- [fail] using weak elliptic curves
                                            `- [warn] using weak random number generator could reveal the key
                                            `- [info] available since OpenSSH 5.7, Dropbear SSH 2013.62
--------------------------------------------------------------------------------

I performed the following tests where you can see the influence that GoAnywhere's 'RSA Key Signature Algorithm' setting has in the logs produced by OpenSSH.

(NB: OpenSSH server's LogLevel was set to DEBUG3 in /etc/ssh/sshd_config)

Test 1: 'RSA Key Signature Algorithm' in GoAnywhere set to 'ssh-rsa'
thecliguy@SANDBOX:~$ sudo tail -f /var/log/auth.log | grep userauth_pubkey
Nov  2 20:58:16 SANDBOX sshd[1423]: debug2: userauth_pubkey: valid user thecliguy querying public key ssh-rsa REDACTED [preauth]
Nov  2 20:58:16 SANDBOX sshd[1423]: debug1: userauth_pubkey: test pkalg ssh-rsa pkblob RSA SHA256:REDACTED [preauth]
Nov  2 20:58:16 SANDBOX sshd[1423]: debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa [preauth]
Nov  2 20:58:16 SANDBOX sshd[1423]: debug2: userauth_pubkey: valid user thecliguy attempting public key ssh-rsa REDACTED [preauth]
Nov  2 20:58:16 SANDBOX sshd[1423]: debug3: userauth_pubkey: have ssh-rsa signature for RSA SHA256:REDACTED [preauth]
Nov  2 20:58:16 SANDBOX sshd[1423]: debug2: userauth_pubkey: authenticated 1 pkalg ssh-rsa [preauth]
Test 2: 'RSA Key Signature Algorithm' in GoAnywhere set to 'rsa-sha2-256'
thecliguy@SANDBOX:~$ sudo tail -f /var/log/auth.log | grep userauth_pubkey
Nov  2 20:58:47 SANDBOX sshd[1504]: debug2: userauth_pubkey: valid user thecliguy querying public key rsa-sha2-256 REDACTED [preauth]
Nov  2 20:58:47 SANDBOX sshd[1504]: debug1: userauth_pubkey: test pkalg rsa-sha2-256 pkblob RSA SHA256:REDACTED [preauth]
Nov  2 20:58:47 SANDBOX sshd[1504]: debug2: userauth_pubkey: authenticated 0 pkalg rsa-sha2-256 [preauth]
Nov  2 20:58:47 SANDBOX sshd[1504]: debug2: userauth_pubkey: valid user thecliguy attempting public key rsa-sha2-256 REDACTED [preauth]
Nov  2 20:58:47 SANDBOX sshd[1504]: debug3: userauth_pubkey: have rsa-sha2-256 signature for RSA SHA256:REDACTED [preauth]
Nov  2 20:58:47 SANDBOX sshd[1504]: debug2: userauth_pubkey: authenticated 1 pkalg rsa-sha2-256 [preauth]
Test 3: 'RSA Key Signature Algorithm' in GoAnywhere set to 'rsa-sha2-512'
thecliguy@SANDBOX:~$ sudo tail -f /var/log/auth.log | grep userauth_pubkey
Nov  2 20:59:34 SANDBOX sshd[1619]: debug2: userauth_pubkey: valid user thecliguy querying public key rsa-sha2-512 REDACTED [preauth]
Nov  2 20:59:34 SANDBOX sshd[1619]: debug1: userauth_pubkey: test pkalg rsa-sha2-512 pkblob RSA SHA256:REDACTED [preauth]
Nov  2 20:59:34 SANDBOX sshd[1619]: debug2: userauth_pubkey: authenticated 0 pkalg rsa-sha2-512 [preauth]
Nov  2 20:59:34 SANDBOX sshd[1619]: debug2: userauth_pubkey: valid user thecliguy attempting public key rsa-sha2-512 REDACTED [preauth]
Nov  2 20:59:34 SANDBOX sshd[1619]: debug3: userauth_pubkey: have rsa-sha2-512 signature for RSA SHA256:REDACTED [preauth]
Nov  2 20:59:34 SANDBOX sshd[1619]: debug2: userauth_pubkey: authenticated 1 pkalg rsa-sha2-512 [preauth]

Example 2: CompleteFTP on Windows 10

To prove that the host key algorithms have no influence on the the algorithms used in conjunction with a user key, the only enabled host key algorithm on both the client and the server was ecdsa-sha2-nistp256, see ssh-audit excerpts below:

--------------------------------------------------------------------------------
# Client

# host-key algorithms
(key) ecdsa-sha2-nistp256                   -- [fail] using weak elliptic curves
                                            `- [warn] using weak random number generator could reveal the key
                                            `- [info] available since OpenSSH 5.7, Dropbear SSH 2013.62
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
# Server

# host-key algorithms
(key) ecdsa-sha2-nistp256                   -- [fail] using weak elliptic curves
                                            `- [warn] using weak random number generator could reveal the key
                                            `- [info] available since OpenSSH 5.7, Dropbear SSH 2013.62
--------------------------------------------------------------------------------

I performed the following tests where you can see the influence that GoAnywhere's 'RSA Key Signature Algorithm' setting has in the Diagnostics.log produced by CompleteFTP. It appears as though CompleteFTP only supports ssh-rsa therefore using 'rsa-sha2-256' and 'rsa-sha2-512' fail.

(NB: CompleteFTP's sever logging level was set to All)

Test 1: 'RSA Key Signature Algorithm' in GoAnywhere set to 'ssh-rsa'
2021-11-02 21:06:25,607 DEBUG SSHAuthService [Session.37:Default Site.5022:user?:127.0.0.1] ProcessPacket pt=SSH_MSG_USERAUTH_REQUEST 
2021-11-02 21:06:25,607 DEBUG SSHAuthService [Session.37:Default Site.5022:user?:127.0.0.1] Auth request - user=thecliguy, service=ssh-connection, method=publickey 
2021-11-02 21:06:25,607 DEBUG UserManager [Session.37:Default Site.5022:user?:127.0.0.1] GetSpecifiedUser: user=thecliguy 
2021-11-02 21:06:25,607 DEBUG UserManager [Session.37:Default Site.5022:user?:127.0.0.1] GetUserByID: user=fghsdfgb-34te-46fg-n3df-45dfg56dfdfg 
2021-11-02 21:06:25,607 DEBUG UserManager [Session.37:Default Site.5022:user?:127.0.0.1] Retrieved user from cache: fghsdfgb-34te-46fg-n3df-45dfg56dfdfg 
2021-11-02 21:06:25,607 DEBUG UserSession [Session.37:Default Site.5022:thecliguy:127.0.0.1] Session user set to 'thecliguy' 
2021-11-02 21:06:25,607 DEBUG PublicKeyAuthentication [Session.37:Default Site.5022:thecliguy:127.0.0.1] Client sent RSA public key
Test 2: 'RSA Key Signature Algorithm' in GoAnywhere set to 'rsa-sha2-256'
2021-11-02 21:09:39,960 DEBUG SSHAuthService [Session.39:Default Site.5022:user?:127.0.0.1] ProcessPacket pt=SSH_MSG_USERAUTH_REQUEST 
2021-11-02 21:09:39,960 DEBUG SSHAuthService [Session.39:Default Site.5022:user?:127.0.0.1] Auth request - user=thecliguy, service=ssh-connection, method=publickey 
2021-11-02 21:09:39,960 DEBUG UserManager [Session.39:Default Site.5022:user?:127.0.0.1] GetSpecifiedUser: user=thecliguy 
2021-11-02 21:09:39,960 DEBUG UserManager [Session.39:Default Site.5022:user?:127.0.0.1] GetUserByID: user=fghsdfgb-34te-46fg-n3df-45dfg56dfdfg 
2021-11-02 21:09:39,960 DEBUG UserManager [Session.39:Default Site.5022:user?:127.0.0.1] Retrieved user from cache: fghsdfgb-34te-46fg-n3df-45dfg56dfdfg 
2021-11-02 21:09:39,960 DEBUG UserSession [Session.39:Default Site.5022:thecliguy:127.0.0.1] Session user set to 'thecliguy' 
2021-11-02 21:09:39,960 WARN PublicKeyAuthentication [Session.39:Default Site.5022:thecliguy:127.0.0.1] Unknown public key algorithm rsa-sha2-256 
Test 3: 'RSA Key Signature Algorithm' in GoAnywhere set to 'rsa-sha2-512'
2021-11-02 21:12:46,215 DEBUG SSHAuthService [Session.41:Default Site.5022:user?:127.0.0.1] ProcessPacket pt=SSH_MSG_USERAUTH_REQUEST 
2021-11-02 21:12:46,215 DEBUG SSHAuthService [Session.41:Default Site.5022:user?:127.0.0.1] Auth request - user=thecliguy, service=ssh-connection, method=publickey 
2021-11-02 21:12:46,215 DEBUG UserManager [Session.41:Default Site.5022:user?:127.0.0.1] GetSpecifiedUser: user=thecliguy 
2021-11-02 21:12:46,215 DEBUG UserManager [Session.41:Default Site.5022:user?:127.0.0.1] GetUserByID: user=fghsdfgb-34te-46fg-n3df-45dfg56dfdfg 
2021-11-02 21:12:46,215 DEBUG UserManager [Session.41:Default Site.5022:user?:127.0.0.1] Retrieved user from cache: fghsdfgb-34te-46fg-n3df-45dfg56dfdfg 
2021-11-02 21:12:46,215 DEBUG UserSession [Session.41:Default Site.5022:thecliguy:127.0.0.1] Session user set to 'thecliguy' 
2021-11-02 21:12:46,215 WARN PublicKeyAuthentication [Session.41:Default Site.5022:thecliguy:127.0.0.1] Unknown public key algorithm rsa-sha2-512 
Ngôn ngữ chính
Python
Star
4.3k
Fork
233
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của jtesta/ssh-audit

Tất cả issue của jtesta/ssh-audit

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.