🇰🇷 한글 설명
Sourcecodester Modern Image Gallery App v1.0에서 원격 코드 실행(RCE) 취약점이 존재합니다. 이 취약점은 gallery/upload.php 컴포넌트에서 업로드된 파일 내용을 제대로 검증하지 못하며, 사용자가 제공한 파일 확장자를 저장 과정에서 유지합니다. 이로 인해 인증되지 않은 공격자가 MIME 타입을 이미지로 위장하여 임의의 PHP 코드를 업로드할 수 있게 되어 시스템을 완전히 위협할 수 있습니다.
💡 쉬운 설명
이 취약점은 공격자가 이미지 파일로 위장하여 악성 코드를 업로드할 수 있게 해줍니다. 이렇게 업로드된 코드는 시스템을 완전히 제어할 수 있습니다. 이는 매우 심각한 취약점으로, 즉시 조치가 필요합니다.
🇺🇸 원문 (English)
A Remote Code Execution (RCE) vulnerability exists in Sourcecodester Modern Image Gallery App v1.0 within the gallery/upload.php component. The application fails to properly validate uploaded file contents. Additionally, the application preserves the user-supplied file extension during the save process. This allows an unauthenticated attacker to upload arbitrary PHP code by spoofing the MIME type as an image, leading to full system compromise.
📍 영향받는 시스템
Sourcecodester Modern Image Gallery App v1.0
⚔️ 공격 벡터
인증되지 않은 공격자가 MIME 타입을 조작하여 악성 PHP 코드를 업로드
🛡️ 대응 방법
업로드된 파일을 철저히 검증하고, 사용자 제공 파일 확장자를 신뢰하지 말아야 합니다. 또한, 업로드된 파일을 실행 가능한 디렉토리에서 저장하지 않도록 주의해야 합니다.
🔧 검증 코드
로컬에서 Python을 실행하여 업로드 페이지에 접근할 수 있는지 확인합니다. 업로드 페이지에 접근할 수 있다면 취약한 것으로 판단합니다. 이 코드는 로컬 시스템의 취약점 여부를 점검하는 코드로, 원격 접속 없이 로컬 시스템에서만 실행할 수 있습니다.
python -c "import requests; response = requests.get('http://localhost/gallery/upload.php'); if 'upload.php' in response.text: print('{"result": "취약", "reason": "업로드 페이지 접근 가능"}'); else: print('{"result": "양호", "reason": "업로드 페이지 접근 불가"}')"