🇰🇷 한글 설명
GNU C Library의 gettext 계열 함수가 setuid/setgid가 아닌 프로그램에서 LANGUAGE 환경변수에 '/'나 '..'가 포함된 값을 허용합니다. 공격자는 이를 이용해 임의 경로의 .mo 메시지 카탈로그를 로드하게 만들 수 있으며, 조작된 파일로 프로그램 충돌이나 printf 계열 함수의 정의되지 않은 동작, 나아가 프로그램 권한으로 임의 코드 실행이 가능합니다.
💡 쉬운 설명
프로그램이 번역 파일을 읽을 때 환경변수 경로 검사가 빠져 있어, 공격자가 임의 위치의 악성 번역 파일을 읽게 만들 수 있습니다. 이를 통해 프로그램이 멈추거나 공격자의 코드가 실행될 수 있습니다.
🇺🇸 원문 (English)
The gettext family of functions in the GNU C Library version 2.0 and later accept LANGUAGE environment variable entries that contain '/' or that are equal to "..", unless the program is setuid or setgid (AT_SECURE). An attacker who can set LANGUAGE in the environment of a program that uses gettext can make it load a message catalog (.mo file) from an arbitrary location in the file system. A crafted .mo file can crash the program through out-of-range offsets, or supply translations whose format directives do not match the arguments passed by the program. That causes undefined behaviour in the printf family of functions and may allow arbitrary code execution with the privileges of the program. The safety of message catalogs relies on them being installed in trusted, read-only locations, and the directory traversal bypasses this.
The fix for CVE-2014-0475 rejects ".." path components in locale names passed to setlocale or taken from the LC_ALL, LC_* and LANG environment variables. gettext reads LANGUAGE directly and appends each colon-separated entry to the message catalog directory, so that fix did not cover LANGUAGE.
LANGUAGE is only used when the LC_MESSAGES locale is not "C", "C.<encoding>" or "POSIX", so the attacker must also be able to select another installed locale, for example through LANG or LC_ALL. Exploitation also requires that the attacker can place the crafted file in a location readable by the target program, and that the environment crosses a trust boundary without the program running as AT_SECURE. An example is an SSH server that accepts LANGUAGE and LANG from clients through the AcceptEnv directive and restricts an account to a forced command; the attacker may use this to escape the restriction.
📍 영향받는 시스템
CVE 설명 기준 GNU C Library(glibc) 2.0 이상 (패치 적용 여부 및 정확한 영향 버전은 배포판 보안 공지 확인 필요)
⚔️ 공격 벡터
공격자가 LANGUAGE와 LANG/LC_ALL 환경변수를 조작할 수 있는 상황에서 조작된 .mo 파일을 읽을 수 있는 경로에 배치하여 임의 파일을 메시지 카탈로그로 로드하게 함
🛡️ 대응 방법
배포판에서 제공하는 glibc 보안 업데이트를 적용하고, 신뢰할 수 없는 환경변수(LANGUAGE, LANG, LC_ALL)가 프로그램으로 전달되지 않도록 AcceptEnv 등 설정을 점검
🔧 검증 코드
출력된 glibc 버전을 배포판 보안 공지의 패치 버전과 비교하여, 해당 CVE 수정이 포함된 버전 이상이면 적용된 것이고 미만이면 업데이트가 필요합니다.