🇰🇷 한글 설명
Dockge의 스택 이름 검증 로직 결함으로 인해 경로 탐색(Path Traversal) 취약점이 존재합니다. 인증된 사용자가 상위 디렉토리 경로를 포함한 이름을 입력하면 서버 프로세스가 접근 가능한 임의의 디렉토리 내 .env 또는 Compose 파일을 읽거나 해당 디렉토리를 삭제할 수 있습니다.
💡 쉬운 설명
프로그램이 이름에 포함된 특수 문자를 제대로 검사하지 않아, 공격자가 관리 영역 밖의 파일을 몰래 읽거나 폴더를 통째로 삭제할 수 있는 문제입니다. 특히 보안 설정이 꺼져 있다면 누구나 이 위험한 동작을 수행할 수 있습니다.
🇺🇸 원문 (English)
Dockge validates a stack name only on the write path. In backend/stack.ts the allow-list check in validate(), which requires the name to match ^[a-z0-9_-]+$, is reached from save() alone, while the path getter returns path.join(this.server.stacksDir, this.name) and Stack.getStack builds path.join(server.stacksDir, stackName) with no check. The socket handlers in backend/agent-socket-handlers/docker-socket-handler.ts confirm the caller is logged in and that the name is a string, then pass it straight to Stack.getStack, so a name containing traversal sequences resolves outside the managed stacks directory. An authenticated user can therefore read the composeENV and composeYAML values of any directory the server process can reach, which discloses the secrets in that directory's .env or Compose file, and can invoke delete(), which runs docker compose down and then fsAsync.rm on the traversed path with recursive and force set, removing that directory. Disclosure is limited to files named .env or an accepted Compose filename, and deletion requires the target directory to hold a valid Compose file so that docker compose down exits successfully. Dockge commonly runs as root with access to the Docker socket, so the reachable set includes unrelated applications on the host. Instances configured with disableAuth, a supported option that logs the caller in as admin automatically, expose both operations without authentication.
📍 영향받는 시스템
Dockge (stack name validation bypass vulnerability)
⚔️ 공격 벡터
경로 탐색 문자(예: ../)가 포함된 스택 이름을 입력하여 관리 디렉토리 외부의 파일에 접근하거나 삭제 명령을 실행
🛡️ 대응 방법
Dockge를 최신 보안 패치가 적용된 버전으로 업데이트하고, 가능하면 disableAuth 옵션을 비활성화하여 인증을 강화하십시오.
🔧 검증 코드
실행 중인 Dockge 컨테이너의 버전을 확인하여 취약점이 해결된 최신 버전인지 대조하십시오.