fix(manager): harden file manager tokens, media browser CSRF and alert output - #2457
Open
elcreator wants to merge 1 commit into
Open
fix(manager): harden file manager tokens, media browser CSRF and alert output#2457elcreator wants to merge 1 commit into
elcreator wants to merge 1 commit into
Conversation
elcreator
commented
Sep 11, 2026
- makeToken() built the file manager's one-shot token from uniqid(), which is clock-derived; it now uses random_bytes() and checkToken() compares with hash_equals().
- The media browser (mcpuk) had no CSRF check at all and relied on SameSite. browse.php now requires the session _token for every act except the page itself and its thumbnails; the scripts append it through baseGetData(), the single place every request URL is built.
- webAlertAndQuit() wrote its message into the alert page verbatim, so any caller interpolating request data was reflected XSS. The message is shown as plain text (it is read via textContent and removed), so it is escaped now.
- ?stay= and ?tab= are only ever small integers: cast them before they reach Location headers and a script block.
- Default upload_files/upload_images no longer list svg, htaccess or flash extensions; svg is scriptable and served same-origin, which gave the assets_files right a stored XSS. Only new installs pick the defaults up.
…t output - makeToken() built the file manager's one-shot token from uniqid(), which is clock-derived; it now uses random_bytes() and checkToken() compares with hash_equals(). - The media browser (mcpuk) had no CSRF check at all and relied on SameSite. browse.php now requires the session _token for every act except the page itself and its thumbnails; the scripts append it through baseGetData(), the single place every request URL is built. - webAlertAndQuit() wrote its message into the alert page verbatim, so any caller interpolating request data was reflected XSS. The message is shown as plain text (it is read via textContent and removed), so it is escaped now. - ?stay= and ?tab= are only ever small integers: cast them before they reach Location headers and a script block. - Default upload_files/upload_images no longer list svg, htaccess or flash extensions; svg is scriptable and served same-origin, which gave the assets_files right a stored XSS. Only new installs pick the defaults up. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0136CYHW4NXMDFA8gfuNCx7R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.