Summary
Chamilo LMS versions prior to 2.0.0-RC.3 allow any authenticated student user to escalate their privileges to administrator by modifying the roles field on their own account via the PUT /api/users/{id} endpoint.
Because the API only verifies ownership of the user record and treats the roles field as writable, a student can assign themselves ROLE_ADMIN, gaining full control over the platform and all associated data.
Affected context
This vulnerability appears in Chamilo LMS deployments that expose the REST API, specifically the PUT /api/users/{id} endpoint.
It manifests when:
- Users with
ROLE_STUDENTcan authenticate against the API - The API's security layer only checks that a user is editing their own user record
- The
rolesfield is part of a writable serialization group and is not subject to stricter authorization rules
In such environments, normal students can manipulate their own role assignments without administrative approval.
Exploit preconditions
- Attack surface: HTTP(S) API endpoint
PUT /api/users/{id}on the Chamilo LMS instance. - Required access: Valid authentication as a user with at least
ROLE_STUDENT, and knowledge of their own user ID. - Trigger point: Sending an HTTP PUT request updating the user's record, including a modified
rolesfield (e.g., addingROLE_ADMIN). - Why exploitation is possible:
- The API Platform security expression
is_granted('EDIT', object)only enforces that the caller owns the targeted user object. - Role assignment is treated like any other writable attribute and is not protected by a separate privilege check.
- There is no server-side constraint preventing low-privilege users from assigning high-privilege roles to themselves.
Why this happens
The underlying issue is a broken authorization model around role management, mapped to CWE-269: Improper Privilege Management and CWE-863: Incorrect Authorization.
Instead of treating role changes as a sensitive operation requiring elevated privileges, the API allows any user who can edit their own profile to also edit their roles array.
Conceptually, the security policy conflates object ownership with permission to modify sensitive fields, trusting that if a user owns a record then all properties on that record are safe to modify.
This pattern fails when certain fields (like roles, status flags, or organizational bindings) represent security-critical attributes that must be governed by separate, stricter access control checks.
Potential impact
- A student user may escalate their privileges to
ROLE_ADMIN. - An attacker with a student account could gain full administrative control over the LMS instance.
- Compromise of all user accounts, including reading and modifying personal data and credentials metadata.
- Unauthorized access to all courses, content, and gradebooks.
- Manipulation or deletion of course data, assessments, grades, and learning records.
- Changes to global platform configuration, including security and integration settings.
- Potential for further compromise of connected systems via administrative integrations or plugins.
General mitigation guidance
Effective mitigation focuses on treating role management as a privileged, tightly-controlled operation rather than a generic profile update:
- Separate sensitive fields (e.g.,
roles, account status, ownership) from regular user-editable fields and exclude them from generic writable serialization groups. - Apply fine-grained authorization rules for these fields, ensuring only administrators or dedicated management flows can modify them.
- Use server-side role assignment logic rather than trusting client-side input for roles or other security attributes; ignore role-related values supplied by non-privileged clients.
- Adopt a least privilege model where default roles are minimal, and elevations are performed through explicit, audited workflows.
- Introduce defense-in-depth checks, such as business rules that prevent low-privilege roles from assigning or holding high-privilege roles, even if they reach the update path.
- Regularly review API schemas and serialization groups to confirm that security-critical fields are read-only or restricted to appropriate actors.
How teams detect issues like this
To detect this type of issue, organizations can:
- Perform authorization-focused code reviews, looking for:
- Security expressions that only check ownership (e.g.,
is_granted('EDIT', object)) on entities containing security-sensitive fields. - Sensitive properties (like
roles,isAdmin,permissions) included in writable serialization or DTOs. - Use static analysis or linters to flag patterns where role or permission fields are directly bound from client input without additional privilege checks.
- Implement API-level access control tests in CI that:
- Attempt role escalation from low-privilege accounts as part of automated security regression suites.
- Verify that sensitive fields are immutable for non-admin users.
- Monitor audit logs and application logs for:
- Unusual spikes in role changes, especially students gaining administrative roles.
- Changes to high-privilege roles originating from non-administrative accounts.
- Periodically run dynamic security testing (DAST) focused on authorization, including IDOR and privilege escalation scenarios.

