CVE-2025-22151: Strawberry graphql Strawberry GraphQL Has Type Resolution Vulnerability

LOW
Advisory Identifier: GHSA-5xh2-23cc-5jc6
CVSS 3.7
CWE-351 CWE-843
Published
Advisory Summary

CVE-2025-22151 is a LOW (CVSS 3.7) strawberry graphql has type resolution vulnerability (CWE-351: Insufficient Type Distinction) affecting Strawberry graphql libraries in the PyPI ecosystem. The issue involves strawberry graphql has type resolution vulnerability in node interface that allows potential data leakage through incorrect type resolution. Remediation is available by upgrading affected packages to version 0.257.0.

CVE-2025-22151 at a Glance

CVE Identifier CVE-2025-22151
GHSA Identifier GHSA-5xh2-23cc-5jc6
Severity LOW
CVSS v3.1 Base Score 3.7
CWE Classification CWE-351: Insufficient Type Distinction
Affected Product Strawberry graphql
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 3.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2025-22151

To remediate this vulnerability, upgrade all affected Strawberry graphql dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

strawberry-graphql fixed: 0.257.0
pip install strawberry-graphql>=0.257.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show strawberry-graphql

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2025-22151, inspect your installed packages using pip:

pip show strawberry-graphql

Analyze the terminal output to locate any version of Strawberry graphql in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.257.0), your application is affected.

Note: The pip show strawberry-graphql command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-351: Insufficient Type Distinction, where the product does not properly distinguish between different types of elements in a way that leads to insecure behavior. In Strawberry graphql, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

**Vulnerability Summary** A type confusion vulnerability exists in Strawberry GraphQL's relay integration that affects multiple ORM integrations (Django, SQLAlchemy, Pydantic). The vulnerability occurs when multiple GraphQL types are mapped to the same underlying model while using the relay `node` interface. **Affected Components** - Strawberry GraphQL relay integration - Specifically impacts implementations using: - Django integration - SQLAlchemy integration - Pydantic integration **Technical Details** The vulnerability manifests when: 1. Multiple GraphQL types inherit from `relay.Node` 2. These types are mapped to the same database model 3. The global `node` field is used for type resolution Example of vulnerable code: ```python from fruits.models import Fruit import strawberry_django import strawberry @strawberry_django.type(Fruit) class FruitType(relay.Node): name: strawberry.auto @strawberry_django.type(Fruit) class SpecialFruitType(relay.Node): secret_name: strawberry.auto @strawberry.type class Query: node: relay.Node = strawberry_django.node() ``` **Security Impact** When querying for a specific type using the global `node` field (e.g., `FruitType:some-id`), the resolver may incorrectly return an instance of a different type mapped to the same model (e.g., `SpecialFruitType`). This can lead to: 1. Information disclosure if the alternate type exposes sensitive fields 2. Potential privilege escalation if the alternate type contains data intended for restricted access **Note** Even with knowledge of the correct type name (e.g., `SpecialFruitType`), attackers may still be able to access unauthorized data through direct type queries. We recommend to use permission on fields instead of creating a dedicate type. **Recommendations** 1. Avoid mapping multiple relay Node types to the same model 2. Implement strict access controls at the field resolution level (using permissions) 3. Consider using separate models for different access levels of the same data 4. Update to `strawberry-graphql>=0.257.0` 5. If using `strawberry-graphql-django`, update to `strawberry-graphql-django>=0.54.0`

CVE-2025-22151 Affected Strawberry graphql Versions

1 component(s)
Fixed Versions:
0.257.0
Product / Package Ecosystem Affected Versions Fixed Version
strawberry-graphql
PyPI
≥ 0.182.0
< 0.257.0
0.257.0

References

Frequently Asked Questions

What is CVE-2025-22151?
CVE-2025-22151 is a security vulnerability in Strawberry graphql involving Strawberry GraphQL has type resolution vulnerability in node interface that allows potential data leakage through incorrect type resolution under CWE-351: Insufficient Type Distinction.
Which Strawberry graphql versions are affected?
Affected versions include releases prior to 0.257.0 across affected packages: strawberry-graphql.
What version fixes CVE-2025-22151?
Upgrading to 0.257.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is strawberry-graphql affected?
Yes, strawberry-graphql is affected in releases prior to 0.257.0. Upgrade your dependency to 0.257.0 or later.
What is the CVSS score of CVE-2025-22151?
CVE-2025-22151 has a CVSS v3.1 base score of 3.7 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2025-22151?
CVE-2025-22151 is classified under CWE-351: Insufficient Type Distinction (The product does not properly distinguish between different types of elements in a way that leads to insecure behavior.).
How can I check PyPI dependencies for CVE-2025-22151?
Run the dependency tree command: 'pip show strawberry-graphql'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5xh2-23cc-5jc6",
  "modified" : "2025-01-09T22:04:49Z",
  "published" : "2025-01-09T18:51:51Z",
  "aliases" : [ "CVE-2025-22151" ],
  "summary" : "Strawberry GraphQL has type resolution vulnerability in node interface that allows potential data leakage through incorrect type resolution",
  "details" : "**Vulnerability Summary**\nA type confusion vulnerability exists in Strawberry GraphQL's relay integration that affects multiple ORM integrations (Django, SQLAlchemy, Pydantic). The vulnerability occurs when multiple GraphQL types are mapped to the same underlying model while using the relay `node` interface.\n\n**Affected Components**\n- Strawberry GraphQL relay integration\n- Specifically impacts implementations using:\n  - Django integration\n  - SQLAlchemy integration\n  - Pydantic integration\n\n**Technical Details**\n\nThe vulnerability manifests when:\n1. Multiple GraphQL types inherit from `relay.Node`\n2. These types are mapped to the same database model\n3. The global `node` field is used for type resolution\n\nExample of vulnerable code:\n\n```python\nfrom fruits.models import Fruit\nimport strawberry_django\nimport strawberry\n\n@strawberry_django.type(Fruit)\nclass FruitType(relay.Node):\n    name: strawberry.auto\n\n@strawberry_django.type(Fruit)\nclass SpecialFruitType(relay.Node):\n    secret_name: strawberry.auto\n\n@strawberry.type\nclass Query:\n    node: relay.Node = strawberry_django.node()\n```\n\n**Security Impact**\n\nWhen querying for a specific type using the global `node` field (e.g., `FruitType:some-id`), the resolver may incorrectly return an instance of a different type mapped to the same model (e.g., `SpecialFruitType`). This can lead to:\n\n1. Information disclosure if the alternate type exposes sensitive fields\n2. Potential privilege escalation if the alternate type contains data intended for restricted access\n\n**Note**\nEven with knowledge of the correct type name (e.g., `SpecialFruitType`), attackers may still be able to access unauthorized data through direct type queries.\n\nWe recommend to use permission on fields instead of creating a dedicate type.\n\n**Recommendations**\n1. Avoid mapping multiple relay Node types to the same model\n2. Implement strict access controls at the field resolution level (using permissions)\n3. Consider using separate models for different access levels of the same data\n4. Update to `strawberry-graphql>=0.257.0`\n5. If using `strawberry-graphql-django`, update to `strawberry-graphql-django>=0.54.0`",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "strawberry-graphql"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.182.0"
      }, {
        "fixed" : "0.257.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/strawberry-graphql/strawberry/security/advisories/GHSA-5xh2-23cc-5jc6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-22151"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/strawberry-graphql/strawberry/commit/526eb82b70451c0e59d5a71ae9b7396f59974bd8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/strawberry-graphql/strawberry"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-351", "CWE-843" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-01-09T18:51:51Z",
    "nvd_published_at" : "2025-01-09T19:15:20Z"
  }
}