🇰🇷 한글 설명
Algernon 1.17.7 이전 버전에서 인덱스 파일이 없는 디렉토리 요청 시 handler.lua를 찾기 위해 서버 루트를 넘어 부모 디렉토리를 계속 탐색하는 경로 순회 취약점입니다. 공격자가 상위 디렉토리에 handler.lua를 작성하면 인증 없이 full Algernon API로 원격 코드 실행(RCE)이 가능합니다.
💡 쉬운 설명
Algernon 웹 서버가 특정 파일을 찾을 때 실수로 매우 위쪽 디렉토리까지 올라가서, 악의적인 파일을 발견하고 실행합니다. 누군가 그 위치에 파일을 놓으면 서버를 장악할 수 있습니다.
🇺🇸 원문 (English)
Algernon is a small self-contained pure-Go web server. Prior to 1.17.7, when Algernon is asked for any URL path that resolves to a directory without an index file, DirPage walks upward through parent directories — past the configured server root — looking for a file named handler.lua to execute as the request handler. The loop terminates only after 100 ancestor steps or when filepath.Dir returns ., so on any absolute server-root path the search reaches the filesystem root (/ on Unix, drive letter on Windows). The first handler.lua it finds is loaded into the Lua interpreter with the full Algernon API exposed — including run3(), httpclient, os.execute, io.popen, PQ, MSSQL, raw filesystem access, and the userstate database. Any process that can write handler.lua anywhere in a parent directory of the server root obtains pre-authenticated remote code execution on the next HTTP request. This is reachable without authentication — the lookup happens before the permission check returns a hit (the perm system only gates URL prefixes, not the handler-resolution step), and any URL pointing at a directory without an index triggers the walk. On a fresh stock Algernon install the request GET / is enough. This vulnerability is fixed in 1.17.7.
📍 영향받는 시스템
Algernon < 1.17.7 (모든 버전)
⚔️ 공격 벡터
서버 루트의 상위 디렉토리에 handler.lua 파일을 작성한 후 디렉토리 없는 URL(예: GET /)로 요청하여 RCE 달성
🛡️ 대응 방법
Algernon을 1.17.7 이상으로 업그레이드 또는 handler.lua 탐색이 서버 루트를 넘지 않도록 파일 시스템 권한 제한
🔧 검증 코드
명령어 실행 후 버전이 1.17.7 이상이면 안전, 미만이면 취약함 (혹은 설치되지 않음)
which algernon >/dev/null && algernon --version || dpkg -l 2>/dev/null | grep -i algernon