7.5high
Failure to strip the Cookie header on change in host or HTTP downgrade in Guzzle
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.99% (higher than 81% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-f2wf-25xc-69c9BIT-DRUPAL-2022-31042BIT-DRUPAL-2022-31043DRUPAL-CORE-2022-011GHSA-w248-ffj2-4v5q
Description
Guzzle is an open source PHP HTTP client. In affected versions the `Cookie` headers on requests are sensitive information. On making a request using the `https` scheme to a server which responds with a redirect to a URI with the `http` scheme, or on making a request to a server which responds with a redirect to a a URI to a different host, we should not forward the `Cookie` header on. Prior to this fix, only cookies that were managed by our cookie middleware would be safely removed, and any `Cookie` header manually added to the initial request would not be stripped. We now always strip it, and allow the cookie middleware to re-add any cookies that it deems should be there. Affected Guzzle 7 users should upgrade to Guzzle 7.4.4 as soon as possible. Affected users using any earlier series of Guzzle should upgrade to Guzzle 6.5.7 or 7.4.4. Users unable to upgrade may consider an alternative approach to use your own redirect middleware, rather than ours. If you do not require or expect redirects to be followed, one should simply disable redirects all together.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| guzzle guzzle | < 6.5.7, >=7.0.0, < 7.4.4 | CVE List |
| guzzlehttp/guzzle (Packagist) | from 4.0.0 before 6.5.7, from 7.0.0 before 7.4.4 | GitHub Advisory Database |
| drupal/core (Packagist) | from 8.0.0 before 9.2.21, from 9.3.0 before 9.3.16 | Drupal Security Team |
| guzzlephp guzzle | before 6.5.7, from 7.0.0 before 7.4.4 | NVD |
| drupal drupal | from 9.2.0 before 9.2.21, from 9.3.0 before 9.3.16, 9.4.0 | NVD |
| debian debian_linux | 11.0 | NVD |
| drupal (Bitnami) | from 9.2.0 before 9.2.21, from 9.3.0 before 9.3.16 | Bitnami Vulnerability Database |
All scores
| GitHub_M | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| NVD | 5.0medium CVSS:2.0 | AV:N/AC:L/Au:N/C:P/I:N/A:N |
| Bitnami Vulnerability Database | high rating |
Classification
What each source says
CVE List
Guzzle is an open source PHP HTTP client. In affected versions the `Cookie` headers on requests are sensitive information. On making a request using the `https` scheme to a server which responds with a redirect to a URI with the `http` scheme, or on making a request to a server which responds with a redirect to a a URI to a different host, we should not forward the `Cookie` header on. Prior to this fix, only cookies that were managed by our cookie middleware would be safely removed, and any `Cookie` header manually added to the initial request would not be stripped. We now always strip it, and allow the cookie middleware to re-add any cookies that it deems should be there. Affected Guzzle 7 users should upgrade to Guzzle 7.4.4 as soon as possible. Affected users using any earlier series of Guzzle should upgrade to Guzzle 6.5.7 or 7.4.4. Users unable to upgrade may consider an alternative approach to use your own redirect middleware, rather than ours. If you do not require or expect redirects to be followed, one should simply disable redirects all together.
GitHub Advisory Database
Impact
Cookie headers on requests are sensitive information. On making a request using the https scheme to a server which responds with a redirect to a URI with the http scheme, or on making a request to a server which responds with a redirect to a a URI to a different host, we should not forward the Cookie header on. Prior to this fix, only cookies that were managed by our cookie middleware would be safely removed, and any Cookie header manually added to the initial request would not be stripped. We now always strip it, and allow the cookie middleware to re-add any cookies that it deems should be there.
Patches
Affected Guzzle 7 users should upgrade to Guzzle 7.4.4 as soon as possible. Affected users using any earlier series of Guzzle should upgrade to Guzzle 6.5.7 or 7.4.4.
Workarounds
An alternative approach would be to use your own redirect middleware, rather than ours, if you are unable to upgrade. If you do not require or expect redirects to be followed, one should simply disable redirects all together.
References
For more information
If you have any questions or comments about this advisory, please get in touch with us in #guzzle on the PHP HTTP Slack. Do not report additional security advisories in that public channel, however - please follow our vulnerability reporting process.
GitHub Advisory Database
Impact
Authorization headers on requests are sensitive information. On making a request using the https scheme to a server which responds with a redirect to a URI with the http scheme, we should not forward the Authorization header on. This is much the same as to how we don't forward on the header if the host changes. Prior to this fix, https to http downgrades did not result in the Authorization header being removed, only changes to the host.
Patches
Affected Guzzle 7 users should upgrade to Guzzle 7.4.4 as soon as possible. Affected users using any earlier series of Guzzle should upgrade to Guzzle 6.5.7 or 7.4.4.
Workarounds
An alternative approach would be to use your own redirect middleware, rather than ours, if you are unable to upgrade. If you do not require or expect redirects to be followed, one should simply disable redirects all together.
References
For more information
If you have any questions or comments about this advisory, please get in touch with us in #guzzle on the PHP HTTP Slack. Do not report additional security advisories in that public channel, however - please follow our vulnerability reporting process.
Drupal Security Team
Updated 22:00 UTC 2022-06-10: Added steps to update without drupal/core-recommended.
Drupal uses the third-party Guzzle library for handling HTTP requests and responses to external services. Guzzle has released two security advisories:
- Failure to strip the Cookie header on change in host or HTTP downgrade
- Fix failure to strip Authorization header on HTTP downgrade
These do not affect Drupal core, but may affect some contributed projects or custom code on Drupal sites.
We are issuing this security advisory outside our regular Drupal security release window schedule since Guzzle has already published information about the vulnerabilities, and vulnerabilities might exist in contributed modules or custom modules that use Guzzle for outgoing requests. Guzzle has rated these vulnerabilities as high-risk.
This advisory is not covered by Drupal Steward.
NVD (es)
Guzzle es un cliente PHP HTTP de código abierto. En las versiones afectadas, los encabezados "Cookie" de las peticiones son información confidencial. Al hacer una petición usando el esquema "https" a un servidor que responde con un redireccionamiento a un URI con el esquema "http", o al hacer una petición a un servidor que responde con un redireccionamiento a un URI a un host diferente, no deberíamos reenviar el encabezado "Cookie". Antes de esta corrección, sólo las cookies administradas por nuestro middleware de cookies eran eliminadas de forma segura, y cualquier encabezado "Cookie" añadida manualmente a la petición inicial no era eliminada. Ahora siempre lo eliminamos, y permitimos que el middleware de cookies vuelva a añadir las cookies que considere que deben estar ahí. Los usuarios de Guzzle 7 afectados deben actualizar a Guzzle versión 7.4.4 lo antes posible. Los usuarios afectados usando cualquier serie anterior de Guzzle deberán actualizar a Guzzle versiones 6.5.7 o 7.4.4. Los usuarios que no puedan actualizar pueden considerar un enfoque alternativo para usar su propio middleware de redireccionamiento, en lugar del nuestro. Si no es requerido o no es esperado que sean seguidas los redireccionamientos, debería simplemente deshabilitar los redireccionamientos por completo
Bitnami Vulnerability Database
Guzzle is an open source PHP HTTP client. In affected versions Authorization headers on requests are sensitive information. On making a request using the https scheme to a server which responds with a redirect to a URI with the http scheme, we should not forward the Authorization header on. This is much the same as to how we don't forward on the header if the host changes. Prior to this fix, https to http downgrades did not result in the Authorization header being removed, only changes to the host. Affected Guzzle 7 users should upgrade to Guzzle 7.4.4 as soon as possible. Affected users using any earlier series of Guzzle should upgrade to Guzzle 6.5.7 or 7.4.4. Users unable to upgrade may consider an alternative approach which would be to use their own redirect middleware. Alternately users may simply disable redirects all together if redirects are not expected or required.
References
| https://github.com/guzzle/guzzle/security/advisories/GHSA-f2wf-25xc-69c9 | advisory, third-party-advisory, web | |
| https://github.com/guzzle/guzzle/commit/e3ff079b22820c2029d4c2a87796b6a0b8716ad8 | advisory, patch, third-party-advisory, web | |
| https://www.rfc-editor.org/rfc/rfc9110.html#name-redirection-3xx | advisory, third-party-advisory, web | |
| https://www.drupal.org/sa-core-2022-011 | advisory, patch, third-party-advisory, web | |
| https://www.debian.org/security/2022/dsa-5246 | advisory, third-party-advisory, vendor-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2022-31042 | advisory, web | |
| https://github.com/FriendsOfPHP/security-advisories/blob/master/guzzlehttp/guzzle/CVE-2022-31042.yaml | web | |
| https://github.com/guzzle/guzzle | package | |
| https://github.com/guzzle/guzzle/security/advisories/GHSA-w248-ffj2-4v5q | advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2022-31043 | advisory, web | |
| https://github.com/FriendsOfPHP/security-advisories/blob/master/guzzlehttp/guzzle/CVE-2022-31043.yaml | web | |
Related
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2022-31042 changed 2025-04-23 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-f2wf-25xc-69c9 changed 2025-12-10 | CC-BY-4.0 |
| GitHub Advisory Database | GHSA-w248-ffj2-4v5q changed 2025-12-10 | CC-BY-4.0 |
| Drupal Security Team | DRUPAL-CORE-2022-011 changed 2026-09-19 | MIT |
| NVD | CVE-2022-31042 changed 2026-06-17 | Public domain |
| Bitnami Vulnerability Database | BIT-DRUPAL-2022-31042 changed 2026-09-08 | Apache-2.0 |
| Bitnami Vulnerability Database | BIT-DRUPAL-2022-31043 changed 2026-09-08 | Apache-2.0 |