Oct 9, 2026·5 min read·20 visits
Strawberry GraphQL fails to validate the return types of synchronous permission functions, allowing unawaited coroutines to evaluate as True and bypass access control.
An authorization bypass vulnerability in Strawberry GraphQL between versions 0.217.0 and 0.326.1 occurs when a synchronous permission handler returns an awaitable object (such as an unawaited coroutine). Due to Python's truthiness rules, the unawaited coroutine is evaluated as True, leading to an immediate bypass of security policies.
Strawberry GraphQL is a widely utilized Python library designed to build GraphQL APIs. The framework supports validating fields through permission classes, which check if the requesting user possesses the required authorizations before executing the corresponding field resolvers. This mechanism supports both synchronous and asynchronous modes of operation.
Between versions 0.217.0 and 0.326.1, a flaw exists in how the library handles synchronous field permission checks that return awaitable objects. The vulnerability allows an unauthenticated or unauthorized remote attacker to bypass permission validations. The flaw originates in the PermissionExtension.resolve() method, which performs direct truthiness checks on results returned from synchronous permission functions.
This vulnerability introduces a risk of unauthorized data disclosure, as custom permission decorators can be silently bypassed. Field resolvers that were intended to be private or restricted become accessible to any client.
The vulnerability is caused by a design discrepancy in Python's evaluation of coroutine objects coupled with the limitation of the supports_sync utility in Strawberry GraphQL. The library checks the asynchronous status of a permission class via inspect.iscoroutinefunction(permission.has_permission). If a developer defines the has_permission method using a standard synchronous declaration (def), this check evaluates to False.
Consequently, execution is routed through the synchronous path inside PermissionExtension.resolve(). If the developer's synchronous implementation returns an unawaited coroutine—for example, by calling an internal asynchronous function or external database wrapper without an asynchronous loop—the permission class returns a coroutine object instead of a boolean value.
In Python, all coroutines and awaitable objects evaluate to True when evaluated in a boolean context. The synchronous resolver checks truthiness using 'if not permission.has_permission(...)'. Because the returned coroutine object evaluates to True, the if statement evaluates to False, skipping the unauthorized logic path. The library assumes the check succeeded and executes the resolver, resulting in an authorization bypass.
Here is a visual mapping of the vulnerable execution flow:
The vulnerability resides in the validation path of strawberry/permission.py. When checking permissions, the code originally executed the permission verification directly within an 'if not' statement.
Below is the vulnerable implementation within strawberry/permission.py:
def resolve(self, next_, source, info, **kwargs) -> Any:
for permission in self.permissions:
# Vulnerable: If has_permission returns a coroutine,
# 'not coroutine' is evaluated, which is always False.
if not permission.has_permission(source, info, **kwargs):
return self._on_unauthorized(permission)
return next_(source, info, **kwargs)The fix introduced in version 0.326.1 checks if the return value of has_permission is awaitable. If inspect.isawaitable(has_permission) returns True in a synchronous context, the system raises an exception rather than proceeding.
Below is the patched implementation:
def resolve(self, next_, source, info, **kwargs) -> Any:
for permission in self.permissions:
has_permission = permission.has_permission(source, info, **kwargs)
# Patched: Validate if an awaitable was returned in sync context
if inspect.isawaitable(has_permission):
# Close the coroutine to prevent resource leaks
if inspect.iscoroutine(has_permission):
has_permission.close()
# Fail closed by throwing an explicit exception
raise PermissionReturnedAwaitableInSyncContextError(permission)
if not has_permission:
return self._on_unauthorized(permission)
return next_(source, info, **kwargs)The fix ensures that any attempt to return an awaitable object inside a synchronous resolution path raises a PermissionReturnedAwaitableInSyncContextError exception. This causes the request to fail closed, preventing exposure of sensitive fields.
An attacker can exploit this bypass if a custom permission class evaluates authorization synchronously but delegates to asynchronous helpers. The exploit requires no special privileges and is executed over the network by sending a standard GraphQL query.
Below is a demonstration of how a vulnerable implementation behaves. The permission class is defined synchronously, but mistakenly returns an unawaited coroutine:
class VulnerableBypassPermission(BasePermission):
message = "Unauthorized Access"
def has_permission(self, source, info, **kwargs) -> Any:
async def verify_user():
# This logic should return False to deny access
return False
# Returns the coroutine object itself
return verify_user()When a request is submitted to the server for a field protected by VulnerableBypassPermission, the engine resolves the field synchronously. Because the returned coroutine object is inherently truthy, the bypass is completed, and the backend resolves the field despite the logic within verify_user evaluating to False.
The impact of this vulnerability is classified as High, with a CVSS v3.1 base score of 7.5. The vulnerability allows complete bypass of application-level access controls designed to secure specific GraphQL fields. An attacker can access sensitive information, administrative fields, or trigger operations they are unauthorized to execute.
Because the bypass occurs silently without logging an error or exception, detecting the exploitation via standard application logs can be difficult unless the application monitors the exact types of objects returned by permissions. The exploitation complexity is low, requiring only standard GraphQL query structures.
There is no integrity or availability impact as the flaw is an information leakage and access bypass. However, if the field resolver performs write operations (such as mutations executing under synchronous resolvers), integrity impact could also occur depending on the specific implementation.
To mitigate CVE-2026-107728, developers must upgrade the strawberry-graphql package to version 0.326.1 or higher. The upgraded library implements defensive checks to block the synchronous execution of awaitable objects.
For legacy deployments where immediate patching is not possible, developers must audit all BasePermission subclasses. Ensure that any has_permission function using standard def returns a primitive boolean. If asynchronous functions must be invoked, the method should be redeclared as async def.
A Semgrep rule can automate the identification of vulnerable patterns. The rule should flag any synchronous has_permission function that returns calls to functions known to return coroutines or awaitables.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
strawberry-graphql strawberry-graphql | >= 0.217.0, < 0.326.1 | 0.326.1 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-863 |
| Attack Vector | Network |
| CVSS Score | 7.5 |
| EPSS Score | 0.00353 |
| EPSS Percentile | 26.95% |
| Impact | High (Confidentiality) |
| Exploit Status | Proof of Concept |
| CISA KEV Status | Not Listed |
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly prove that the actor has the authorization to do so.
File Browser versions prior to 2.63.17 contain an authorization and state-management flaw in the BoltDB storage backend. When an authenticated user deletes a shared directory via an HTTP request with a trailing slash (e.g., DELETE /api/resources/a/), the share cleanup routine queries the database index using the unnormalized path before stripping the trailing slash. Because canonical share paths are stored without trailing slashes (e.g., /a), the database prefix query fails to match the parent directory share record. If a directory with the same name is later recreated, the dormant public share hash automatically reactivates and exposes the new directory contents to unauthenticated users.
An uncontrolled memory allocation vulnerability exists in ag-psd versions prior to 31.0.0. When parsing Adobe Photoshop Document (PSD) files, the readPsd() function reads image dimensions and color depth directly from the file header and allocates off-heap typed arrays without validating whether the requested memory size is proportional to the input stream or bounded by operational thresholds. An unauthenticated attacker can supply a crafted 52-byte PSD payload that triggers an immediate 3.35 GB memory allocation, resulting in process termination via the operating system Out-Of-Memory (OOM) killer.
CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).
CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.
An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.
CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.