🇰🇷 한글 설명
Gogs 0.14.3 미만 버전에서 발생하는 취약점으로, 파일 업로드 시 심볼릭 링크 검증 로직이 불충분하여 발생합니다. 공격자가 백슬래시(\)를 포함한 파일명을 사용하여 경로를 조작하면, 기존에 생성된 디렉토리 심볼릭 링크를 통해 시스템의 임의 위치에 파일을 쓸 수 있습니다. 이를 통해 SSH 키를 변조하거나 Git 훅을 조작하여 원격 코드 실행(RCE)을 달성할 수 있습니다.
💡 쉬운 설명
파일을 올릴 때 경로를 확인하는 과정에 허점이 있어, 공격자가 가짜 경로를 만들어 시스템의 중요한 파일을 덮어쓸 수 있는 문제입니다. 이를 이용해 해커가 서버의 제어권을 완전히 탈취할 위험이 있습니다.
🇺🇸 원문 (English)
Gogs is an open source self-hosted Git service. Prior to 0.14.3, (*Repository).UploadRepoFiles checks for symlinks only on the leaf of the upload target (osx.IsSymlink(targetPath)). The siblings UpdateRepoFile, DeleteRepoFile, and GetDiffPreview use hasSymlinkInPath, which lstats every component — UploadRepoFiles is the lone outlier. An attacker with repo-write access plus a multipart upload whose filename contains a literal backslash (preserved by filepath.Base on Linux, then converted to / by pathx.Clean) redirects the write through a previously-committed directory symlink. iox.CopyFile opens the destination with os.Create (no O_NOFOLLOW), so the kernel follows the parent symlink and writes attacker bytes anywhere the gogs UID can write — ~git/.ssh/authorized_keys → SSH foothold, or <repo>.git/hooks/post-receive → next-push RCE. This vulnerability is fixed in 0.14.3.
📍 영향받는 시스템
Gogs 0.14.3 미만 모든 버전
⚔️ 공격 벡터
저장소 쓰기 권한을 가진 공격자가 백슬래시(\)가 포함된 파일명을 사용하여 심볼릭 링크를 통한 경로 조작 공격 수행
🛡️ 대응 방법
Gogs를 최신 보안 패치가 적용된 0.14.3 버전 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 태그 버전이 0.14.3보다 낮은지 확인하여 취약 여부를 판단합니다.
curl -s https://api.github.com/repos/gogs/gogs/releases/latest | grep 'tag_name'
💻 영향받는 소프트웨어
NVIDIA Cloud Gaming Guest Driver for Linux