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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants