🇰🇷 한글 설명
mysqld_safe에서 파일 기반 로깅 사용 시 symlink attack을 통해 로컬 mysql 사용자가 root 권한을 획득할 수 있는 취약점입니다. 오라클 MySQL, MariaDB, Percona Server의 여러 버전에 영향을 미칩니다.
💡 쉬운 설명
MySQL이 에러 로그를 저장할 때 보안 확인이 없어서, 악의적인 사용자가 가짜 파일을 만들어 시스템 관리자 권한을 빼앗을 수 있습니다. 같은 컴퓨터에 접근할 수 있는 사용자만 공격할 수 있습니다.
🇺🇸 원문 (English)
mysqld_safe in Oracle MySQL through 5.5.51, 5.6.x through 5.6.32, and 5.7.x through 5.7.14; MariaDB; Percona Server before 5.5.51-38.2, 5.6.x before 5.6.32-78-1, and 5.7.x before 5.7.14-8; and Percona XtraDB Cluster before 5.5.41-37.0, 5.6.x before 5.6.32-25.17, and 5.7.x before 5.7.14-26.17, when using file-based logging, allows local users with access to the mysql account to gain root privileges via a symlink attack on error logs and possibly other files.
📍 영향받는 시스템
MySQL 5.5.51 이전, 5.6.x/5.6.32 이전, 5.7.x/5.7.14 이전; MariaDB; Percona Server 5.5.51-38.2, 5.6.32-78-1, 5.7.14-8 이전; Percona XtraDB Cluster 5.5.41-37.0, 5.6.32-25.17, 5.7.14-26.17 이전
⚔️ 공격 벡터
로컬 mysql 계정 사용자가 /var/log/mysql/ 등의 로그 디렉토리에서 symlink를 생성하여 mysqld_safe가 쓰는 파일을 다른 위치로 리다이렉트해 권한 상승 유도
🛡️ 대응 방법
영향받는 버전을 최신 패치된 버전으로 업그레이드하고, 로그 디렉토리의 권한을 제한하며 SELinux/AppArmor 등의 MAC 정책 적용
🔧 검증 코드
MySQL 버전 정보와 로그 디렉토리의 파일 권한을 확인하여, 로그 파일이 mysql:mysql 소유이고 다른 사용자가 쓰기 권한이 없는지 검증합니다.
mysql --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' && ls -la /var/log/mysql/ 2>/dev/null | head -5 || echo 'MySQL not found or no log directory'