포스트

CVE-2023-48795 취약점 조치 방법

리눅스에 CVE-2023-48795 취약점이 알려져 조치방법에 대해 작성한 글입니다.

References

CVE-2023-48795

CVE-2023-48795 취약점은 OpenSSH 패키지에서 발생한 Moderate 보안 취약점 이슈로 심각한 정도의 취약점은 아니지만 어느정도 조치가 필요한 수준의 취약점입니다. 다음의 다섯 가지 암호화 모드에 문제가 있는 것으로 알려져있으며, 해당 암호화 모드를 사용하여 handshake가 이루어지는 경우 무결성 검사를 우회하여 OpenSSH를 비활성화하는 공격을 하는 등의 위험에 노출될 수 있습니다.

  • chacha20-poly1305@openssh.com
  • hmac-sha2-512-etm@openssh.com
  • hmac-sha2-256-etm@openssh.com
  • hmac-sha1-etm@openssh.com
  • hmac-md5-etm@openssh.com

해당 범위

CVE-2023-48795 취약점은 OpenSSH 패키지를 사용중이고, 위에 작성된 다섯가지의 암호화 모드가 포함된 Ciphers, MACs를 사용중인 서버 장비인 경우 취약점 조치 필요대상입니다. OpenSSH 패키지가 설치되어있는 경우 아래 명령어를 입력하여 사용중인 암호화 모드를 확인할 수 있습니다.

  • sshd -T | egrep -i "cipher|macs"
    1
    2
    3
    
    ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
    macs umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
         hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
    

    위와 같이 출력되는 경우에는 조치가 필요한 장비라고 볼 수 있겠습니다.

RHEL의 경우 RHEL 7, RHEL 8 버전을 사용중인 경우 해당 취약점 조치가 필요한 대상이며, RHEL 6 버전은 해당되지 않습니다.(위 암호화 모드를 사용하지않음)

(RHEL 6) man sshd_config

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  Ciphers
    Specifies the ciphers allowed for protocol version 2.  Multiple ciphers must be comma-separated.  
    The supported ciphers are “3des-cbc”, “aes128-cbc”, “aes192-cbc”, “aes256-cbc”, “aes128-ctr”, 
    “aes192-ctr”, “aes256-ctr”, “arcfour128”, “arcfour256”,“arcfour”, “blowfish-cbc”, 
    rijndael-cbc@lysator.liu.se, and “cast128-cbc”.  The default is:

    aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,
    aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,
    aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se

  MACs     
    Specifies the available MAC (message authentication code) algorithms.  
    The MAC algorithm is used in protocol version 2 for data integrity protection.  
    Multiple algorithms must be comma-separated.  The default is:

    hmac-md5,hmac-sha1,umac-64@openssh.com,
    hmac-ripemd160,hmac-sha1-96,hmac-md5-96,
    hmac-sha2-256,hmac-sha2-512,hmac-ripemd160@openssh.com

조치 방법

가장 확실한 방법은 OpenSSH 패키지를 최신버전으로 유지하는 방법입니다. 오픈소스, 혹은 벤더사 리눅스를 사용하는 경우 최신 버전의 패키지를 다운받아 업데이트 하는 것이 가장 확실한 방법이지만, 패키지 업그레이드가 어려운 환경의 경우 아래의 방법을 사용하여 완화조치를 수행할 수 있습니다.

  1. 먼저 /etc/ssh/ssh_config /etc/ssh/sshd_config 파일을 백업합니다.
    • cp /etc/ssh/ssh_config /tmp/ssh_config_bak
    • cp /etc/ssh/sshd_config /tmp/sshd_config_bak
  2. /etc/ssh/ssh_config /etc/ssh/sshd_config 파일에 Strict Cipher, MACs를 적용합니다. 보안 취약점에 해당되지않는 암호화 모드만 적용합니다.
    • echo Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com >> /etc/ssh/ssh_config
    • echo MACs umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512 >> /etc/ssh/ssh_config
    • echo Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com >> /etc/ssh/sshd_config
    • echo MACs umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512 >> /etc/ssh/sshd_config
  3. sshd 데몬을 재시작합니다.
    • systemctl restart sshd
  4. Ciphers, MACs가 적용되었는지 확인합니다.
    • sshd -T | egrep -i "cipher|macs"
      1
      2
      
      ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
      macs umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512
      

요즘 구성되는 서버 장비는 OpenSSH가 거의 필수로 사용되는 패키지이기 때문에 보안 취약점이 발생하는데에 민감할 수 밖에 없습니다. Moderate 등급의 취약점이긴하지만 대부분의 서버에 적용되는 패키지인만큼 신경써서 조치를 해주는 것이 좋겠습니다.

이 포스트는 저작권자의 CC BY 4.0 라이센스를 따릅니다.