Summary
Nagios Core and Nagios XI contain an authenticated operating system command injection vulnerability in notification macro substitution. If a notification command places certain notification macros in a shell-executed position, an authenticated UI user may execute arbitrary commands as the nagios service account.
Affected context
The issue can arise in Nagios deployments where notification commands reference the
$NOTIFICATIONCOMMENT$ or $NOTIFICATIONAUTHOR$ macros and pass their expanded values
to a shell-reachable command position. Exploitation generally depends on a non-default
notification configuration and an authenticated user who can cause or influence a
notification event through the administrative interface.
Exploit preconditions
- Attack surface: Nagios Core or Nagios XI notification command processing
- Required access: Authenticated access to the Nagios user interface, with sufficient ability to trigger or influence notifications
- Configuration requirement: A notification command must reference a vulnerable NOTIFICATION-family macro in a shell-executed position
- Trigger point: Macro substitution while Nagios constructs and executes the notification command
- Why exploitation is possible: Unfiltered macro content can reach command interpretation without adequate separation between data and shell syntax
Why this happens
The vulnerability results from expanding attacker-influenced notification macro values
directly into a command line that can be interpreted by a shell. When metacharacters or
other command syntax are not safely separated from executable arguments, data becomes
executable input. This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, commonly known as OS command injection.
Potential impact
- An attacker may execute arbitrary commands as the nagios service account
- The monitoring server could be compromised
- Monitoring data, configurations, or credentials could be altered or exposed
- The attacker could use the compromised service context for further access, depending on permissions
- Monitoring integrity and operational availability could be affected
General mitigation guidance
Mitigation generally focuses on ensuring notification data remains data rather than
executable command content.
Common defensive patterns include:
- Avoiding shell interpretation when invoking notification handlers
- Passing macro values as separately bounded arguments through a safe process-execution API
- Allowing only the notification fields and characters required by the command
- Treating notification comments and author values as untrusted input
- Restricting which authenticated roles can create, modify, or trigger notifications
- Running the Nagios service with the minimum filesystem, process, and network privileges
- Reviewing notification command definitions for shell-reachable macro expansions
How teams detect issues like this
Detection can combine configuration review, code analysis, and runtime monitoring.
Useful approaches include:
- Searching notification command definitions for NOTIFICATION-family macros embedded in shell command strings
- Static analysis for string concatenation or interpolation into shell execution APIs
- Code review checks requiring explicit argument boundaries for external process execution
- Policy enforcement that disallows untrusted macro values in executable command positions
- Monitoring Nagios child-process creation and unusual commands launched by the nagios account
- Auditing authenticated notification activity and changes to command definitions
- Neutral automated security review tools can help identify risky command construction patterns

