Summary
phpMyFAQ before 4.1.5 contains a privilege escalation flaw in the user/add admin API that lets delegated administrators create new SuperAdmin accounts by setting an isSuperAdmin flag.
If an attacker controls an admin account with user management rights, they can create a SuperAdmin user with arbitrary credentials and then log in as that user to fully take over the instance.
Affected context
This vulnerability arises in phpMyFAQ deployments where non-SuperAdmin administrators are granted permissions to add, edit, or delete users via the admin API.
The risky behavior occurs when the POST /admin/api/user/add endpoint accepts privilege-related attributes (such as isSuperAdmin) from these lower-privileged accounts without sufficient server-side enforcement.
Environments that delegate user lifecycle operations to mid-level admins, or that expose the admin API over internal networks, are more likely to be impacted.
Exploit preconditions
- Attack surface: Authenticated phpMyFAQ admin interface and its
/admin/api/user/addendpoint. - Required access: An administrator account with
USER_ADD,USER_EDIT, orUSER_DELETEpermissions but not SuperAdmin privileges. - Trigger point: Sending a
POST /admin/api/user/addrequest that includesisSuperAdmin: truealong with attacker-chosen username and password. - Why exploitation is possible: The backend logic does not sufficiently enforce role boundaries and allows lower-privileged admins to assign the highest privilege level to new accounts, violating the principle of least privilege (CWE-269).
Why this happens
The root cause is improper privilege management in the authorization logic for user creation.
The application trusts that any administrator with user management permissions may set high-privilege flags (e.g., isSuperAdmin) without re-validating the caller's own role or enforcing a permission check specific to SuperAdmin creation.
This maps to CWE-269: Improper Privilege Management, where the system fails to restrict operations that change or grant elevated privileges to appropriately authorized roles, enabling indirect escalation through legitimate functionality.
Potential impact
- An attacker-controlled administrator account can create new SuperAdmin users.
- Full phpMyFAQ instance takeover via elevated SuperAdmin access.
- Modification or deletion of all FAQs, categories, and configuration data.
- Creation of additional backdoor accounts with persistent high privileges.
- Potential chaining into broader application or infrastructure compromises if phpMyFAQ is integrated with other systems.
General mitigation guidance
Mitigation generally focuses on tightening authorization rules around privilege-changing operations and reinforcing least-privilege role design.
Useful patterns include:
- Restricting creation, modification, and deletion of high-privilege roles (such as SuperAdmin) to a small, dedicated privilege set distinct from general user management rights.
- Implementing server-side checks that validate the caller's role before allowing privilege flags like
isSuperAdminto be set or changed, ignoring such flags from lower-privileged callers. - Centralizing role and permission checks in an authorization layer rather than trusting client-supplied fields in API requests.
- Designing roles so that delegated administrators manage ordinary users only, without any capability to assign or escalate to top-level privileges.
- Logging and monitoring all role changes and high-privilege account creations to support rapid detection and response.
How teams detect issues like this
Effective detection relies on examining both code and runtime behavior for improper privilege management patterns.
Common approaches include:
- Static analysis and code review focused on user-management endpoints, checking that any operation which sets or modifies roles, privilege flags, or SuperAdmin status performs explicit authorization checks tied to the caller's role.
- Searching for API handlers that accept privilege-related parameters (e.g.,
isSuperAdmin,role,permissions) from clients and verifying that these are not blindly trusted or persisted. - Implementing security policies that flag high-privilege account creation events, especially those initiated by non-SuperAdmin accounts, and sending alerts for review.
- Using automated application security testing tools to probe admin APIs for privilege escalation by attempting to set elevated roles from lower-privileged test accounts.

