Summary
Icinga 2 fails to escape attacker-controlled template names written through the /v1/objects API, allowing an authorized API user to inject Icinga DSL configuration. A user with object-creation permissions may escape the intended object definition, create additional objects, and exceed assigned privileges.
Affected context
The vulnerability occurs in Icinga 2 deployments where the /v1/objects API accepts template names from authenticated users and incorporates those names into generated Icinga 2 configuration without adequate escaping. It is relevant when an ApiUser has an objects/create/* permission and can submit object-creation requests through the API.
Exploit preconditions
- Attack surface: The authenticated /v1/objects API - Required access: An authenticated ApiUser account - Required authorization: Permission to create objects through objects/create/* - Trigger point: Processing a request containing an attacker-controlled
template name
- Why exploitation is possible: The supplied name is written into generated
Icinga DSL without context-appropriate escaping, allowing configuration
syntax to escape the intended object definition
Why this happens
The underlying flaw is insufficient output encoding when user-controlled template names are transformed into Icinga 2 DSL configuration. Instead of treating the name strictly as data, the application places it into a configuration language without safely escaping syntax-significant content. This maps to CWE-94, Improper Control of Generation of Code, because input can influence generated configuration in a way that changes its interpreted structure and behavior.
Potential impact
- An attacker may inject additional Icinga 2 DSL configuration.
- An attacker could create objects beyond the intended request scope.
- The vulnerable account may exceed its assigned API privileges.
- Monitoring behavior, alerting rules, or managed object state may be altered.
- The deployment may experience unauthorized configuration changes or service disruption.
General mitigation guidance
Mitigation generally focuses on preserving the distinction between data and generated configuration. Template names and related identifiers should be validated against a strict allowlist of permitted characters and encoded for the exact Icinga DSL context before being emitted. Secure-by-default API designs can avoid generating executable configuration from raw request data, use structured object construction where available, and apply schema validation before persistence or reload. API permissions should follow least privilege, with narrowly scoped object-creation rights and restricted access to configuration-management functions.
How teams detect issues like this
Detection can include static-analysis rules for concatenating request-derived values into configuration or code-like output, especially where escaping is absent. Code reviews should examine template-name handling, generated DSL boundaries, validation logic, and authorization checks around object creation. Runtime monitoring can alert on unusual object names, unexpected configuration additions, privilege-inconsistent API activity, and changes outside approved deployment workflows. CI policy checks and neutral automated review tools may help identify unsafe output-generation patterns.

