/

CVE-2026-33710

Severity:

HIGH RISK

(7.5)

Insufficient Randomness in Chamilo LMS

CVE-2026-33710

Analyzed

Vulnerability type

Category:

Insufficient Randomness

CWE:

CWE-330

Impact:

Unauthorized REST API Access via Predictable API Keys

Severity:

HIGH RISK

(7.5)

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 used a predictable formula based on the current timestamp and user ID to generate REST API keys, drastically reducing the key's effective entropy.

An attacker who knows a username and the approximate time the key was created can brute-force the corresponding API key and gain unauthorized access to the REST API.

Affected context

This vulnerability affects Chamilo LMS deployments that issue REST API keys using the vulnerable key generation routine.

The weakness appears when API keys are derived from low-entropy inputs such as timestamps and user identifiers instead of using a cryptographically secure random source.

It becomes particularly risky in environments where usernames are easy to guess or enumerate and where approximate key creation times can be inferred from user actions or logs.

Exploit preconditions

  • Attack surface: Chamilo REST API endpoints protected by API keys.
  • Required access/knowledge:
  • Knowledge of a valid username (or associated user ID) for which an API key exists.
  • An approximate time window during which the REST API key was created.
  • Trigger point: Automated attempts to compute and test candidate API keys against the REST API using the predictable formula.
  • Why exploitation is possible: API keys are derived from md5(time() + user_id*5 - 10000) with effectively no additional randomness, enabling feasible brute-force of keys within a limited time range.

Why this happens

The root cause is the use of predictable, low-entropy values to generate security tokens, mapping directly to CWE-330: Use of Insufficiently Random Values.

Instead of using a cryptographically secure pseudorandom number generator (CSPRNG), the algorithm relies on:

  • The current timestamp (time()),
  • A deterministic function of the user ID (user_id * 5),
  • And a constant value from rand(10000, 10000), which always returns 10000.

This pattern yields tokens that are deterministic for a given user and time window and can be recomputed by an attacker with partial knowledge, undermining the security of the API key mechanism.

Potential impact

  • An attacker may compute and brute-force valid REST API keys for targeted users.
  • The attacker could perform unauthorized API operations with the permissions of the compromised user.
  • Exposure or modification of sensitive learning data (courses, grades, user information) could occur.
  • Compromise of administrative accounts' API keys may enable broader platform control and data exfiltration.

General mitigation guidance

Mitigation typically involves replacing predictable token generation with cryptographically strong randomness and minimizing reliance on user-controlled or time-based values:

  • Use cryptographically secure random generators to produce API keys and tokens, ensuring sufficient length and entropy.
  • Avoid formulas based on timestamps, user IDs, or other guessable state when constructing security-sensitive identifiers.
  • Separate identifier semantics from security: if a token must be verifiable, use keyed cryptographic constructs (e.g., MACs) instead of reversible or predictable formulas.
  • Limit the lifetime and scope of API keys through expiration policies and fine-grained permissions, reducing the impact of a compromised key.
  • Introduce server-side monitoring and throttling for failed API key usage to make brute-force attempts less practical.

How teams detect issues like this

Detection efforts can focus on both code and operational signals:

  • Static analysis & code review:
  • Flag usages of rand() or other non-cryptographic random sources in security-sensitive contexts (API keys, tokens, session IDs).
  • Look for token generation logic that concatenates or hashes timestamps, user IDs, or other predictable values.
  • Review authentication and authorization modules for custom token schemes instead of established cryptographic primitives.
  • Policy and automated checks:
  • Enforce coding standards that require CSPRNGs for security tokens (e.g., random_bytes, openssl_random_pseudo_bytes, or language equivalents).
  • Integrate security linters and SAST tools in CI pipelines with rules for CWE-330.
  • Runtime monitoring:
  • Monitor for abnormal patterns of failed API-key-based requests, which may indicate brute-force attempts.

Sources

SourceLink
github.comgithub.com/chamilo/chamilo-lms/commit/4448701bb8ec557e94ef02d19c72cbe9c49c2d09
github.comgithub.com/chamilo/chamilo-lms/commit/e7400dd840586ae134b286d0a2374f3d269a9a9d
github.comgithub.com/chamilo/chamilo-lms/security/advisories/GHSA-rpmg-j327-mr39

Frequently asked

questions

Exploitability is significant when an attacker can learn or guess a username and narrow down the approximate time window in which an API key was created, making brute-force search over the reduced key space feasible.

No direct server access is required. The attacker needs network access to the REST API and sufficient information about the target user and key creation time to generate and test candidate keys.

The safest approach is to replace the custom key-generation algorithm with one that uses cryptographically secure random values of adequate length, independent of predictable inputs like timestamps or user IDs.

Treat all authentication tokens, API keys, and session identifiers as cryptographic secrets: generate them with CSPRNGs, avoid deterministic formulas, apply expiration and rotation policies, and enforce coding standards and automated checks that prohibit non-cryptographic randomness in security-critical contexts.

Find out what's already
exploitable in your codebase.