Algernon: handler.lua discovery walks parent directories above the server root
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.
Problem Types
| Type | CWE ID | Description |
|---|
| CWE | CWE-20 | CWE-20: Improper Input Validation |
| CWE | CWE-426 | CWE-426: Untrusted Search Path |
| CWE | CWE-552 | CWE-552: Files or Directories Accessible to External Parties |
Type: CWE
Description: CWE-20: Improper Input Validation
Type: CWE
Description: CWE-426: Untrusted Search Path
Type: CWE
Description: CWE-552: Files or Directories Accessible to External Parties
Metrics
| Version | Base score | Base severity | Vector |
|---|
| 3.1 | 9.0 | CRITICAL | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H |
Version: 3.1
Base score: 9.0
Base severity: CRITICAL
Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H