/

CVE-2025-50194

Severity:

HIGH RISK

(7.2)

OS Command Injection in Chamilo Cron Language Check Script

CVE-2025-50194

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution via OS Command Injection

Severity:

HIGH RISK

(7.2)

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

A command injection flaw in Chamilo's /main/cron/lang/check_parse_lang.php script allows user-controlled data to influence operating system commands.

When the vulnerable cron endpoint is reachable and processes attacker-controlled input, an attacker may execute arbitrary system commands with the web server's privileges.

Affected context

This vulnerability appears in Chamilo installations that expose or use the /main/cron/lang/check_parse_lang.php script as part of automated language or translation checks.

The issue is relevant when:

  • The Chamilo application is deployed with cron or scheduled tasks that call this script, and
  • Input that the script uses to build or pass arguments to the operating system can be influenced directly or indirectly by an attacker.

Under these conditions, the script's interaction with the OS becomes a vector for malicious command injection.

Exploit preconditions

  • Attack surface: HTTP(S) access to the Chamilo instance where /main/cron/lang/check_parse_lang.php is reachable, directly or via scheduled/cron execution.
  • Required access: Ability to trigger the cron script or affect the parameters, environment variables, or data it uses (e.g., through application-level inputs, configuration, or language-related data).
  • Trigger point: Execution of an OS command from within check_parse_lang.php that incorporates unvalidated or improperly sanitized data.
  • Why exploitation is possible: The script appears to construct or pass command-line parameters using data that is not safely escaped, validated, or constrained, enabling shell metacharacters or injected command fragments to alter the intended command.

Why this happens

The underlying bug is a classic OS Command Injection issue.

The PHP script responsible for checking or parsing language files likely calls shell utilities (for example, to run parsers, linters, or file operations) using functions such as exec, shell_exec, system, or through backticks.

Instead of strictly validating and constraining inputs to a safe set of characters or using parameterized APIs, the code appears to interpolate dynamic data directly into a shell command line.

This aligns with CWE-78, where external input is incorporated into a system command without adequate sanitization, allowing attackers to inject arbitrary command segments.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the web server or cron user
  • Reading or exfiltrating configuration files, logs, and other accessible data on the server
  • Modifying or deleting application files and data stores reachable by the compromised account
  • Establishing a foothold on the host (e.g., dropping web shells or backdoor scripts)
  • Pivoting to other internal services or infrastructure reachable from the Chamilo server

General mitigation guidance

Mitigation centers on eliminating direct shell command construction from untrusted data and tightening the trust boundaries around background scripts:

  • Replace shell-based operations with language-native APIs where possible (e.g., file handling, parsing, or text processing directly in PHP).
  • If external commands are unavoidable, use APIs that avoid invoking a shell and pass arguments as discrete parameters, while enforcing strict allowlists for command names and arguments.
  • Apply robust validation to all inputs that can influence background scripts: restrict to expected formats (e.g., fixed tokens, language codes, or enums) and reject or neutralize shell metacharacters.
  • Run cron and web server processes with least-privilege accounts and minimal filesystem and network permissions, limiting damage if a command injection occurs.
  • Limit exposure of cron endpoints, avoiding direct public access where feasible, and ensure they are only callable from controlled environments.

How teams detect issues like this

Detection typically combines code-centric review with runtime monitoring:

  • Static analysis: Configure SAST tools to flag risky PHP functions (exec, shell_exec, system, passthru, backticks) when they concatenate variables or user-derived data into commands.
  • Code review: Examine cron and background scripts for any shell command construction; ensure arguments are either constants or rigorously validated and not assembled via string concatenation.
  • Configuration and policy checks: Enforce secure coding guidelines that discourage shell invocation, or mandate use of safer abstractions; add CI checks that block new instances of unsafe command patterns.
  • Runtime monitoring: Use application and OS-level logging to detect anomalous command execution patterns or unexpected use of interpreters and tools from the web or cron context.

Sources

SourceLink
github.comgithub.com/chamilo/chamilo-lms/commit/4d07349340543b9c913e76f8cb436a4570500ce2
github.comgithub.com/chamilo/chamilo-lms/releases/tag/v1.11.30
github.comgithub.com/chamilo/chamilo-lms/security/advisories/GHSA-xrr6-wv8p-5v3p

Frequently asked

questions

It can be, if the cron script or its functionality can be triggered remotely and the parameters it relies on are influenced by remote input. If the script is only callable in tightly controlled internal contexts, the risk of remote exploitation is reduced but not eliminated.

An attacker generally needs the ability to affect the data or parameters that the script passes into OS commands, and a way to cause the script to run. This could be through authenticated application features, misconfigured cron endpoints, or other indirect input paths.

The most robust fix is to remove shell execution entirely from the language-checking flow and rely on native PHP libraries or safe subprocess APIs. If external tools must be used, commands should be hardcoded, arguments strictly validated against allowlists, and no raw string concatenation into shell commands should occur.

Establish coding standards that avoid shelling out from web and cron scripts whenever possible, enforce strict input validation on any data that might reach OS interfaces, and integrate static analysis or security linters into the development pipeline to block unsafe command construction patterns before they reach production.

Find out what's already
exploitable in your codebase.