/

CVE-2025-30007

Severity:

HIGH RISK

(8.8)

OS Command Injection (CWE-78) in HestiaCP DNS Handler

CVE-2025-30007

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Root-Level Remote Code Execution by Authenticated Users

Severity:

HIGH RISK

(8.8)

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

An authenticated OS command injection flaw in HestiaCP allows low-privilege users to execute arbitrary system commands as root through crafted DNS record types.

The issue becomes dangerous wherever unvalidated DNS input is passed into eval-based parsing, enabling attackers to break out of expected string assignments and gain full host-level code execution.

Affected context

This vulnerability arises in HestiaCP's DNS management flow, specifically during DNS record creation and zone updates.

It affects deployments where:

  • Low-privilege authenticated users can create or modify DNS records
  • Record type fields are passed through is_dns_record_format_valid() without robust sanitization
  • The update_domain_zone() logic uses eval-based parsing or shell-like command construction tied to user-controlled fields

In such setups, a malicious DNS record type can escape the intended format and drive command execution in privileged context.

Exploit preconditions

  • Attack surface: HestiaCP web interface or API endpoints that handle DNS record creation or updates
  • Required access: Valid authenticated account with permission to manage DNS records (low privilege is sufficient)
  • Trigger point: Submission of a crafted DNS record type that injects a single quote to terminate a string and append commands
  • Why exploitation is possible: The is_dns_record_format_valid() routine does not fully constrain or escape special characters, and update_domain_zone() relies on eval-style parsing of user-controlled values, allowing the attacker to break out of variable assignment and inject arbitrary OS commands executed as root.

Why this happens

The core bug class is OS command injection (CWE-78) driven by unsafe handling of user-controllable strings during command or expression construction.

HestiaCP's DNS logic combines insufficient input validation in is_dns_record_format_valid() with eval-based parsing in update_domain_zone(), effectively treating partially trusted DNS record types as executable content.

By allowing special characters such as single quotes into the record type, the system lets attackers terminate strings and append additional shell commands, which are then executed with root privileges.

At an abstract level, this reflects a failure to separate data from commands and to enforce strict, well-typed validation on all untrusted fields before they reach any interpreter or shell.

Potential impact

  • Attackers may execute arbitrary OS commands with root privileges on the host running HestiaCP.
  • Compromise of the entire control panel environment, including hosted domains and services.
  • Installation of persistent backdoors, malware, or unauthorized cron jobs.
  • Exfiltration or tampering of configuration files, SSL keys, and user data.
  • Pivoting into adjacent infrastructure or internal networks from the compromised host.

General mitigation guidance

Effective mitigation focuses on removing opportunities for user input to influence command execution semantics and on constraining the DNS record handling logic.

Recommended patterns include:

  • Avoid using eval, shell expansion, or dynamic command strings for DNS zone updates; prefer well-defined APIs or parameterized calls that treat inputs strictly as data.
  • Implement strict allowlists for DNS record types and related fields, rejecting any value that contains dangerous metacharacters or deviates from expected DNS syntax.
  • Normalize and validate all DNS input server-side, applying robust parsing that enforces type, length, and character constraints before reaching any interpreter.
  • Run control panel components with least privilege and minimize the code paths where root-level execution is required, reducing the blast radius of potential injection.
  • Adopt secure coding guidelines that prohibit mixing user data with executable expressions or shell commands, particularly in administrative modules.

How teams detect issues like this

Detection typically combines code-level analysis with runtime monitoring:

  • Use static analysis rules to flag eval usage, dynamic shell command construction, or concatenation of user-controlled fields into system-level operations in DNS-related modules.
  • During code review, look for functions like is_dns_record_format_valid() and update_domain_zone() that handle user input without strict allowlists, escaping, or structured parsing.
  • Establish secure coding policies that ban eval in production code and require explicit justification for any interpreter invocation, backed by automated checks in CI pipelines.
  • Monitor logs for unusual DNS record types containing quotes, semicolons, or other shell metacharacters, and correlate with unexpected root-level activity on the host.
  • Consider using application security testing tools (SAST/DAST) to probe DNS management endpoints for injection patterns and confirm that input handling does not lead to command execution.

Sources

SourceLink
github.comgithub.com/hestiacp/hestiacp/commit/a74babb739aa92e52b12d6ef52b6b9428ffbbb67
github.comgithub.com/hestiacp/hestiacp/pull/5197
github.comgithub.com/hestiacp/hestiacp/releases/tag/1.9.5
vulncheck.comvulncheck.com/advisories/hestiacp-authenticated-os-command-injection-via-dns-record-management

Frequently asked

questions

Yes, it is exploitable over the network, but only by authenticated users who can access the HestiaCP DNS management interface or API. Once authenticated, a crafted DNS record submission can trigger the flaw.

The attacker needs a low-privilege, valid HestiaCP account with permissions to create or modify DNS records. No direct shell or root access is required; the vulnerability elevates their capabilities to root-level command execution.

The safest pattern is to eliminate eval-based parsing and any direct construction of shell commands from user input, replace them with parameterized APIs, and enforce strict validation and allowlisting on DNS record types and related fields.

Prevent them by adopting secure coding practices that forbid eval and dynamic command building with user data, enforcing robust server-side validation, integrating static analysis into CI/CD pipelines, and regularly reviewing high-privilege code paths such as control panel and DNS management routines.

Find out what's already
exploitable in your codebase.