Summary
Signal K Server's resource API does not adequately constrain resource paths, so an attacker may read, overwrite, or delete files outside the intended storage directory. Depending on deployment settings and accessible files, this can expose authentication material and potentially lead to administrator access and command execution with the server process's privileges.
Affected context
The issue affects the v2 REST resource routes in Signal K Server and the associated resources provider. It occurs when attacker-controlled resource identifiers are used for file operations without sufficient containment within the resource storage root. Anonymous reads may be possible when allow_readonly is enabled; otherwise, access to a readonly user token is generally required. The reported affected ranges are Signal K Server 2.0.0 through 2.33.x and @signalk/resources-provider 1.0.0 through 1.5.2.
Exploit preconditions
- Attack surface: The v2 REST resource API must be reachable.
- Required access: Anonymous access may suffice for reads when
allow_readonlyis enabled; otherwise, a readonly user token is needed. Write and delete operations depend on the permissions available to the caller. - Trigger point: A resource read, write, or delete operation processes a caller-controlled resource identifier.
- Why exploitation is possible: The identifier is not adequately constrained to the intended storage directory, and the server process may have access to files beyond that directory.
Why this happens
This is a path traversal flaw mapped to CWE-22: Improper Limitation of a Pathname to a Restricted Directory. The resource handler passes an attacker-controlled identifier to file storage operations without reliably ensuring that the resolved path remains within the designated storage root. As a result, file operations can cross the intended directory boundary.
Potential impact
- An attacker may read sensitive JSON files accessible to the server process.
- Exposed authentication data may enable an attacker to forge an administrator token.
- An attacker with administrative access could create a provider that runs commands with the server process's privileges.
- Related write and delete operations could modify or remove files outside the resource storage root.
- Malicious provider configuration may persist across server restarts.
General mitigation guidance
Defensive patterns focus on enforcing filesystem boundaries and limiting the consequences of compromised resource operations:
- Resolve and canonicalize requested paths, then verify they remain beneath an explicitly defined storage root.
- Prefer APIs that operate on validated resource identifiers rather than arbitrary filesystem paths.
- Apply strict input validation and reject identifiers containing path-separating or otherwise unexpected components.
- Limit the server process's filesystem access and run it with least-privilege permissions.
- Restrict access to resource operations and sensitive configuration files; avoid anonymous access where it is not necessary.
- Protect signing secrets and password data, and avoid storing them in files reachable through broadly accessible interfaces.
How teams detect issues like this
- Use static analysis to identify filesystem operations that incorporate request-controlled path components without containment checks.
- Review resource handlers and storage abstractions for canonical path validation and consistent enforcement across read, write, and delete operations.
- Test that resource requests cannot access files outside the configured storage root.
- Apply API authorization policies that limit anonymous and readonly access to resource operations.
- Monitor for unusual resource requests, sensitive file access, unexpected file changes, and creation of new providers.
- Automated security review tools can help flag path construction and authorization patterns for further review.

