CVE-2023-26051
Saleor GraphQL exposes sensitive data in error messages
- CVSS 4.3
- CWE-209 Generation of Error Message Containing Sensitive Information
- Information Leakage
- Remote
Saleor is a headless, GraphQL commerce platform delivering personalized shopping experiences. Some internal Python exceptions are not handled properly and thus are returned in API as error messages. Some messages might contain sensitive information like user email address in staff-authenticated requests.
- CVSS base score
- 4.3
- Published
- 2023-03-02
- OWASP
- A07 Identification and Authentication Failures
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Information Leakage
- Subcategory
- Insecure Handling of Sensitive Data
- Accessibility scope
- Remote
- Impact
- Information Disclosure
- Affected component
- Python
- Fixed by upgrading
- Yes
Solution
Update Saleor to the latest version.
Vulnerable code sample
def execute_query(query, user):
try:
# Simulate query execution
result = perform_query(query, user)
return result
except Exception as e:
# Directly returning the exception message, which may contain sensitive information
return {"error": str(e)}
def perform_query(query, user):
# This function simulates the actual query execution logic
# It may raise exceptions that could expose sensitive data
if user.is_staff:
# Simulating a potential exception that could expose sensitive data
raise ValueError("Sensitive information: user@example.com")
return {"data": "some_result"}Patched code sample
from graphql import GraphQLError
def execute_query(query, user):
try:
# Simulate query execution
result = perform_query(query, user)
return result
except Exception as e:
# Log the error internally without exposing sensitive information
log_error(e)
# Return a generic error message to the API consumer
raise GraphQLError("An internal error occurred. Please try again later.")
def perform_query(query, user):
# This function simulates the actual query execution logic
# It may raise exceptions that need to be handled
if user.is_staff:
# Simulating a potential exception that could expose sensitive data
raise ValueError("Sensitive information: user@example.com")
return {"data": "some_result"}Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Merge pull request from GHSA-r8qr-wwg3-2r85 (saleor/saleor)
saleor/graphql/core/mutations.py,saleor/graphql/core/mutations.py · BaseBulkMutation.mutate,saleor/graphql/core/mutations.py · BaseMutation.mutate,saleor/graphql/utils/__init__.py,saleor/graphql/utils/__init__.py · format_error
Cite this entry
@misc{vaitp:cve202326051,
title = {{Saleor GraphQL exposes sensitive data in error messages}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2023},
note = {VAITP Python Vulnerability Dataset, entry CVE-2023-26051},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2023-26051/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
