Skip to content

ext/session: prevent creation of fixed sid in php_session_rfc1867 - #22113

Open
jorgsowa wants to merge 2 commits into
php:PHP-8.4from
jorgsowa:fix/session-upload-progress-use-only-cookies
Open

ext/session: prevent creation of fixed sid in php_session_rfc1867#22113
jorgsowa wants to merge 2 commits into
php:PHP-8.4from
jorgsowa:fix/session-upload-progress-use-only-cookies

Conversation

@jorgsowa

Copy link
Copy Markdown
Contributor

The RFC1867 multipart callback captures the session ID from form data to identify which session to write the upload progress to. When session.use_only_cookies=1 this capture was not guarded, allowing the session ID to be accepted from a form field despite the setting's documented contract of "only accept session ID from cookies."

php_session_rfc1867_early_find_sid() already guards $_GET lookup behind use_only_cookies, but the form field capture in MULTIPART_EVENT_FORMDATA had no such guard.

This commit adds the missing check so that when use_only_cookies=1 and no cookie is present, the form-supplied session ID is ignored and the upload progress is written to a randomly generated session instead.

I don't know if this is a security fix, so I point to the 8.4 branch.

@Girgias Girgias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems sensible, but not super familiar with RFC 1867, maybe @iluuu1994 or @bukka have some comments?

@jorgsowa
jorgsowa force-pushed the fix/session-upload-progress-use-only-cookies branch from 164e5fb to abd2d93 Compare June 14, 2026 12:40
@jorgsowa

Copy link
Copy Markdown
Contributor Author

I have added missing entry in NEWS.

@Girgias
Girgias requested a review from iluuu1994 June 18, 2026 11:47
@jorgsowa
jorgsowa force-pushed the fix/session-upload-progress-use-only-cookies branch from abd2d93 to 1c84f86 Compare July 1, 2026 20:05
@jorgsowa
jorgsowa force-pushed the fix/session-upload-progress-use-only-cookies branch from 1c84f86 to 43cb7db Compare July 10, 2026 19:33
@jorgsowa
jorgsowa requested a review from Girgias July 10, 2026 19:40
@jorgsowa
jorgsowa force-pushed the fix/session-upload-progress-use-only-cookies branch from 43cb7db to 18ab329 Compare July 10, 2026 21:34
@jorgsowa
jorgsowa force-pushed the fix/session-upload-progress-use-only-cookies branch from 18ab329 to 3466474 Compare July 18, 2026 21:37
@jorgsowa
jorgsowa force-pushed the fix/session-upload-progress-use-only-cookies branch from 3466474 to b989b90 Compare July 31, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants