본문 바로가기
인프라 진단/전자금융기반시설(서버) - Linux

SRV-026 root 계정 원격 접속 제한 미비

by 49 BLOCK 2024. 1. 1.

notice

SRV-026 root 계정 원격 접속 제한 미비

【 상세설명 】
시스템 관리를 위한 root 계정의 원격 접속 허용은 악의적인 사용자가 무작위 대입 공격을 통해 시스템의 관리자 권한을 획득할 수 있는 위협을 증가시키므로, root 계정의 직접적인 원격 접속을 차단하고 있는지 여부를 점검

【 판단기준 】
- 양호 : root 계정의 원격 접속이 허용되지 않은 경우
- 취약
   [Linux]
     1. Telnet 사용 시 : /etc/securetty 파일이 존재하지 않거나 파일 내에 pts/0 ~ pts/x 등 가상 터미널이 허용된 경우
     2. SSH 사용 시 : /etc/ssh/sshd_config 파일에 PermitRootLogin yes로 설정되어 있을 경우
   [AIX]
     1. rlogin 사용 시 : /etc/security/user 파일의 root : 필드에 rlogin=true로 설정되어 있을 경우
     2. SSH 사용 시 : /etc/ssh/sshd_config 파일에 PermitRootLogin yes로 설정되어 있을 경우
   [HP-UX]
     1. Telnet 사용 시 : /etc/securetty 파일이 존재하지 않거나 파일 안에 console이 주석 처리 되어 있을 경우
     2. SSH 사용 시 : /etc/ssh/sshd_config 파일에 PermitRootLogin yes로 설정되어 있을 경우
   [SORALIS]
     1. Telnet 사용 시 : /etc/default/login 파일에 CONSOLE=/dev/console이 없거나 주석처리 되어 있을 경우
     2. SSH 사용 시 : /etc/ssh/sshd_config 파일에 PermitRootLogin yes로 설정되어 있을 경우

【 판단방법 】
1. Telnet 서비스와 SSH 서비스 원격 접속 제한 설정 확인

  ■ Linux
    [ Telnet ] : 가상터미널 허용 설정 존재 유무 확인("pts/0~pts/x" 문구 존재 시 "취약")
        # cat /etc/securetty
            ...
            tty1
            tty2
            tty3
            ...

      ※ tty(terminal-teletype) : 서버와 연결된 모니터, 키보드 등을 통해 사용자가 콘솔로 접속
      ※ pts(pseudo-terminal, 가상터미널) : Telnet, SSH, 터미널 등을 이용하여 접속
      ※ RHEL 8 이상 버전부터 pam_securetty.so 라이브러리 및 /etc/securetty 파일이 기본 패키지에서 제외되었으나 필요한 경우 기존 방식과 동일하게 설정해서 사용 가능

      ※ (필요한 경우) pam_securetty.so PAM 모듈 사용 설정 확인
          # cat /etc/pam.d/remote | egrep -i "pam_securetty.so"
              auth       required     pam_securetty.so
          # cat /etc/pam.d/login | egrep -i "pam_securetty.so"
              auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so

    [ SSH ] : root 계정 원격 접속 설정 확인("PermitRootLogin Yes" 인 경우 "취약")
        # cat /etc/sshd_config
        # cat /etc/ssh/sshd_config
        # cat /usr/local/etc/sshd_config
        # cat /usr/local/ssh/etc/sshd_config
        # cat /usr/local/sshd/etc/sshd_config
            PermitRootLogin Yes

        # cat /etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /etc/ssh/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /usr/local/etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /usr/local/ssh/etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /usr/local/sshd/etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"

  ■ AIX
    [ Telnet ] : root 계정 원격 접속 허용 설정 존재 유무 확인("rlogin=true" 인 경우 "취약")
        # cat /etc/security/user
            root : 
                rlogin=false

    [ SSH ] : root 계정 원격 접속 설정 확인("PermitRootLogin Yes" 인 경우 "취약")
        # cat /etc/sshd_config
        # cat /etc/ssh/sshd_config
        # cat /usr/local/etc/sshd_config
        # cat /usr/local/ssh/etc/sshd_config
        # cat /usr/local/sshd/etc/sshd_config
            PermitRootLogin Yes

        # cat /etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /etc/ssh/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /usr/local/etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /usr/local/ssh/etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /usr/local/sshd/etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"

  ■ HP-UX
    [ Telnet ] : 가상터미널 허용 설정 존재 유무 확인("console" 문구 존재 시 "취약")
        # cat /etc/securetty 
            console

    [ SSH ] : root 계정 원격 접속 설정 확인("PermitRootLogin Yes" 인 경우 "취약")
        # cat /opt/ssh/etc/sshd_config
            PermitRootLogin Yes

        # cat /opt/ssh/etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"

  ■ SORALIS
    [ Telnet ] : 가상터미널 허용 설정 존재 유무 확인("CONSOLE=/dev/console" 문구 존재 시 "취약")
        # cat /etc/default/login 
            CONSOLE=/dev/console

    [ SSH ] : root 계정 원격 접속 설정 확인("PermitRootLogin Yes" 인 경우 "취약")
        # cat /etc/sshd_config
        # cat /etc/ssh/sshd_config
        # cat /usr/local/etc/sshd_config
        # cat /usr/local/ssh/etc/sshd_config
        # cat /usr/local/sshd/etc/sshd_config
            PermitRootLogin Yes

        # cat /etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /etc/ssh/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /usr/local/etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /usr/local/ssh/etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"
        # cat /usr/local/sshd/etc/sshd_config | egrep "AllowUsers|DenyUsers|AllowGroups|DenyGroups"s"

【 조치방법 】
1. Telnet 서비스와 SSH 서비스의 원격 접속 제한 설정

2024-01-13 : (조치과정 삭제)