Summary
Pagekit CMS 1.0.18 contains a privilege escalation flaw where users with the "user: manage users" permission can assign arbitrary custom roles to themselves due to missing authorization checks in the user API.
By granting themselves roles with high-impact permissions like "system: manage packages," attackers can upload and install malicious PHP packages through the admin installer, leading to remote code execution under certain deployment configurations.
Affected context
This vulnerability occurs in Pagekit CMS environments where:
- The User API controller is exposed to authenticated administrative users.
- Role assignment and permission management are handled via API calls rather than strictly controlled workflows.
- Authorization checks on who may assign powerful roles (e.g., with "system: manage packages") are incomplete or misconfigured.
It becomes risky when users who can manage other users are not strictly limited from elevating their own privileges or installing packages that run server-side PHP code.
Exploit preconditions
- Attack surface: Pagekit CMS administrative interface and underlying User API.
- Required access: Authenticated user account with "user: manage users" permission, or equivalent rights to call
UserApiController::saveAction(). - Trigger point: Sending crafted requests to the user management API to assign or modify custom roles on the attacker's own account.
- Why exploitation is possible: The
saveAction()path lacks proper authorization checks ensuring that the caller is permitted to assign high-privilege roles, enabling self-escalation to permissions such as "system: manage packages," and subsequent installation of arbitrary PHP packages.
Why this happens
The root cause aligns with CWE-862: Missing Authorization, where critical operations rely on authenticated status but do not enforce sufficient authorization checks for specific actions.
In this case, the User API controller allows role assignment and updates without verifying whether the caller is allowed to grant high-privilege capabilities to a given account, including their own.
This missing enforcement of role boundaries turns a mid-level administrative permission ("user: manage users") into a path for full administrative control and arbitrary code execution via package installation.
Potential impact
- Attackers may escalate from user management rights to full administrator capabilities.
- Attackers could upload and install malicious PHP packages through the package management system.
- Attackers can achieve remote code execution in the web server context running Pagekit.
- Attackers may modify CMS configuration, content, and user accounts, impacting site integrity and availability.
- Attackers could exfiltrate or tamper with data stored or processed by Pagekit.
General mitigation guidance
Mitigation focuses on enforcing strict authorization rules around role and permission management and limiting high-impact capabilities by default.
Useful patterns include:
- Enforcing separation of duties so that user management permissions cannot directly grant system-level or package management rights.
- Introducing explicit authorization checks on role assignment operations, ensuring that only trusted, high-privilege administrators can grant or modify powerful roles.
- Applying least-privilege principles to role definitions, avoiding roles that bundle broad system, package, and code execution capabilities unnecessarily.
- Restricting package installation to curated, signed, or vetted packages and decoupling it from general administrative accounts where feasible.
- Using defense-in-depth controls such as disabling arbitrary PHP package uploads, limiting file system write locations, and constraining runtime privileges of the web server process.
How teams detect issues like this
High-level detection can rely on both code-centric and operational signals:
- Static analysis or manual code review to identify controller actions that change roles, permissions, or access levels without explicit authorization gates.
- Review of access control policies to ensure that "manage users" is clearly separated from "manage packages" and other high-risk capabilities.
- Monitoring logs for unusual role assignment activity, such as a mid-level administrator account suddenly gaining system-level or package management permissions.
- Implementing policy checks or automated tests that verify only specific roles are allowed to perform package installation or other high-risk operations.
- Using automated security review tools that flag endpoints allowing role or permission changes without corresponding authorization checks.

