# GHSA-7922-X8P4-55P9: Unintended PHP function invocation via memoized model field values in WPGraphQL

- Database: GitHub
- Severity: CVSS 7.6 (High)
- Published: 2026-09-01
- Modified: 2026-09-04

## Tracked as

- [CVE-2026-18944](https://cve.now/CVE-2026-18944.md): CVE-2026-18944

## Affected versions

- wp-graphql/wp-graphql (Packagist): from 2.3.3, through 2.21.0

## Description

### Summary

The data model layer memoizes a resolved field value back onto the model instance. On a later read of the same field on the same instance, the value was passed to `is_callable()`, which matches plain strings against defined PHP function names case-insensitively. A field value that matches a function name is therefore invoked instead of returned, so an attacker-influenced string value can select a zero-argument PHP function that executes during query resolution.

### Details

`WPGraphQL\Model\Model::__get()` resolves a field's closure once, then memoizes the result by assigning it back onto the model (`$this->$key = $data`, routed through `__set()` into the `fields` array). On the next read of the same field on the same instance, the affected code ran:

```php
if ( is_callable( $this->fields[ $key ] ) ) {
    $data = call_user_func( $this->fields[ $key ] );
    ...
}
```

`is_callable()` returns true for any string that names a defined function, matched case-insensitively, so a memoized string such as `Max`, `time`, or `phpinfo` is treated as callable and invoked rather than returned as data.

This is a regression. A guard added in 2020 (#1144) returned scalars, arrays, and non-callable objects as data before ever testing for a callable, which prevented exactly this. That guard was removed in a readability refactor (#3381) first released in 2.3.3, and the behavior has shipped from 2.3.3 through 2.21.0.

### Impact

- Denial of service, reliable: a value matching a function that requires arguments, for example a user first name of `Max`, calls `max()` with no arguments and throws an uncaught error, returning a 500 for any query that reads the field twice.
- Unintended function execution, value dependent: a value matching a zero-argument function causes that function to run. This is demonstrated: a display name of `time` returns an integer timestamp on the second read instead of the string. Depending on the value this can extend to information disclosure (for example `phpinfo`) or the side effects of other no-argument functions.

The value only needs to be a string an attacker can influence (display names, usernames, and nicenames for an authenticated user, and depending on site configuration comment author names, term names, or titles) and to resolve twice on one model instance, which is achieved by requesting the field twice through a GraphQL alias. Where the affected field is exposed to unauthenticated GraphQL queries, no authentication is required.

### Proof of concept

For a user whose first name is `Max`:

```graphql
{ viewer { firstName again: firstName } }
```

returns a 500 (`max() expects at least 1 argument, 0 given`). With a first name of `time`, `again` returns a Unix timestamp instead of the name, confirming the function is executed rather than the value returned.

### Patches

Fixed in 2.21.1 (#4252). `__get()` now invokes only closures, which is what the model layer produces for unresolved fields, and returns every memoized value as data. Update to 2.21.1 or later.

### Workarounds

None reliable at the configuration level. Updating is the recommended path.

### Credit

Reported by @davidvexel, with a precise root-cause analysis and a bisect to the change that introduced the regression.

## References

- https://github.com/wp-graphql/wp-graphql/security/advisories/GHSA-7922-x8p4-55p9

Page: https://cve.now/GHSA-7922-X8P4-55P9

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
