Skip to content

Conversation

acoulton
Copy link
Member

Credential-stuffing and malware bots will commonly attempt requests with manufactured session cookies e.g. to search for SQL, path or URL injection vulnerabilities.

Currently, the MysqlSession driver checks all provided session IDs against the database to validate them. This is NOT a security issue, since we are using PDO's parameters to properly escape the provided values.

However, it does cause an exception (and therefore an error report) because the GET_LOCK query uses the user-provided session ID as part of the lock name. If the lock name contains characters that are not valid in a lock, MySQL will give a syntax error, which in turn causes a PDOException.

Instead, skip the database lookup and return false immediately (as for any other invalid session ID) if the ID does not match the expected length and character set.

@acoulton acoulton requested a review from craig410 September 16, 2025 16:51
@acoulton acoulton force-pushed the 2.x-bug-validate-session-id branch from a9665ac to 0ef4bbe Compare September 16, 2025 16:54
Credential-stuffing and malware bots will commonly attempt requests
with manufactured session cookies e.g. to search for SQL, path or
URL injection vulnerabilities.

Currently, the MysqlSession driver checks all provided session IDs
against the database to validate them. This is *NOT* a security issue,
since we are using PDO's parameters to properly escape the provided
values.

However, it does cause an exception (and therefore an error report)
because the `GET_LOCK` query uses the user-provided session ID as
part of the lock name. If the lock name contains characters that
are not valid in a lock, MySQL will give a syntax error, which in
turn causes a PDOException.

Instead, skip the database lookup and return false immediately
(as for any other invalid session ID) if the ID does not match
the expected length and character set.
@acoulton acoulton force-pushed the 2.x-bug-validate-session-id branch from 0ef4bbe to 0863c13 Compare September 17, 2025 09:56
@acoulton acoulton merged commit 337efe4 into 2.x Sep 17, 2025
6 checks passed
@acoulton acoulton deleted the 2.x-bug-validate-session-id branch September 17, 2025 12:52
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