GraphQL query operations security can be bypassed
Using the Relay special node type you can bypass the configured security on an operation.
Here is an example of how to apply security configurations for the GraphQL operations:
```php
#[ApiResource(
security: "is_granted('ROLE_USER')",
operations: [ /* ... */ ],
graphQlOperations: [
new Query(security: "is_granted('ROLE_USER')"),
//...
],
)]
class Book { /* ... */ }
```
This indeed checks is_granted('ROLE_USER') as expected for a GraphQL query like the following:
```php
query {
book(id: "/books/1") {
title
}
}
```
But the security check can be bypassed by using the node field (that is available by default) on the root query type like that:
```php
query {
node(id: "/books/1") {
... on Book {
title
}
}
}
```
This does not execute any security checks and can therefore be used to access any entity without restrictions by everyone that has access to the API.
Everyone using GraphQl with the security attribute. Not sure whereas this works with custom resolvers nor if this also applies on mutation.
Patched at https://github.com/api-platform/core/commit/60747cc8c2fb855798c923b5537888f8d0969568
This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality high, integrity none, availability none.
The score comes from this vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
CVE-2025-31481 is classified as CWE-863: Incorrect Authorization. An authorisation check runs but reaches the wrong conclusion, permitting actions it should refuse.
CVE-2025-31481 is recorded against 3 packages.
Published on 4 April 2025 and last revised on 29 August 2025. No public exploit is currently recorded for this entry. Record sourced from NVD.
github.com (Web)
nvd.nist.gov (Advisory)
github.com (Web)
github.com (Web)
github.com (Web)
github.com (Web)
github.com (Package)
github.com (Web)
github.com (Web)
api-platform/core has other advisories on record. If you are patching this one, these are worth checking on the same host:
These advisories are the same class of weakness (CWE-863: Incorrect Authorization) in other software:
Details
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| api-platform/core | 4.1.0-alpha.1 | 4.1.5 |
| api-platform/graphql | 4.1.0-alpha.1 | 4.1.5 |
| unknown | — | — |
References
Similar Threats
Site Security Check
CVE-2025-31481 is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.
Scan My Site Free →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.
Stay up to date with the latest from Boteraser.
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
CloudFlare provides web performance and security solutions, enhancing site speed and protecting against threats.
Service URL: developers.cloudflare.com (opens in a new window)
These cookies are needed for adding comments on this website.
These cookies are used for managing login functionality on this website.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
You can find more information in our Cookie Policy and Privacy Policy.