Skip to content

PdoSessionHandler: advisory lock for pgsql not safe for session.sid_bits_per_character > 4 #24095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tobion opened this issue Sep 4, 2017 · 0 comments

Comments

@Tobion
Copy link
Contributor

Tobion commented Sep 4, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version all

When ini session.sid_bits_per_character > 4, the session id can contain non-hex-characters which will be ignored by hexdec in
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php#L586 making the lock key vulnerable to collisions. So somebody else could block your session. The same problem applies to the old session.hash_bits_per_character setting.
So we need a different algorithm to transform the session id to an integer.

fabpot added a commit that referenced this issue Sep 29, 2017
This PR was merged into the 2.7 branch.

Discussion
----------

PdoSessionHandler: fix advisory lock for pgsql

when session.sid_bits per_character > 4 the session id can contain non-hex-characters which will be ignored by hexdec. this can potentially result in collisions on the lock key from different sessions, e.g. the session ids `aagh` and `aaij` would have the same pgsql lock because `hexdec('aagh') === hexdec('aaij')`

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #24095
| License       | MIT
| Doc PR        |

Commits
-------

0f0a6e8 PdoSessionHandler: fix advisory lock for pgsql when session.sid_bits_per_character > 4
@fabpot fabpot closed this as completed Sep 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants