🇰🇷 한글 설명
Dinky의 /download/uploadFromRsByLocal 핸들러에서 경로 검증 없이 사용자 입력 경로를 파일 생성 및 전송에 직접 사용합니다. 기본적으로 하드코딩된 토큰이 사용되어 인증을 우회할 수 있으며, 이를 통해 공격자는 서비스 계정 권한으로 임의의 파일을 작성할 수 있습니다.
💡 쉬운 설명
해커가 미리 정해진 비밀번호를 이용해 시스템에 몰래 침입하여, 서버의 중요한 파일을 마음대로 바꾸거나 악성 코드를 심을 수 있는 심각한 보안 결함입니다. 이로 인해 관리자의 브라우저를 해킹하거나 서버가 다시 시작될 때 해커의 명령이 실행될 수 있습니다.
🇺🇸 원문 (English)
Dinky's POST /download/uploadFromRsByLocal handler passes the caller-supplied path parameter directly to new File(path) and file.transferTo(dest) with no path validation. The route is marked @SaIgnore and /download/** is excluded from the Sa-Token interceptor, so the only guard is a header equality check against a dinkyToken value whose default (efda1551-7958-4e0f-80a8-dfd107df3e38) is hardcoded in source and shipped to every deployment. Anyone who can reach Dinky's HTTP port (8888 by default) and supplies the hardcoded token can write arbitrary files as the Dinky service account. The default Docker image runs on 8888 with no proxy or authentication and chmod 777 on /opt/dinky, so the application's own classpath, launch scripts, and static assets are writable. Demonstrated impact: overwriting /opt/dinky/config/static/index.html served attacker JavaScript to admin browsers immediately, and writing /opt/dinky/org/dinky/Dinky.class executed attacker code as the Dinky service account at the next JVM start via a classpath-shadow launched by script/bin/auto.sh. Writes are uid 9999 (flink), not root, so /etc, /root, /home, and /usr are refused. Affects Dinky v1.2.5 (the current release) and the development branch, where the code is byte-identical.
📍 영향받는 시스템
Dinky v1.2.5 및 개발 브랜치 (development branch)
⚔️ 공격 벡터
하드코딩된 dinkyToken을 사용하여 인증을 우회한 후, 경로 매개변수를 조작하여 임의의 파일 쓰기 수행
🛡️ 대응 방법
경로 검증 로직을 추가하고, 하드코딩된 기본 토큰을 변경하며, Sa-Token 인터셉터의 제외 범위를 재검토하십시오.
🔧 검증 코드
명령어 실행 시 HTTP 200 OK 응답이 오거나 오류 없이 연결된다면 취약한 기본 토큰이 활성화된 상태입니다.
curl -s -I -H 'dinkyToken: efda1551-7958-4e0f-80a8-dfd107df3e38' http://localhost:8888/download/uploadFromRsByLocal