주요정보통신기반시설 기술적 취약점 분석 평가 상세 가이드의 데이터베이스(MySQL) 부분을 보면 구 버전과 최신 버전의 설정 값 차이가 반영되어 있지 않는다.


기반시설 기준으로 만들어 놓은 취약점 진단 스크립트로 MySQL을 진단하면 설정 값을 확인할 수 없다는 에러 메시지가 출력된다.


이는 일부 항목이 버전별 차이점이 존재해서 출력되는데, 레퍼런스 메뉴얼을 참고하여 취약점 진단 및 보안 조치를 하는 방법을 설명한다.

 

MySQL Reference Manual



root 계정의 패스워드 변경

root 계정의 패스워드가 설정되어 있지 않을 경우 임의의 사용자가 root 권한으로 시스템에 접근하여 데이터베이스에 저장된 모든 정보를 유출 및 변조가 가능하며 시스템의 쉘을 얻을 가능성이 존재한다.


@ 취약점 진단

5.6 이하
mysql> select host, user, password from mysql.user where user='root' and password='';

5.7 이상
mysql> select user, authentication_string from mysql.user where user='root' and authentication_string='';

@ 보안 조치

5.6 이하
mysql> update user set password=password('new password') where user='root';

5.7 이상
mysql> update user set authentication_string=password('new password') where user='root';

8.0 이상
mysql> alter user 'root'@'localhost' identified with mysql_native_password by 'new password';
mysql> set password for 'root'@'localhost' = password('new password');

패스워드 최대사용기간 및 복잡도 설정

일정 기간 내의 패스워드를 변경하지 않거나 복잡도가 설정되어 있지 않으면 공격자는 무작위 대입 공격을 시도하여 패스워드를 획득할 수 있다.


@ 취약점 진단

5.7 이상 (최대사용기간)
취약 : 0 또는 NULL (무제한)
mysql> select user, password_lifetime, password_last_changed from mysql.user
mysql> show variables like 'default_password_lifetime';
# cat /etc/my.cnf | grep default_password_lifetime

5.7 이상 (복잡도)
취약 : 0 또는 LOW (패스워드 길이 검증)
mysql> show variables like 'validate_password_policy';
# cat /etc/my.cnf | grep validate_password_policy

@ 보안 조치

5.7 이상 (최대사용기간)
mysql> set global default_password_lifetime=90;

5.7 이상 (복잡도)
mysql> set global validate_password_policy=1;

패스워드 재사용 제한

패스워드를 변경 시 이전에 사용한 패스워드를 동일하게 설정해서 사용하는 경우 유출당한 패스워드를 변경하지 않은 한 계속 사용할 위험이 존재한다.


@ 취약점 진단

8.0 이상 (패스워드 재사용 기간)
mysql> show variables like 'password_reuse_interval';

8.0 이상 (패스워드 개수)
mysql> show variables like 'password_history';

@ 보안 조치

8.0 이상 (패스워드 재사용 기간)
mysql> set global password_reuse_interval=90;

8.0 이상 (패스워드 개수)
mysql> set global password_history=6;

로그인 시도 횟수 제한

일정 횟수 이상 로그인 실패(계정 잠금 임계값)를 제한하지 않을 경우 무작위 대입 공격, 패스워드 추측 공격을 지속적으로 시도할 가능성이 존재한다.


@ 취약점 진단

8.0.19 이상
mysql> select user, failed_login_attempts from mysql.user;

@ 보안 조치

8.0.19 이상
mysql> alter user 'dazemonkey'@'localhost' failed_login_attempts 5;

패스워드 검증 함수 사용

validate_password.so 플러그인이 활성화가 되어 있으면 패스워드 검증 규칙을 강하게 설정할 수 있다.


@ 취약점 진단

5.7 이상
mysql> show variables like 'validate_password_%';

@ 보안 조치

5.7 이상
mysql> install plugin validate_password soname 'validate_password.so';
# vi /etc/my.cnf
plugin-load                     = validate_password.so
validate-password               = FORCE_PLUS_PERMANENT
validate-password-policy        = MEDIUM 
validate-password-mixed-case-count = 0

▶ MySQL frm, MYD, MYI 파일을 DB로 읽기

▶ ISMS 스터디 리뷰

▶ 소스코드 진단 항목 매핑 (CWE, PVS, KISA)

  • 카카오톡-공유
  • 네이버-블로그-공유
  • 네이버-밴드-공유
  • 페이스북-공유
  • 트위터-공유
  • 카카오스토리-공유