Symfony News

CVE-2017-16653: CSRF protection does not use different tokens for HTTP and HTTPS

Affected versions

Symfony 2.7.0 to 2.7.37, 2.8.0 to 2.8.30, 3.2.0 to 3.2.13, and 3.3.0 to 3.3.12 versions of the Symfony Intl component are affected by this security issue.

The issue has been fixed in Symfony 2.7.38, 2.8.31, 3.2.14, 3.3.13, 3.4-BETA5, and 4.0-BETA5.

Note that no fixes are provided for Symfony 3.0 and 3.1 as they are not maintained anymore.

Description

The implementation of CSRF protection did not use different tokens for HTTP and HTTPS, therefore the token was subject to MITM attacks on HTTP and could then be used in HTTPS context to do CSRF attacks.

Resolution

The tokens are now namespaced by default to differentiate HTTP from HTTPS.

Note that this patch introduces a small BC break (the token ID can change, and isn't the one specified by the user in some cases) but has the benefit of fixing all use cases:

  • Form component;
  • Login and logout security listeners;
  • Direct usage of the security.csrf.token_manager service;
  • Direct usage of the CsrfTokenManager (component without the full stack framework) even if not used with HttpFoundation.

The previous behavior can be restored by using '' as namespace.

The patch for this issue is available here.

Credits

I would like to thank Oliver Hoff for reporting this security issue, Kevin Dunglas for providing a fix, and the Symfony Core Team for reviewing the patch.


Be trained by Symfony experts - 2017-11-22 Cologne - 2017-12-4 Lyon - 2017-12-4 Lyon


About us

What a Symfony developer should know about the framework: News, Jobs, Tweets, Events, Videos,...

Resources

Find us on Twitter

Find us on Facebook