/

CVE-2026-58256

Severity:

CRITICAL RISK

(9.1)

PHP Code Injection (CWE-94) in GRR LDAP Connector Settings

CVE-2026-58256

Deferred

Vulnerability type

Category:

PHP Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.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

A critical PHP code injection vulnerability in GRR allows malicious input from LDAP connector settings to be written into a PHP configuration file.

An administrator who connects GRR to an attacker-controlled LDAP server and submits crafted connector values may enable remote code execution by the application.

A critical PHP code injection vulnerability in GRR allows malicious input from LDAP connector settings to be written into a PHP configuration file.

An administrator who connects GRR to an attacker-controlled LDAP server and submits crafted connector values may enable remote code execution by the application.

Affected context

The issue occurs in GRR deployments that use the LDAP connector and allow an administrator to configure LDAP connection settings through the application interface. Risk is present when connector parameters, such as LDAP filters, are incorporated into the PHP configuration file without sufficient output encoding or validation, particularly after an administrator has connected to an untrusted or attacker-controlled LDAP server.

The issue occurs in GRR deployments that use the LDAP connector and allow an administrator to configure LDAP connection settings through the application interface. Risk is present when connector parameters, such as LDAP filters, are incorporated into the PHP configuration file without sufficient output encoding or validation, particularly after an administrator has connected to an untrusted or attacker-controlled LDAP server.

Exploit preconditions

  • Attack surface: GRR's LDAP connector configuration workflow
  • Required access: Administrative access to configure or update LDAP connector settings
  • Required external condition: The administrator must successfully connect to an LDAP server, which may be attacker-controlled
  • Trigger point: Submission of subsequent connector settings containing malicious PHP input
  • Why exploitation is possible: User-controlled connector values are written into a PHP configuration file in a form that can later be interpreted as executable PHP code
  • Attack surface: GRR's LDAP connector configuration workflow
  • Required access: Administrative access to configure or update LDAP connector settings
  • Required external condition: The administrator must successfully connect to an LDAP server, which may be attacker-controlled
  • Trigger point: Submission of subsequent connector settings containing malicious PHP input
  • Why exploitation is possible: User-controlled connector values are written into a PHP configuration file in a form that can later be interpreted as executable PHP code

Why this happens

The vulnerability results from treating LDAP connector configuration data as trusted PHP source code rather than as data.

When values such as LDAP filters are inserted into personnalisation/config_ldap.inc.php without context-appropriate encoding, validation, or safe serialization, an attacker-controlled value can alter the generated PHP file. This behavior maps to CWE-94: Improper Control of Generation of Code, because externally influenced data can affect executable code generated by the application.

The vulnerability results from treating LDAP connector configuration data as trusted PHP source code rather than as data.

When values such as LDAP filters are inserted into personnalisation/config_ldap.inc.php without context-appropriate encoding, validation, or safe serialization, an attacker-controlled value can alter the generated PHP file. This behavior maps to CWE-94: Improper Control of Generation of Code, because externally influenced data can affect executable code generated by the application.

Potential impact

  • An attacker may execute arbitrary PHP code in the GRR application context
  • The application may be fully compromised
  • Confidential reservation or personnel data could be accessed or modified
  • Credentials, configuration secrets, or LDAP integration data could be exposed
  • The host may be used for persistence, lateral movement, or further attacks
  • An attacker may execute arbitrary PHP code in the GRR application context
  • The application may be fully compromised
  • Confidential reservation or personnel data could be accessed or modified
  • Credentials, configuration secrets, or LDAP integration data could be exposed
  • The host may be used for persistence, lateral movement, or further attacks

General mitigation guidance

Mitigation generally focuses on ensuring that configuration values remain data and cannot become executable PHP source.

Common defensive patterns include:

  • Store connector settings in a data-only format with a safe serializer rather than generating executable PHP
  • Apply strict allowlist validation for LDAP parameters and reject unexpected syntax
  • Use context-appropriate escaping when values must be embedded in configuration output
  • Treat LDAP servers and returned configuration data as untrusted until explicitly verified
  • Restrict configuration-writing capabilities to narrowly scoped administrative roles
  • Run the application with least privilege and isolate its writable configuration paths
  • Prevent the web process from modifying executable application code where operationally feasible

Mitigation generally focuses on ensuring that configuration values remain data and cannot become executable PHP source.

Common defensive patterns include:

  • Store connector settings in a data-only format with a safe serializer rather than generating executable PHP
  • Apply strict allowlist validation for LDAP parameters and reject unexpected syntax
  • Use context-appropriate escaping when values must be embedded in configuration output
  • Treat LDAP servers and returned configuration data as untrusted until explicitly verified
  • Restrict configuration-writing capabilities to narrowly scoped administrative roles
  • Run the application with least privilege and isolate its writable configuration paths
  • Prevent the web process from modifying executable application code where operationally feasible

How teams detect issues like this

Detection can include static analysis for concatenation of request or connector values into PHP files, dynamic code-generation APIs, and configuration writers that emit unescaped executable syntax.

Code review should examine LDAP setup workflows, administrator-controlled fields, output encoding, serialization choices, and file permissions on generated configuration files. Runtime monitoring can alert on unexpected changes to personnalisation/config_ldap.inc.php, PHP syntax appearing in configuration values, unusual child processes from the web application, and outbound connections to unapproved LDAP servers. CI policies and automated code-review tools can help flag these patterns before deployment.

Detection can include static analysis for concatenation of request or connector values into PHP files, dynamic code-generation APIs, and configuration writers that emit unescaped executable syntax.

Code review should examine LDAP setup workflows, administrator-controlled fields, output encoding, serialization choices, and file permissions on generated configuration files. Runtime monitoring can alert on unexpected changes to personnalisation/config_ldap.inc.php, PHP syntax appearing in configuration values, unusual child processes from the web application, and outbound connections to unapproved LDAP servers. CI policies and automated code-review tools can help flag these patterns before deployment.

Sources

SourceLink
github.comgithub.com/JeromeDevome/GRR/commit/3ff9504ae557da1e8e208149acbf8c7f04de645f
github.comgithub.com/JeromeDevome/GRR/security/advisories/GHSA-fp4f-xmw6-5jf8
github.comgithub.com/JeromeDevome/GRR/tree/v4.5.0

Frequently asked

questions

Exploitation is possible through the application workflow, but it generally requires authenticated administrator access and the ability to configure an LDAP connection. The LDAP server involved may be attacker-controlled.

No direct host access is necessarily required. The relevant prerequisite is the ability to use the administrative LDAP connector workflow and submit values that are later written to the PHP configuration file.

Keep configuration values in a data-only representation, validate them against strict expected formats, and ensure they cannot be interpreted as PHP code when persisted or loaded.

Treat administrator-provided and LDAP-derived values as untrusted, avoid generating executable configuration files, enforce least privilege, and monitor changes to application configuration and code paths.

Exploitation is possible through the application workflow, but it generally requires authenticated administrator access and the ability to configure an LDAP connection. The LDAP server involved may be attacker-controlled.

No direct host access is necessarily required. The relevant prerequisite is the ability to use the administrative LDAP connector workflow and submit values that are later written to the PHP configuration file.

Keep configuration values in a data-only representation, validate them against strict expected formats, and ensure they cannot be interpreted as PHP code when persisted or loaded.

Treat administrator-provided and LDAP-derived values as untrusted, avoid generating executable configuration files, enforce least privilege, and monitor changes to application configuration and code paths.

Find out what's already
exploitable in your codebase.