#60 Build-time path traversal: forge frontmatter id/version writes outside the output dir

closedsecurityopened
details
updated
id
0c944797-1025-43bb-a382-686669c85c69

hu13 build writes forge pages using frontmatter values as path segments without validation, so a repo can write arbitrary files outside the output directory.

Reproductions (all verified on master):

# .forge/issues/aaaa/issue.md with  id: ../../../../../../tmp/PWNED
$ hu13 build . -o /tmp/trav-out
$ ls /tmp/PWNED.html
-rw-r--r-- 1 z z 1870 /tmp/PWNED.html

# .forge/prs/bbbb/pr.md with  id: ../../../../../../tmp/PWNED2   -> /tmp/PWNED2.html
# .forge/releases/r1.md with  version: /tmp/PWNED3              -> /tmp/PWNED3.html

Root causes:

Impact: build runs in CI/Docker and writes with its own permissions. A hostile PR (or a repo you mirror but do not control) can drop attacker-influenced HTML anywhere the build user can write: overwrite other build outputs, plant files in a served tree, clobber dotfiles/config in the workspace. Because the content is a full issue/PR page, the body text is attacker-controlled (escaped HTML, but still attacker-chosen bytes and filename).

Fix:

Note: this predates #54 and is independent of it. It is the most serious finding of the review so far.

Comments (1)

all issues