/

CVE-2026-59721

Severity:

HIGH RISK

(7.2)

Command Injection (CWE-77) via SMTP URL in Hoppscotch

CVE-2026-59721

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-77, CWE-78, CWE-915

Impact:

Remote Code Execution within backend container

Severity:

HIGH RISK

(7.2)

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

A command injection flaw in Hoppscotch's infrastructure configuration flow allows attacker-controlled SMTP URLs to influence how nodemailer constructs sendmail transport options.

In deployments where a malicious admin can set MAILER_SMTP_URL and trigger email sending after a backend restart, this can result in arbitrary command execution as root inside the backend container.

Affected context

This vulnerability affects Hoppscotch instances that expose the updateInfraConfigs GraphQL mutation and rely on the MAILER_SMTP_URL setting to configure email delivery.

The risk materializes when:

  • Administrative users (or compromised admin accounts) can modify infrastructure configs, including MAILER_SMTP_URL
  • The backend uses nodemailer with sendmail-compatible transports derived from the URL
  • The backend container is restarted so the new configuration is loaded
  • Email sending is subsequently triggered, causing nodemailer to execute underlying sendmail commands

Non-admin users generally cannot reach this path unless additional logic or misconfiguration delegates such privileges.

Exploit preconditions

  • Attack surface: Administrative GraphQL API (updateInfraConfigs mutation).
  • Required access: Authenticated administrative access, or compromise of an admin account or token.
  • Configuration dependency: Backend configured to use nodemailer and interpret MAILER_SMTP_URL into sendmail-like options.
  • Trigger sequence:
  1. Set a crafted MAILER_SMTP_URL value via updateInfraConfigs.
  2. Backend container is restarted or configuration is reloaded to apply the new value.
  3. An email-sending action is triggered (e.g., notifications, test email).
  • Why exploitation is possible: The URL validation logic (validateSMTPUrl) permits path, query, or fragment sections that nodemailer later interprets as sendmail transport options, allowing injection into command-line arguments that are executed with root privileges in the container.

Why this happens

The core issue stems from treating a partially validated configuration string as safe input to a component that ultimately executes operating-system-level commands.

In this case, the MAILER_SMTP_URL is accepted from an administrative API and passed through validateSMTPUrl, which focuses on structural correctness but does not neutralize or constrain fields (path, query, fragment) that nodemailer interprets as sendmail transport options.

When nodemailer builds its sendmail command line from these options, attacker-controlled data can influence the command or its parameters, enabling command injection.

This aligns with:

  • CWE-77: Command Injection, where untrusted input is used to build OS commands.
  • CWE-78: OS Command Injection through unsafe use of system-level mail transport.
  • CWE-915: Improperly constrained configuration values that are forwarded into sensitive subsystems without robust validation or sanitization.

Potential impact

  • Execution of arbitrary commands as root within the backend container.
  • Complete compromise of the backend application runtime and in-container data.
  • Abuse of the mail infrastructure to send spoofed or malicious emails.
  • Pivoting to other internal services reachable from the backend network.
  • Deployment of persistence mechanisms or additional tooling inside the container.
  • Escalation to broader infrastructure compromise if the container has overly broad privileges or mounted secrets.

General mitigation guidance

Effective mitigation focuses on constraining configuration inputs and hardening how mail transports are configured:

  • Treat all configuration values, including those set by administrators, as untrusted when they can influence executable paths or arguments.
  • Prefer fixed, code-level configuration for mail transports (e.g., predefined transport types and arguments) instead of passing raw URLs directly into nodemailer or similar libraries.
  • Introduce strict allowlists for MAILER_SMTP_URL components, ensuring only expected schemes, hosts, ports, and credential formats are accepted, and reject or strip path, query, and fragment sections that affect sendmail options.
  • Decouple user- or admin-provided values from command-line construction by using APIs that avoid shell parsing and do not expose arbitrary argument injection points.
  • Run backend services with least privilege, avoiding root where possible and reducing the blast radius of any injected command.
  • Apply defense-in-depth with container hardening measures such as read-only filesystems, restricted capabilities, and tight network policies.

How teams detect issues like this

Detection typically combines configuration review and behavioral monitoring:

  • Static analysis and code review:
  • Flag any use of configuration values (including environment variables) that are concatenated into command strings or passed to mail libraries that rely on system binaries.
  • Look for helpers like validateSMTPUrl that focus on structural validation but do not address command injection or argument constraints.
  • Enforce secure coding guidelines for mail transport configuration, preferring structured options over raw URLs that encode behavior.
  • Policy and CI checks:
  • Add linting or policy rules to prevent passing untrusted config directly into nodemailer's sendmail transport or similar OS-level mechanisms.
  • Use automated tools to scan for patterns of command construction, especially where values come from GraphQL mutations or admin panels.
  • Runtime monitoring:
  • Monitor process executions inside containers, especially invocations of sendmail or mail transfer agents with unusual flags or arguments.
  • Alert on unexpected outbound email patterns or spikes that may indicate abuse.

Sources

SourceLink
github.comgithub.com/hoppscotch/hoppscotch/commit/73a88c82b1b2cada26cc4b2bc095b54554242239
github.comgithub.com/hoppscotch/hoppscotch/pull/6413
github.comgithub.com/hoppscotch/hoppscotch/releases/tag/2026.6.0
github.comgithub.com/hoppscotch/hoppscotch/security/advisories/GHSA-v7q6-r45w-2c6r

Frequently asked

questions

Yes, but only through the administrative interface.

An attacker must be able to invoke the updateInfraConfigs GraphQL mutation with a crafted MAILER_SMTP_URL, typically by compromising an admin account or abusing exposed admin APIs.

Exploitation requires administrative-level access to the Hoppscotch instance or equivalent control over infrastructure configuration.

Without access to modify MAILER_SMTP_URL and trigger mail sending after configuration reload, the attack path is not viable.

The safest pattern is to decouple user- or admin-supplied configuration from any command construction.

Use strongly typed configuration objects, apply strict allowlists on accepted values, avoid encoding behavior in URLs, and rely on library APIs that do not expose direct access to system-level mail commands.

Adopt a design principle that treats all configuration as untrusted and never interpolates it into commands or command-line arguments.

Combine this with secure defaults, security-focused code review for any feature that interacts with system utilities or external binaries, and automated checks that flag potential injection sinks during development.

Find out what's already
exploitable in your codebase.