Summary
A code injection vulnerability in DIRAC allows an authenticated caller to provide a crafted grouping attribute that is evaluated as Python code. Under affected configurations, successful exploitation may execute operating-system commands with the privileges of the DIRAC service account and compromise the distributed-computing environment.
Affected context
The vulnerability occurs in DIRAC's Request Management System when the web request-counter functionality accepts a caller-controlled grouping attribute. It becomes risky when an unrecognized attribute is resolved dynamically against a Request object and evaluated as Python code, particularly when the service account has access to configuration files, credentials, proxies, or tokens.
Exploit preconditions
- Attack surface: Request Management System web service and its request-counter endpoint
- Required access: An authenticated DIRAC account able to invoke the affected functionality
- Trigger point: Processing of a caller-supplied grouping attribute by
getRequestCountersWeb - Why exploitation is possible: Unrecognized input is dynamically resolved and evaluated as Python code, allowing access to operating-system functionality
- Execution context: Commands run with the privileges of the account operating the DIRAC services
Why this happens
The underlying bug is the evaluation of attacker-influenced attribute expressions as executable Python rather than treating them as data. Dynamic resolution against a Request object, combined with insufficient allowlisting and expression evaluation, permits crafted dunder attribute chains to reach sensitive runtime functionality. This behavior maps to CWE-95, Improper Neutralization of Directives in Dynamically Evaluated Code.
Potential impact
- An attacker may execute operating-system commands as the DIRAC service account.
- The attacker could read
dirac.cfg, database passwords, stored proxies, and access tokens. - The DIRAC system and connected distributed-computing resources may be fully compromised.
- Data, jobs, or service configuration could be altered.
- Local log evidence may be modified or removed, weakening forensic investigation.
General mitigation guidance
Mitigation generally focuses on removing dynamic code evaluation from request
processing and reducing trust in caller-controlled grouping values.
Common defensive patterns include:
- Replacing expression evaluation with a fixed allowlist mapping of supported grouping attributes.
- Treating grouping parameters as inert data and rejecting unknown or malformed values before object access.
- Avoiding reflective access to dunder attributes and other interpreter internals.
- Running DIRAC services with least-privilege identities and limiting access to credentials, proxies, and tokens.
- Isolating service accounts and applying restrictive permissions to configuration and log files.
- Protecting authenticated web interfaces with narrowly scoped roles and authorization policies.
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules targeting
eval, dynamic expression evaluators, reflective attribute traversal, and unrestricted dunder access. - Code review checks for caller-controlled values passed into interpreters, template engines, or object-resolution helpers.
- Tests that submit unknown, malformed, and boundary grouping attributes and verify rejection without evaluation.
- Runtime monitoring for unexpected child processes, command execution, access to credential files, or unusual service-account activity.
- Policy enforcement requiring explicit allowlists for API parameters that select fields, attributes, or query groupings.
- Automated security review tools that flag dynamic evaluation and unsafe reflection patterns.

