Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-31205 Overview
Saleor is an open-source e-commerce platform written in Python. CVE-2024-31205 is a Cross-Site Request Forgery (CSRF) validation bypass [CWE-352] affecting the GraphQL authentication layer. Starting in version 3.10.0 and prior to the patched releases, an attacker can bypass CSRF validation by calling the refreshToken mutation with an empty string. When the client provides an empty refreshToken argument while the token persists in the JWT_REFRESH_TOKEN_COOKIE_NAME cookie, the application skips CSRF validation and returns a valid access token. The flaw allows abuse of the authenticated session cookie to mint access tokens across origins.
Critical Impact
A remote attacker can trick an authenticated user's browser into issuing valid access tokens by submitting a crafted GraphQL request that bypasses CSRF checks.
Affected Products
- Saleor versions 3.10.0 through 3.14.63
- Saleor versions 3.15.0 through 3.15.38, 3.16.0 through 3.16.38, 3.17.0 through 3.17.34
- Saleor versions 3.18.0 through 3.18.30 and 3.19.0 through 3.19.18
Discovery Timeline
- 2024-04-08 - CVE-2024-31205 published to the National Vulnerability Database (NVD)
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-31205
Vulnerability Analysis
Saleor issues JWT refresh tokens that can be presented either as a GraphQL mutation argument or via the JWT_REFRESH_TOKEN_COOKIE_NAME cookie. When the refresh token is transmitted via cookie, Saleor enforces an additional CSRF token check to prevent cross-origin abuse. The bypass occurs because the get_refresh_token helper uses a truthiness check (refresh_token or request.COOKIES.get(...)) rather than an explicit None check. An empty string submitted as the refreshToken argument is falsy, so the code falls back to the cookie value while the request is still treated as if the client supplied the token directly, skipping CSRF enforcement.
Root Cause
The defect lives in saleor/graphql/account/mutations/authentication/refresh_token.py. Two functions performed loose truthiness checks: get_refresh_token used refresh_token or request.COOKIES.get(...), and clean_refresh_token used if not refresh_token. Both incorrectly treated an empty string identically to a missing value, collapsing the control flow that gates CSRF validation.
Attack Vector
Exploitation requires user interaction: the victim must have an active Saleor session with a valid JWT_REFRESH_TOKEN_COOKIE_NAME cookie set in the browser. An attacker hosts a malicious page that issues a cross-origin GraphQL request calling the refreshToken mutation with refreshToken: "". The browser attaches the session cookie automatically, the CSRF validation is skipped, and Saleor returns a valid access token that the attacker's page can capture.
cls, info: ResolveInfo, refresh_token: Optional[str] = None
) -> Optional[str]:
request = info.context
- refresh_token = refresh_token or request.COOKIES.get(
- JWT_REFRESH_TOKEN_COOKIE_NAME, None
- )
+ if refresh_token is None:
+ refresh_token = request.COOKIES.get(JWT_REFRESH_TOKEN_COOKIE_NAME, None)
return refresh_token
@classmethod
def clean_refresh_token(cls, refresh_token):
- if not refresh_token:
+ if refresh_token is None:
raise ValidationError(
{
"refresh_token": ValidationError(
Source: Saleor commit 36699c6. The patch replaces truthiness checks with explicit is None comparisons so an empty string no longer triggers the cookie fallback and CSRF-bypass path.
Detection Methods for CVE-2024-31205
Indicators of Compromise
- GraphQL refreshToken mutations where the refreshToken argument is an empty string but a JWT_REFRESH_TOKEN_COOKIE_NAME cookie is present on the request.
- Successful token refresh responses lacking a matching CSRF header or with a Referer/Origin header that does not belong to the Saleor storefront.
- Bursts of refreshToken calls from a single session originating from unexpected client IPs or user agents.
Detection Strategies
- Instrument the Saleor GraphQL layer to log the length and source (argument versus cookie) of every refreshToken value used during mutation resolution.
- Add web application firewall (WAF) rules that reject GraphQL requests where the refreshToken variable is present but empty.
- Correlate refresh-token issuance events with the originating Origin and Referer headers to flag cross-origin issuance.
Monitoring Recommendations
- Alert on any refresh_token GraphQL operation returning a valid token without a matching CSRF token header.
- Track anomalous spikes in access token issuance per user account, particularly outside normal storefront traffic patterns.
- Retain HTTP access logs for authentication endpoints for a period sufficient to reconstruct suspected CSRF abuse sessions.
How to Mitigate CVE-2024-31205
Immediate Actions Required
- Upgrade Saleor to a fixed release: 3.14.64, 3.15.39, 3.16.39, 3.17.35, 3.18.31, or 3.19.19.
- Rotate any long-lived refresh tokens and force re-authentication for privileged accounts if abuse is suspected.
- Review authentication logs for empty-string refreshToken mutations issued while a session cookie was set.
Patch Information
The fix is committed in Saleor commit 36699c6 and documented in GitHub Security Advisory GHSA-ff69-fwjf-3c9w. The patch changes the get_refresh_token and clean_refresh_token helpers in saleor/graphql/account/mutations/authentication/refresh_token.py to use explicit is None comparisons, ensuring that an empty string is treated as a client-supplied value rather than triggering the cookie fallback that bypassed CSRF validation.
Workarounds
- Replace saleor.graphql.account.mutations.authentication.refresh_token.py.get_refresh_token with a version that checks refresh_token is None before falling back to the cookie. Note that this workaround returns JWT_MISSING_TOKEN instead of JWT_INVALID_TOKEN to clients.
- Deploy a WAF or reverse proxy rule that rejects GraphQL refreshToken mutations containing an empty refreshToken variable while a session cookie is present.
- Restrict the SameSite attribute of the refresh token cookie to Strict where the storefront architecture permits, reducing cross-origin exposure until the patch is applied.
# Example: pin Saleor to a patched minor release
pip install --upgrade 'saleor==3.19.19'
# Verify the deployed version
python -c "import saleor; print(saleor.__version__)"
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

