Stored XSS: $row['text'] rendered as raw HTML without escaping in index.php #1
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
index.phpechoes the storedtextcolumn directly as raw HTML with no additional escaping:The
textvalue is Parsedown-processed HTML stored in the database. The application places full trust in Parsedown's safe mode as the only XSS barrier. If that safe mode has any bypass (well-documented for 1.7.x), or if data reaches thetextcolumn through any path other thanmessage.php(direct DB insert, future endpoint, etc.), arbitrary JavaScript executes in every visitor's browser who views that message.Location
index.php, line 27Risk
Stored XSS. Any attacker who can store a crafted payload in the
textcolumn — whether by exploiting a Parsedown safe-mode bypass or via direct DB access — achieves persistent script execution in all future visitors' browsers. This enables session hijacking, credential theft, and defacement.Suggested fix direction
htmlspecialchars()on$row['text']when treating stored content as plain text, or — since it is intentionally stored as HTML — add a dedicated HTML sanitizer (e.g.ezyang/htmlpurifier) as a second pass before output rather than relying solely on Parsedown's safe mode.Content-Security-Policyresponse header to limit damage even if XSS occurs.Severity
critical
Found by
Automated audit by Claude Code