🇰🇷 한글 설명
HashBrown CMS 1.4.6 이하 버전의 미디어 썸네일 생성 과정에서 OS 명령 주입(OS Command Injection) 취약점이 발견되었습니다. 파일 확장자 검증 로직의 허점을 이용해 특수하게 조작된 파일명을 업로드하면 서버에서 임의의 명령을 실행할 수 있습니다.
💡 쉬운 설명
이미지 파일을 올릴 때 파일 이름에 몰래 컴퓨터 명령어를 섞어 넣으면, 서버가 이를 실행해 버리는 보안 구멍입니다. 공격자는 이를 통해 서버의 제어권을 탈취할 수 있습니다.
🇺🇸 원문 (English)
HashBrown CMS through 1.4.6 contains an OS Command Injection vulnerability (CWE-78) in the media upload thumbnail generation routine. Media.generateThumbnail() in src/Server/Entity/Resource/Media.js builds a temporary file path as 'thumbnail' + Path.extname(filename) and passes it, unescaped, into a shell command executed via AppService.exec() ('convert ' + tempFile + ...). The MIME-type filter in getMIMEType() (src/Common/utilities.js) truncates the extracted extension at the first '?' character, while Path.extname() does not, allowing a filename such as 'x.jpg?$(command)' to pass the image-type check while still injecting a shell command substitution into the exec() call. An authenticated user holding the media resource scope can achieve arbitrary OS command execution in the context of the Node.js process via POST /api/{project}/{environment}/media/new.
📍 영향받는 시스템
HashBrown CMS 1.4.6 및 그 이전 버전
⚔️ 공격 벡터
인증된 사용자가 특수하게 조작된 파일명(예: x.jpg?$(command))을 포함한 미디어를 POST 요청으로 업로드
🛡️ 대응 방법
HashBrown CMS를 최신 보안 패치가 적용된 버전으로 업데이트하거나, 파일명에 대한 입력값 검증 및 쉘 실행 방식을 안전하게 수정해야 합니다.
🔧 검증 코드
명령어 실행 결과로 서버의 사용자 이름이 출력되거나 쉘 명령어가 실행되는 반응이 나타나면 취약한 상태입니다.
curl -s -X POST http://<target>/api/{project}/{environment}/media/new -F '[email protected]?$(whoami)' | grep -i 'error'