-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Hiding userFqcn in RememberMe cookie #59232
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
base: 7.3
Are you sure you want to change the base?
Conversation
Wait this feature, cause now everyone can spot the framework type and moreover a specific version of symfony. It's security risk. |
We've been wondering about the same many times. |
I've carefully reviewed the tests and code again. It turns out that I missed some places where the I believe it is important to store some identifier in the cookie to associate it with the user class. Removing the class identifier entirely might lead to a potential security issue if a user with the same identifier but a different class is created. While I can't provide a concrete proof of concept for this, I think adding such an identifier would add an extra layer of safety. In fact, the check for To achieve this, I propose replacing The BC aspect is critical, and if anyone relies on the What do you think about this approach? |
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
I think we don't need to leak anything about user's FQCN, not even a hash:
Do you think that's doable? |
Self-analyzing my proposal :D
That'd mean not being able to validate the signature before calling the user provider, which means opening a timing-attack vector. So a hash looks required then, but only for non-persistent ones. |
Up to dig this idea @thereisnobugs? |
Sorry for the delayed answer. I've had a lot of work. I dug deeper and realized that for non-persistent tokens in Symfony, FQCN is not used at all. If we remove this property, nothing will change in terms of signature calculation and verification. The only potential compatibility issues would occur if someone is relying on this data in their implementation. Persistent tokens are more complicated. Before checking the token, userIdentifier and userFqcn are compared.
and change the token verification method:
I think this should be enough, since the main idea is to make it less obvious from the cookie signature that we are using Symfony and PHP. |
I don't think this same-user-identifier/different-fqcn exists. In the end userProvider->loadUserByIdentifier is called, so that there's only one user with said identifier. What about just deprecating Then of course we'll need to find a proper BC layer with support for existing cookies/databases. |
WDYT @wouterj maybe? |
It does, migrating a legacy codebase or merging two projects with users in common for example. |
Can you expand? signature-based remember-me don't use the FQCN, so this doesn't apply to them. |
In the current implementation, RememberMeDetails stores the userFqcn field, which exposes the class name of the user. This can potentially lead to information leakage about the application's internal structure.
This PR replaces the storage of userFqcn with its hash. By doing so, the implementation details of the application remain protected.
This change is not backward compatible for the following reasons:
If this approach is acceptable, I will adjust the implementation to ensure compatibility by:
Let me know if this approach works for you, and I will update the PR and fix tests.