/

CVE-2025-66398

Severity:

CRITICAL RISK

(9.6)

State Pollution / Insecure State Management in Signal K

CVE-2025-66398

Analyzed

Vulnerability type

Category:

State Pollution / Insecure State Management

CWE:

CWE-78, CWE-913

Impact:

Account Takeover and Remote Code Execution

Severity:

CRITICAL RISK

(9.6)

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

Signal K Server contains a state pollution flaw in the /skServer/validateBackup endpoint that allows an unauthenticated attacker to influence the internal restoreFilePath used by the Restore feature.

By manipulating this state and then triggering an administrator's restore action, an attacker can cause critical configuration files to be overwritten, which can ultimately enable account takeover and remote code execution under certain conditions.

Affected context

The vulnerability affects Signal K Server deployments where:

  • The /skServer/validateBackup endpoint is exposed over the network.
  • The server trusts values derived from backup validation to update internal restore-related state.
  • Administrative users subsequently use the Restore functionality from the same running process.

In this context, untrusted input can alter the path used for restore operations, so that later administrative actions apply to attacker-controlled locations or files.

Exploit preconditions

  • Attack surface: Network-exposed HTTP interface of the Signal K Server.
  • Required access: No authentication is required to call /skServer/validateBackup.
  • Trigger point: An attacker submits crafted data to /skServer/validateBackup to set or influence restoreFilePath, then relies on an administrator invoking the Restore operation.
  • Why exploitation is possible: The server updates internal state based on unauthenticated input and uses that state during privileged restore operations without robust validation, allowing overwrite of sensitive configuration files and potential loading of malicious configuration or code.

Why this happens

At its core, this issue is a combination of insecure state management (CWE-913) and command/behavioral injection patterns (CWE-78) via configuration.

The application exposes an endpoint that:

  • Accepts untrusted backup-related input from unauthenticated callers.
  • Directly influences a process-wide variable (restoreFilePath) that governs where restore operations will write files.
  • Later reuses this state in a higher-privilege context (administrator-initiated restore) without revalidating or constraining it to safe locations or formats.

This pattern matches CWE-913 because global or shared state is polluted by untrusted requests and then used in security-sensitive operations. Overwriting files like security.json or package.json can further enable command execution paths (mapping to CWE-78) when the platform interprets those files as configuration, script metadata, or startup instructions.

Potential impact

  • Hijacking of the Restore mechanism to overwrite critical configuration files.
  • Account takeover by manipulating authentication/authorization configuration.
  • Execution of attacker-controlled code via modified configuration or package metadata.
  • Persistent compromise of the Signal K Server instance, surviving restarts.
  • Lateral movement within the host environment if the server runs with elevated privileges or accesses other services.

General mitigation guidance

Effective mitigation typically focuses on hardening state management, configuration handling, and restore logic:

  • Isolate internal state from unauthenticated input: Avoid updating global or process-wide variables (such as paths used for restore) directly from untrusted requests. Introduce intermediate validation layers or session-scoped state instead.
  • Enforce strict path and target validation: Ensure restore operations only operate within well-defined directories and on allowlisted files. Normalize and validate paths before use and reject symbolic links or directory traversal.
  • Treat backup/restore data as untrusted: Validate backups against a schema and restrict which configuration fields and files can be restored. Disallow restoration of code-bearing or execution-influencing files unless strongly justified.
  • Apply least privilege to the service: Run the server with minimal file system permissions, so that overwrite of critical system or application files is not possible or is significantly constrained.
  • Harden admin workflows: Require strong authentication for all backup and restore interactions and consider confirmation prompts or integrity checks (e.g., signed backups) before applying a restore.

How teams detect issues like this

Organizations can look for this class of issue and its exploitation by combining code-centric and operational checks:

  • Static analysis and review:
  • Flag shared or global variables that can be modified from HTTP handlers, especially unauthenticated ones.
  • Identify flows where request parameters influence file paths, backup/restore targets, or configuration locations.
  • Search for restore or backup routines that lack strong allowlists or directory constraints.
  • Configuration and policy enforcement:
  • Enforce policies requiring authentication on all state-mutating administrative endpoints.
  • Require explicit validation on all user-controlled file paths or filenames.
  • Runtime and log monitoring:
  • Monitor logs for unexpected calls to backup/restore endpoints or unusual sequences (e.g., many validate calls followed by restore).
  • Track modifications to security-sensitive configuration files and alert on unexpected changes.
  • Automated tooling:
  • Use API security scanners or dynamic testing tools configured to probe backup/restore endpoints.
  • Integrate SAST/IAST tools into CI to detect unsafe state mutation and path handling patterns early in development.

Sources

SourceLink
github.comgithub.com/SignalK/signalk-server/releases/tag/v2.19.0
github.comgithub.com/SignalK/signalk-server/security/advisories/GHSA-w3x5-7c4c-66p9

Frequently asked

questions

Yes. The vulnerable /skServer/validateBackup endpoint is reachable over the network and can be called without authentication in affected versions. However, full impact often relies on an administrator later triggering the Restore operation.

No direct authentication is required to manipulate restoreFilePath. The attacker's actions are unauthenticated, but they depend on a legitimate administrator using the Restore feature afterward, at which point the polluted state is applied.

Decouple sensitive internal state from unauthenticated input, enforce strict validation and allowlists for any file paths or configuration targets involved in restore operations, and require authentication for all endpoints that influence backup/restore behavior.

Design administrative workflows so that:

  • All state that affects privileged operations is either authenticated, strongly validated, or both.
  • Backup/restore paths and file targets are constrained to controlled directories and known-safe file sets.
  • Global or shared variables cannot be directly influenced by untrusted requests.
  • Security reviews and automated analysis explicitly cover backup, restore, and migration endpoints, which often hold elevated privileges.
Find out what's already
exploitable in your codebase.