🇰🇷 한글 설명
PsiTransfer 2.4.3 이전 버전에서는 `/files/:uploadId` 업로드 PATCH 경로가 인코딩된 req.path로 검증하지만 이후 tus 핸들러는 디코딩된 req.params.uploadId로 파일을 기록합니다. 이 불일치로 인해 특정 사용자 지정 업로드 디렉터리 설정 시 인증되지 않은 공격자가 애플리케이션 루트에 config.<NODE_ENV>.js 파일을 생성할 수 있으며, 프로세스 재시작 시 해당 파일이 실행됩니다.
💡 쉬운 설명
파일 업로드 경로를 처리할 때 주소 문자열을 잘못 해석하는 결함이 있습니다. 공격자가 로그인 없이 악성 설정 파일을 만들어 두면, 서버가 다시 시작될 때 그 파일이 실행됩니다.
🇺🇸 원문 (English)
PsiTransfer is an open source, self-hosted file sharing solution. Prior to version 2.4.3, the upload PATCH flow under `/files/:uploadId` validates the mounted request path using the still-encoded `req.path`, but the downstream tus handler later writes using the decoded `req.params.uploadId`. In deployments that use a supported custom `PSITRANSFER_UPLOAD_DIR` whose basename prefixes a startup-loaded JavaScript path, such as `conf`, an unauthenticated attacker can create `config.<NODE_ENV>.js` in the application root. The attacker-controlled file is then executed on the next process restart. Version 2.4.3 contains a patch.
📍 영향받는 시스템
PsiTransfer 2.4.3 미만 버전 중 PSITRANSFER_UPLOAD_DIR을 startup-loaded JavaScript 경로 접두어(예: conf)와 겹치게 설정한 배포 환경
⚔️ 공격 벡터
인증 없이 조작된 인코딩 경로로 /files/:uploadId에 PATCH 요청을 보내 애플리케이션 루트에 config.<NODE_ENV>.js 파일을 생성한 뒤 서버 재시작을 유도
🛡️ 대응 방법
PsiTransfer를 2.4.3 이상으로 업데이트하고, 재시작 전 애플리케이션 루트의 config.*.js 파일 존재 여부를 점검
🔧 검증 코드
출력된 version 값이 2.4.3 미만이면 취약하며, 2.4.3 이상이면 패치가 적용된 것입니다. 경로를 찾지 못하면 PsiTransfer가 설치되지 않은 것입니다.
cat /proc/1/cmdline 2>/dev/null | tr '\0' ' ' ; find / -name 'package.json' -path '*psitransfer*' 2>/dev/null -exec grep '"version"' {} \;