[Security-news] GraphQL - Moderately critical - Cross Site Request Forgery - SA-CONTRIB-2023-051

security-news at drupal.org security-news at drupal.org
Wed Nov 8 17:10:25 UTC 2023


View online: https://www.drupal.org/sa-contrib-2023-051

Project: GraphQL [1]
Date: 2023-November-08
Security risk: *Moderately critical* 12∕25
AC:Basic/A:None/CI:None/II:Some/E:Theoretical/TD:Default [2]
Vulnerability: Cross Site Request Forgery

Affected versions: <3.4.0 || >=4.0.0 <4.6.0
Description: 
The GraphQL module enables you to build GraphQL APIs which can include data
fetching through Queries and data updates (create, update, delete) through
mutations.

The module does not sufficiently validate incoming requests that are made
from domains other than the one serving the GraphQL endpoint. In case a user
visits a malicious site, that site may make requests on the users behalf
which can lead to the execution of mutations, exposing a CSRF vulnerability.
Whether data is returned to the malicious site depends on your sites CORS
configuration.

This vulnerability is mitigated by the fact that a user with access to the
API must have an active session cookie while visiting a malicious site. This
vulnerability is also mitigated by restricting session cookies with the
SameSite attribute (see solution below).

Solution: 
Install the latest version:

   * If you use the GraphQL module v4 upgrade to GraphQL 8.x-4.6 [3]
   * If you use the GraphQL module v3 upgrade to GraphQL 8.x-3.4 [4]

This vulnerability can also be mitigated by setting the SameSite attribute on
session cookies to Lax (recommended) or Strict. This might not be suitable
for sites that need to share the Drupal session cookie in some way with other
sites. Set the following in your site's services.yml file:

parameters:
     session.storage.options:
       # Session cookies are only used for backend admin accounts, so we
restrict
       # the cookies to be used only from the backend origin. We don't use
"Strict"
       # because that also removes cookies whenever an admin navigates from an
       # email or chat app, which is inconvenient. See
       #
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
       cookie_samesite: Lax

Reported By: 
   * Sam Becker [5]

Fixed By: 
   * Sam Becker [6]
   * Klaus Purer [7]
   * Alexander Varwijk [8]
   * Luis  [9]
   * Lee Rowlands [10] of the Drupal Security Team

Coordinated By: 
   * Greg Knaddison [11] of the Drupal Security Team
   * Damien McKenna [12] of the Drupal Security Team


[1] https://www.drupal.org/project/graphql
[2] https://www.drupal.org/security-team/risk-levels
[3] https://www.drupal.org/project/graphql/releases/8.x-4.6
[4] https://www.drupal.org/project/graphql/releases/8.x-3.4
[5] https://www.drupal.org/user/1485048
[6] https://www.drupal.org/user/1485048
[7] https://www.drupal.org/user/262198
[8] https://www.drupal.org/user/1868952
[9] https://www.drupal.org/user/1022312
[10] https://www.drupal.org/user/395439
[11] https://www.drupal.org/user/36762
[12] https://www.drupal.org/user/108450



More information about the Security-news mailing list