Skip to content

Reject DOCX entries with invalid ZIP boundaries - #86

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
Aurelinth:fix/zip-entry-boundaries
Sep 11, 2026
Merged

Reject DOCX entries with invalid ZIP boundaries#86
ralyodio merged 1 commit into
profullstack:masterfrom
Aurelinth:fix/zip-entry-boundaries

Conversation

@Aurelinth

Copy link
Copy Markdown
Contributor

The DOCX reader trusts a central-directory entry's pointer and compressed size without confirming that they describe a real local header or stop before the central directory. A malformed stored entry is therefore accepted and can return ZIP metadata as part of word/document.xml; an arbitrary non-header offset is accepted too. The importer may silently parse corrupted or attacker-controlled bytes instead of reporting a bad document.

Validate the local-header signature and require the complete compressed payload to fit between that header and the central directory.

Regression coverage changes a stored entry to run into the directory and changes the referenced local-header signature. Both malformed archives were accepted on the original revision and are rejected as ZipProblem after this change.

Validation: the TypeScript build and all 251 local tests pass; git diff --check passes. The PostgreSQL-backed integration suite was unavailable locally.

Prepared and tested by Aurelinth. Submitted for the $0.25 bug-fix bounty. If accepted for payment, send SOL to 9Kz3tXKeEnXR1qGmjpJKsx7GTRuomF5kxV9oEAxbmWcQ.

@ralyodio
ralyodio merged commit 5b744d0 into profullstack:master Sep 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants