🇰🇷 한글 설명
Grav API 플러그인(getgrav/grav-plugin-api) 1.0.3 이전 버전은 POST /api/v1/media 엔드포인트로 업로드된 SVG 파일을 sanitize하지 않습니다. 인증된 공격자가 임의의 JavaScript가 포함된 SVG를 업로드할 수 있으며, 관리자가 이를 브라우저에서 열면 스크립트가 세션 컨텍스트에서 실행되어 쿠키 탈취 및 세션 하이재킹이 가능합니다.
💡 쉬운 설명
미디어 업로드 기능에서 악성 스크립트가 숨겨진 이미지 파일(SVG)을 걸러내지 않습니다. 관리자가 이 파일을 열면 공격자가 관리자의 로그인 정보를 훔칠 수 있습니다.
🇺🇸 원문 (English)
The Grav API plugin (getgrav/grav-plugin-api) before 1.0.3 fails to sanitize SVG files uploaded through the POST /api/v1/media endpoint. The HandlesMediaUploads::processUploadedFile() method validates only the file extension and never invokes Security::sanitizeSVG(), so an authenticated attacker with the api.media.write permission can upload an SVG containing arbitrary JavaScript. The file is stored unmodified and served with Content-Type: image/svg+xml; when an administrator opens it in a browser (directly or via <object>/<iframe>), the embedded script executes in their session context, enabling cookie theft and session hijacking.
📍 영향받는 시스템
Grav API 플러그인(getgrav/grav-plugin-api) 1.0.3 미만 버전
⚔️ 공격 벡터
api.media.write 권한을 가진 인증된 사용자가 스크립트가 포함된 SVG를 업로드하고, 관리자가 이를 열면 세션 정보가 탈취됨
🛡️ 대응 방법
grav-plugin-api를 1.0.3 이상으로 업데이트하고, 신뢰할 수 없는 SVG 파일은 업로드 허용 목록에서 제외하거나 sanitize 처리 후 사용
🔧 검증 코드
출력된 버전이 1.0.3 미만이면 취약하며, 1.0.3 이상이면 패치가 적용된 것입니다. 결과가 비어 있으면 플러그인 경로를 직접 확인하세요.
grep -rE "version\s*:" $(find / -path '*grav-plugin-api*' -name 'blueprints.yaml' 2>/dev/null | head -1) 2>/dev/null