/

CVE-2026-39087

Severity:

CRITICAL RISK

(9.8)

Code Injection in ntfy.sh Notification Server

CVE-2026-39087

Awaiting Analysis

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.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

A code injection vulnerability in the parseActions function of ntfy.sh before version 2.21 allows remote attackers to trigger arbitrary code execution on the server.

When attacker-controlled data is fed into action parsing without strict validation or safe evaluation, the server may interpret parts of the input as executable code, leading to full compromise of the affected instance.

Affected context

This vulnerability affects ntfy.sh notification server deployments running versions prior to 2.21 where the parseActions functionality processes user-supplied or externally sourced action definitions.

The risk is highest when:

  • Clients or integrations can submit arbitrary or semi-structured action data
  • The server trusts these definitions without strong validation
  • Action definitions are interpreted or transformed in a way that can reach a code-evaluation primitive

Exploit preconditions

  • Attack surface: Remote network access to an exposed ntfy.sh instance using vulnerable parseActions logic.
  • Required access: Ability to submit or influence action payloads (e.g., via API, message, or notification configuration).
  • Trigger point: Server-side invocation of parseActions on untrusted input, typically during message handling or action processing.
  • Why exploitation is possible: The parsing logic treats parts of the action definition as code or directly feeds them into a code execution or dynamic evaluation mechanism without robust sanitization and context separation.

Why this happens

The underlying issue aligns with CWE-94: Improper Control of Generation of Code ('Code Injection').

The parseActions function appears to mix data parsing with dynamic behavior in a way that can be influenced by attacker-controlled input.

Instead of treating action definitions as inert data, the implementation likely:

  • Builds executable expressions, templates, or commands using untrusted fields, or
  • Passes untrusted values into an interpreter, template engine, or shell without strict constraints.

This unsafe coupling of user input with code-generation or evaluation logic enables arbitrary code execution when crafted inputs are processed by the server.

Potential impact

  • Remote execution of arbitrary code with the privileges of the ntfy.sh server process
  • Full compromise of the ntfy.sh instance, including reading or modifying stored data
  • Use of the compromised server as a pivot point for lateral movement within the hosting environment
  • Deployment of malware, backdoors, or cryptominers on the underlying host
  • Service disruption, data tampering, or integrity loss of notifications and actions

General mitigation guidance

Effective mitigation centers on strict separation between data and executable behavior in action handling:

  • Treat all action definitions as data-only structures and avoid any direct interpretation as code or commands.
  • Replace dynamic evaluation or code generation with fixed, declarative handlers and whitelisted operations.
  • Use structured schemas (e.g., JSON/YAML schemas or typed structs) for actions and validate all fields against expected types and ranges.
  • Remove or harden any use of generic eval-like, reflection-based, or shell-executing APIs in parsing paths that process user input.
  • Apply least-privilege principles for the ntfy.sh process, including restricted OS permissions and sandboxing, to limit blast radius if similar issues arise.

How teams detect issues like this

Detection typically involves a combination of code-centric and behavior-centric approaches:

  • Static analysis & code review:
  • Search for usage of dynamic evaluation functions, reflection, or shell invocation within parseActions and related code paths.
  • Flag string concatenation or interpolation that constructs commands, code fragments, or handler lookups directly from user-controlled fields.
  • Enforce coding standards that prohibit eval-like constructs on untrusted data.
  • Automated scanning:
  • Use SAST tools configured with rules for CWE-94 to detect code injection patterns in the codebase.
  • Integrate these checks into CI pipelines to prevent reintroduction of similar issues.
  • Runtime & logging:
  • Enable detailed logging of action definitions and server errors to identify anomalous or suspicious action payloads.
  • Monitor for unusual process spawns, outbound connections, or resource spikes originating from the ntfy.sh service.

Sources

SourceLink
ntfy.comntfy.com
ntfysh.comntfysh.com
gist.github.comgist.github.com/MightyNawaf/5d41d6e8ead16e217f86b016002ecae5
github.comgithub.com/binwiederhier/ntfy/releases/tag/v2.22.0

Frequently asked

questions

Yes. A remote attacker who can submit or influence action data processed by a vulnerable ntfy.sh instance can potentially achieve remote code execution through this flaw.

The attacker generally needs the ability to send crafted action definitions or messages to the server via exposed endpoints or integrations.

No local access is required if the ntfy.sh service is reachable over the network and processes untrusted actions.

The safest pattern is to eliminate any dynamic code evaluation from parseActions, treat all inputs as pure data, enforce strict schemas, and restrict behavior to a fixed set of predefined, non-executable actions.

Avoid designing features that interpret user data as code, commands, or templates with execution capabilities.

Combine strong input validation, least-privilege runtime configurations, secure coding standards that ban eval-like constructs on untrusted input, and automated static analysis rules focused on injection vulnerabilities.

Find out what's already
exploitable in your codebase.