/

CVE-2026-34602

Severity:

HIGH RISK

(7.1)

Insecure Direct Object Reference (IDOR) in Chamilo LMS

CVE-2026-34602

Analyzed

Vulnerability type

Category:

Insecure Direct Object Reference (IDOR)

CWE:

CWE-639

Impact:

Unauthorized Enrollment and Access Control Bypass

Severity:

HIGH RISK

(7.1)

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

An Insecure Direct Object Reference (IDOR) vulnerability in Chamilo LMS allows authenticated users to manipulate the user parameter in the /api/course_rel_users endpoint to enroll arbitrary accounts into any course.

Because the backend fails to verify that the requester is authorized to act on behalf of the referenced user ID, attackers can tamper with user-course relationships and grant unintended access to course materials.

Affected context

This vulnerability affects Chamilo LMS deployments that expose the /api/course_rel_users endpoint and rely on it for managing course enrollments.

It manifests when the server trusts the user identifier provided in the request body without cross-checking that the authenticated caller is the same user or has explicit privilege (e.g., admin, teacher) to manage that user's enrollments.

Any authenticated account with access to this API can potentially abuse the weakness, regardless of their intended role, as long as the endpoint is reachable and no additional server-side checks are enforced.

Exploit preconditions

  • Attack surface: HTTP API endpoint /api/course_rel_users on the Chamilo LMS server.
  • Required access: Valid authenticated session to the LMS; no elevated admin role is required if the endpoint is broadly accessible.
  • Trigger point: Sending a crafted request body to /api/course_rel_users where the user field is replaced with the ID of a different target account and the course identifier points to any desired course.
  • Why exploitation is possible: The backend uses the client-supplied user ID as the authoritative subject of the enrollment operation without verifying ownership or permission, leading to a direct object reference that is not protected by proper authorization checks.

Why this happens

The underlying issue is a classic Insecure Direct Object Reference (CWE-639).

The API accepts a direct identifier (user ID) for the subject of the enrollment and assumes it is valid and authorized when issued by any authenticated caller.

Instead of deriving the acting user's identity from the session and enforcing role-based authorization on whose enrollments can be modified, the code trusts client-controlled identifiers, allowing one user to act on behalf of others.

This pattern emerges when access control is implemented only at the authentication level (logged in vs. not logged in) and not at the object level (which specific user or resource the caller may modify).

Potential impact

  • Attackers can enroll arbitrary users into courses they did not request or consent to join.
  • Unauthorized users may gain access to restricted course content and learning materials.
  • Instructors' or administrators' intended enrollment workflows and prerequisites can be bypassed.
  • Audit trails and course participation records can be manipulated, undermining platform integrity.
  • Misuse could impact grading, certification, or compliance processes tied to course completion.

General mitigation guidance

Effective mitigation centers on enforcing strict, server-side authorization around object identifiers in API calls:

  • Derive the acting user's identity from the authenticated session or token rather than trusting user IDs in the request body for sensitive operations.
  • Implement object-level access control checks to verify that the caller is either the same user whose enrollment is being modified or has an appropriate role (e.g., admin, course manager) for that target user and course.
  • Treat all client-provided identifiers as untrusted and validate them against the caller's permissions before performing changes to user-course relationships.
  • Centralize authorization logic in reusable policy helpers to ensure consistent checks across all endpoints that manage enrollments and user relationships.
  • Apply the principle of least privilege so that standard learner accounts cannot programmatically manage enrollments for other users.

How teams detect issues like this

Detection efforts can focus on both code and runtime behavior:

  • Static analysis and review: Look for API handlers that:
  • Accept user or account IDs in request bodies or query parameters.
  • Perform updates to enrollment or relationship tables without checking that the authenticated user matches the referenced user or has specific role-based permissions.
  • Code review signals: Endpoints that modify course_rel_users or similar tables should:
  • Use session-derived user IDs.
  • Invoke centralized authorization checks or policy engines before writes.
  • Runtime monitoring: Analyze logs for patterns where a single account frequently enrolls other accounts into many courses, especially where the acting account does not have an administrative role.
  • Automated tools: Identity and access control linters, API contract analyzers, or custom SAST rules can help flag direct object references where user identifiers from requests are used without accompanying permission checks.

Sources

SourceLink
github.comgithub.com/chamilo/chamilo-lms/commit/2a9f060fa9d50fc9a92ed93af774d2619642df92
github.comgithub.com/chamilo/chamilo-lms/commit/bd2ba34c2e74475587e38c74c90c2934e69c8779
github.comgithub.com/chamilo/chamilo-lms/commit/c9c30cdc48afae57cd6ab012ae2eceafd351a40e
github.comgithub.com/chamilo/chamilo-lms/releases/tag/v2.0.0-RC.3
github.comgithub.com/chamilo/chamilo-lms/security/advisories/GHSA-x373-8j9j-g5pj

Frequently asked

questions

Yes, if the Chamilo LMS instance is exposed over the internet and any user can register or log in, an attacker can exploit the flaw remotely as long as they have a valid authenticated session.

No. A regular authenticated user can exploit the issue if they have access to the /api/course_rel_users endpoint; the problem lies in missing object-level authorization checks, not in admin-only functionality.

The safest approach is to stop trusting client-supplied user IDs for enrollment operations: derive the subject user from the authenticated session, and enforce role-aware, server-side authorization policies for any operation that affects another user's enrollments.

Adopt a consistent access control design where:

  • All object identifiers in requests are treated as untrusted.
  • Authorization is centralized and enforced on a per-object basis.
  • Security reviews pay particular attention to endpoints that take user IDs or resource IDs and modify relationships, ensuring they are always checked against the caller's permissions.
Find out what's already
exploitable in your codebase.