📋 취약점 정보

🚨 취약점 개요
환경변수 파일 권한 설정은(는) 시스템 보안을 강화하기 위해 필수적인 설정입니다.
📌 점검 대상
파일/디렉토리: /etc/environment, /etc/profile
중요도:
권장사항: 즉시 조치 필요
🚨 보안 위협
⚠️
PATH 조작 공격
⚠️
LD_LIBRARY_PATH 변조
⚠️
악의적 환경 변수 주입

상태 비교

취약한 상태
644 또는 그 이상의 권한
보안 상태
644 권한 (/etc/environment), 755 권한 (/etc/profile)

🖥️ 실습 환경

현재 상태: 취약

$ ls -l /etc/environment /etc/profile -rw-rw-rw- 1 root root 345 /etc/environment -rw-r--r-- 1 root root 890 /etc/profile
⚠️ 현재 상태
• 644 또는 그 이상의 권한
• 보안 설정이 미흡한 상태
• 즉시 조치 필요

목표 상태: 보안

현재 환경변수 파일 권한 확인
환경변수 설정 파일들의 현재 권한을 확인합니다:
$ ls -l /etc/environment /etc/profile -rw-rw-rw- 1 root root 345 /etc/environment -rw-r--r-- 1 root root 890 /etc/profile
environment 파일 권한 수정
/etc/environment 파일의 권한을 644로 설정합니다:
$ sudo chmod 644 /etc/environment # 확인 $ ls -l /etc/environment -rw-r--r-- 1 root root 345 /etc/environment
profile.d 디렉토리 권한 설정
/etc/profile.d 디렉토리 내 스크립트들의 권한을 설정합니다:
$ ls -l /etc/profile.d/ total 24 -rw-r--r-- 1 root root 234 /etc/profile.d/java.sh -rw-r--r-- 1 root root 567 /etc/profile.d/python.sh
환경변수 검증
권한 변경 후 환경변수가 정상적으로 로드되는지 확인합니다:
$ env | grep -E '^PATH|^LD_LIBRARY_PATH' PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin