Описание
SignalK Server has Path Traversal leading to information disclosure
Summary
A Path Traversal vulnerability in SignalK Server's applicationData API allows authenticated users on Windows systems to read, write, and list arbitrary files and directories on the filesystem. The validateAppId() function blocks forward slashes (/) but not backslashes (\), which are treated as directory separators by path.join() on Windows. This enables attackers to escape the intended applicationData directory.
Details
Platform: Windows (Linux only allows traversal up a single directory) Authentication Required: Yes (ability to write depends on user's permission)
The vulnerability exists in the validateAppId() function within the applicationData API handler. This function validates the appid parameter but only checks for forward slashes:
Root Cause:
- The validation only blocks
/characters - On Windows,
path.join()uses the platform's native path separator - Windows treats both
/and\as valid directory separators - Backslash-based traversal sequences like
..\..\..pass validation - When
path.join()processes these on Windows, each..traverses up one directory level
PoC
Reproduction Steps:
- Set up SignalK Server on a Windows machine
- Obtain a valid device or user authentication token
- Run the PoC script:
python3 poc_windows_appid_traversal.py --target http://[signalK server IP]:3000 --token <YOUR_TOKEN>
Recommended Fix
Short-term:
-
Add backslash validation to
validateAppId():function validateAppId(appid) { if (appid.includes('/') || appid.includes('\') || appid.length >= 30) { return false; } return true; } -
Use
path.normalize()and validate that resolved paths remain within the intended directory:const resolvedPath = path.normalize(path.join(baseDir, appid)); if (!resolvedPath.startsWith(path.normalize(baseDir))) { throw new Error('Invalid path'); }
Пакеты
signalk-server
<= 2.20.2
2.20.3
Связанные уязвимости
Signal K Server is a server application that runs on a central hub in a boat. Prior to 2.20.3, a path traversal vulnerability in SignalK Server's applicationData API allows authenticated users on Windows systems to read, write, and list arbitrary files and directories on the filesystem. The validateAppId() function blocks forward slashes (/) but not backslashes (\), which are treated as directory separators by path.join() on Windows. This enables attackers to escape the intended applicationData directory. This vulnerability is fixed in 2.20.3.