Summary
FreePBX's Music on Hold module stores a user-supplied Asterisk application and later writes it into an Asterisk configuration file without adequate validation. An authenticated FreePBX administrator may abuse this behavior to execute arbitrary system commands with the privileges of the Asterisk service.
FreePBX's Music on Hold module stores a user-supplied Asterisk application and later writes it into an Asterisk configuration file without adequate validation. An authenticated FreePBX administrator may abuse this behavior to execute arbitrary system commands with the privileges of the Asterisk service.
Affected context
The issue occurs in FreePBX deployments using the Music on Hold module when an authenticated administrator can submit a custom Asterisk application through the module's web interface. Risk arises when that value is stored in the database and subsequently written to musiconhold_additional.conf without strict validation before Asterisk processes the configuration.
The issue occurs in FreePBX deployments using the Music on Hold module when an authenticated administrator can submit a custom Asterisk application through the module's web interface. Risk arises when that value is stored in the database and subsequently written to musiconhold_additional.conf without strict validation before Asterisk processes the configuration.
Exploit preconditions
- Attack surface: FreePBX's authenticated Music on Hold management interface
- Required access: An existing FreePBX administrator account
- Trigger point: Processing and loading the generated
musiconhold_additional.confconfiguration - Why exploitation is possible: A custom application value is accepted, stored, and emitted into an Asterisk configuration context without sufficient sanitization or allowlist validation
- Attack surface: FreePBX's authenticated Music on Hold management interface
- Required access: An existing FreePBX administrator account
- Trigger point: Processing and loading the generated
musiconhold_additional.confconfiguration - Why exploitation is possible: A custom application value is accepted, stored, and emitted into an Asterisk configuration context without sufficient sanitization or allowlist validation
Why this happens
The vulnerability results from treating an administrator-controlled POST parameter as trusted configuration data. The value is persisted and later incorporated directly into an Asterisk configuration file, allowing configuration syntax to represent executable behavior rather than only approved application names. This is an OS command injection pattern mapped to CWE-78, because attacker-controlled input reaches a command-execution-capable interpreter without effective validation or neutralization.
The vulnerability results from treating an administrator-controlled POST parameter as trusted configuration data. The value is persisted and later incorporated directly into an Asterisk configuration file, allowing configuration syntax to represent executable behavior rather than only approved application names. This is an OS command injection pattern mapped to CWE-78, because attacker-controlled input reaches a command-execution-capable interpreter without effective validation or neutralization.
Potential impact
- An attacker may execute arbitrary system commands as the Asterisk service
- The FreePBX or telephony application runtime could be compromised
- Call records, credentials, or other accessible data could be exposed or modified
- The attacker could disrupt telephony services or alter call-handling behavior
- Additional systems could be targeted if the Asterisk account has excessive permissions
- An attacker may execute arbitrary system commands as the Asterisk service
- The FreePBX or telephony application runtime could be compromised
- Call records, credentials, or other accessible data could be exposed or modified
- The attacker could disrupt telephony services or alter call-handling behavior
- Additional systems could be targeted if the Asterisk account has excessive permissions
General mitigation guidance
Mitigation generally focuses on preventing user-controlled values from becoming executable Asterisk configuration.
Common defensive patterns include:
- Restricting custom application fields to a narrowly defined allowlist of supported values
- Separating data storage from executable configuration generation
- Applying context-aware validation before persistence and again before configuration emission
- Rejecting metacharacters, configuration delimiters, and unexpected syntax rather than attempting weak filtering
- Using a declarative, non-executable representation for Music on Hold settings where possible
- Running Asterisk and related services with the minimum filesystem, process, and network privileges required
- Protecting administrator accounts with strong authentication, role separation, and limited administrative access
Mitigation generally focuses on preventing user-controlled values from becoming executable Asterisk configuration.
Common defensive patterns include:
- Restricting custom application fields to a narrowly defined allowlist of supported values
- Separating data storage from executable configuration generation
- Applying context-aware validation before persistence and again before configuration emission
- Rejecting metacharacters, configuration delimiters, and unexpected syntax rather than attempting weak filtering
- Using a declarative, non-executable representation for Music on Hold settings where possible
- Running Asterisk and related services with the minimum filesystem, process, and network privileges required
- Protecting administrator accounts with strong authentication, role separation, and limited administrative access
How teams detect issues like this
Detection can combine static analysis, review, and runtime controls:
- Search for request parameters that are persisted and later concatenated into Asterisk configuration files
- Flag string construction involving configuration templates, shell-like syntax, or interpreter-facing values
- Review whether custom application fields use positive validation and fixed mappings
- Monitor administrative changes to Music on Hold settings and unexpected modifications to generated Asterisk configuration files
- Enforce code-review and CI policies that prohibit unvalidated user input in executable configuration paths
- Use neutral automated security review tools to identify command-injection and unsafe configuration-generation patterns
Detection can combine static analysis, review, and runtime controls:
- Search for request parameters that are persisted and later concatenated into Asterisk configuration files
- Flag string construction involving configuration templates, shell-like syntax, or interpreter-facing values
- Review whether custom application fields use positive validation and fixed mappings
- Monitor administrative changes to Music on Hold settings and unexpected modifications to generated Asterisk configuration files
- Enforce code-review and CI policies that prohibit unvalidated user input in executable configuration paths
- Use neutral automated security review tools to identify command-injection and unsafe configuration-generation patterns
Sources
| Source | Link |
|---|---|
| github. | github.com/ |

