/

CVE-2026-40291

Severity:

HIGH RISK

(8.8)

Broken Access Control / Authorization Bypass in Chamilo LMS

CVE-2026-40291

Analyzed

Vulnerability type

Category:

Broken Access Control / Authorization Bypass

CWE:

CWE-269, CWE-863

Impact:

Privilege Escalation to Administrator

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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_STUDENT can authenticate against the API
  • The API's security layer only checks that a user is editing their own user record
  • The roles field 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 roles field (e.g., adding ROLE_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.

Sources

SourceLink
github.comgithub.com/chamilo/chamilo-lms/releases/tag/v2.0.0-RC.3
github.comgithub.com/chamilo/chamilo-lms/security/advisories/GHSA-7phx-w897-4c9x

Frequently asked

questions

Yes. Any attacker who can obtain valid student-level credentials and reach the Chamilo LMS API over the network can attempt to exploit the vulnerable endpoint, without needing local or server-side access.

No administrative access is required. A basic authenticated account with ROLE_STUDENT is sufficient, as the flaw lies in the lack of additional checks when updating the roles field on one's own user record.

The safest pattern is to remove role and other security-sensitive fields from user self-service update operations and enforce that such attributes can only be modified by trusted administrative processes, guarded by explicit authorization rules that check for high-privilege roles.

Establish a clear inventory of security-critical fields, enforce separate access control policies for them, and integrate authorization-specific tests into development workflows. Combine careful API design (read-only for sensitive fields), robust server-side checks, and automated reviews to ensure that object ownership checks are not used as a blanket proxy for permission to modify sensitive attributes.

Find out what's already
exploitable in your codebase.