User tests: Successful: Unsuccessful:
Pull Request resolves # .
InputFilter::isSafeFile() scans uploaded file contents in 131072-byte chunks and, between chunks, kept only the last 10 bytes to reconnect a signature that lands on a read boundary. The longest signature it searches for, the __HALT_COMPILER() phar stub, is 17 bytes, so a stub straddling a chunk boundary is never matched and the file is reported safe. This keeps the last 16 bytes of each chunk instead, which is enough to reconnect that signature with the next chunk. Valid files are not affected.
Create a file that places __HALT_COMPILER() across the 131072-byte read boundary (131060 filler bytes, then the stub, then any trailing bytes) and run it through InputFilter::isSafeFile(). Every upload path that goes through Joomla\CMS\Input\Files or Joomla\CMS\Filesystem\File::upload() reaches this scanner. A regression test is included:
./libraries/vendor/bin/phpunit tests/Unit/Libraries/Cms/Filter/InputFilterTest.php
The file with the split phar stub passes the scanner (isSafeFile() returns true); the test case "stub straddling a read boundary" fails.
The split phar stub is detected the same as a contiguous one (isSafeFile() returns false); the test passes.
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries Unit Tests |
just close it
You're right, this duplicates #47952 which already covers the boundary carry-over more generally. Closing this one. On the practical question: the phar extension is blocked, so the value here is only the content scan catching a stub embedded in an otherwise-allowed file, and that's the same scope #47952 is already discussing, so no reason to keep a second PR open for it.
| Status | Pending | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-10-02 13:33:16 |
| Closed_By | ⇒ | arib06 | |
| Labels |
Added:
Unit/System Tests
Information Required
PR-5.4-dev
|
||
@arib06 You have noticed that there is already a PR for the same thing? See #47952 . A simple text search for "phar" in the PR list on GitHub would have shown that.
The same question for that PR also applies to this one here: #47952 (comment)
How do you manage to upload a phar file in Joomla in practice?