Skip to content

Set arbitrary config values due to improper input validation for config values

Moderate
gruberroland published GHSA-6cp9-j5r7-xhcc Dec 17, 2024

Package

composer lam (Composer)

Affected versions

<= 8.9

Patched versions

9.0

Description

Summary

LAM does not properly sanitize configuration values, that are set via mainmanage.php and confmain.php. This allows setting arbitrary config values and thus effectively bypassing mitigation of CVE-2024-23333 (GHSA-fm9w-7m7v-wxqv). Further impact is written below.

Details

Configuration values for the main config or server profiles are set via mainmanage.php and confmain.php.
The values are written to config.cfg or serverprofile.conf in the format of settingsName: settingsValue line-by-line.
An attacker can smuggle arbitrary config values in a config file, by inserting a newline into certain config fields, followed by the value.
Take this excerpt as an example for setting the sessionTimeout value in confmain.php

-----------------------------202826601038830835762869144314
Content-Disposition: form-data; name="sessionTimeout"

30
logDestination: /var/www/html/demo.php
-----------------------------202826601038830835762869144314 

The resulting config file contains now two entries for logDestination

[..]
default: lam
logLevel: 4
logDestination: SYSLOG
[..]
license:
sessionTimeout: 30
logDestination: /var/www/html/demo.php
[..]

Due to the line-by-line parsing from reading the config, the logDestination value will be set to the smuggled value, effectively bypassing the valid filename setting for logDestination.

PoC

See above

Impact

  1. The vulnerability allows setting arbitrary values for fields, regardless of sanitization checks.
  2. Bypassing mitigation of CVE-2024-23333 (GHSA-fm9w-7m7v-wxqv).
  3. Disrupt availability by setting invalid settings , e.g. password: {SSHA}A B making it impossible to login.
  4. Further, for server profiles the values are retrieved through reflection. This allows attacker controlled direct access to any property of the LamConfig object and could lead to further potential security impact.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
High
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:H/A:H

CVE ID

CVE-2024-52792

Weaknesses

Credits