No CSRF protection on people.php label-save POST endpoint #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
people.phpform that saves person labels has no CSRF token. Any page on any origin can submit a cross-site form POST to the running viewer and overwrite or delete entries inpeople_labels.json:Location
people.php— POST handler at the top of the file (~lines 9–18) and the<form>element in the detail view (~line 80).Risk
While the server listens only on
127.0.0.1by default, a malicious web page visited in the same browser session can silently POST tohttp://127.0.0.1:8123/people.phpand rename or delete any person label. For users who expose the viewer on a LAN address (by changingrun.sh) the attack surface is wider.Suggested fix direction
Generate a random token per session (e.g.,
session_start()+$_SESSION['csrf']), embed it as a hidden field in the form, and verify it matches on POST before writing the file. Alternatively, check$_SERVER['HTTP_ORIGIN']orHTTP_REFERERagainst the expected host as a lightweight mitigation.Severity
minor
Found by
Automated audit by Claude Code