GHSA-5C5C-CJJJ-M6MR
Admin API permission bypass via unrestricted relationship includes
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-5C5C-CJJJ-M6MR divulgada · CVSS 4.9 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
An authenticated attacker holding a restricted admin API key can access resources outside the key's assigned permissions by supplying crafted `?include=` parameters to the admin REST API.
The API's relationship permission check uses singular relation names to look up permission configuration entries that are defined using plural resource names. When no matching configuration entry exists, the relationship is automatically permitted, allowing restricted API keys to bypass per-resource permission checks.
As a result, an attacker with a limited admin API key can retrieve unauthorized Orders, Products, Coupons, Invoices, and Invoice Items through otherwise permitted endpoints, potentially exposing sensitive customer, billing, and order information across the application.
Technical Details
`app/Http/Controllers/Api/ApiController.php` validates requested relationships before passing them to the query builder:
$relation = self::MAPPED_INCLUDES[$include] ?? $include;
if (
in_array('admin.' . $relation . '.view', request()->attributes->get('api_key_permissions', [])) ||
config('permissions.api.admin.' . $relation . '.view') === null
) {
$allowedIncludes[] = $include;
}The condition permits a relationship when the API key explicitly holds the corresponding view permission, or when no matching permission configuration entry exists.
However, `config/permissions.php` defines admin API permissions using plural resource names, including:
users
invoices
products
orders
coupons
invoice_items
categoriesMeanwhile, the resource controllers define their supported `INCLUDES` using singular or otherwise unmapped relationship names, such as `order`, `product`, `coupon`, `invoice`, `category`, `items`, and `reference`.
`MAPPED_INCLUDES` only provides mappings for `messages`, `role`, `user`, `ticket`, and `plans.prices`, leaving most of these relationships unmapped.
Consequently, when a client requests the `order` relationship, the permission check evaluates:
config('permissions.api.admin.order.view')Because the configuration defines `orders.view` rather than `order.view`, this lookup returns `null`.
The following condition therefore evaluates to `true`:
config('permissions.api.admin.order.view') === nullThis causes the relationship to be accepted regardless of whether the API key holds `admin.orders.view`.
Spatie QueryBuilder subsequently eager-loads the requested relationship, and the corresponding JSON:API resource serializes the related data without performing an additional relationship-level permission check.
The vulnerability affects restricted admin-type API keys. Although `AdminApiRequest::authorize()` correctly enforces the primary resource's view permission, the relationship authorization check fails to enforce the permissions required to access included resources.
Impact
An attacker possessing a valid but restricted admin API key can bypass relationship-level authorization and retrieve resources outside the key's explicitly assigned permissions.
The vulnerability does not provide unauthenticated access or bypass the primary endpoint's authorization check. An attacker must possess a valid admin-type API key with permission to access the parent resource.
However, once that requirement is satisfied, the attacker can retrieve related resources without their corresponding view permissions, undermining the intended API key permission boundaries and exposing information that restricted integrations should not be authorized to access.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistpaymenter/paymenter |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/Paymenter/Paymenter/security/advisories/GHSA-5c5c-cjjj-m6mrLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
