Note Mark Arbitrary File Write via Path Traversal Leads to Remote Code Execution
Note Mark is vulnerable to arbitrary file write via path traversal in asset names, leading to remote code execution by overwriting system binaries such as /bin/bash.
Note Mark versions 0.19.2 and earlier contain an arbitrary file write vulnerability that leads to remote code execution. Authenticated users can upload assets to notes via POST /api/notes/{noteID}/assets, with the asset filename taken directly from the X-Name HTTP header. The application fails to sanitize this filename, storing it directly in the database. When an administrator subsequently runs the data export CLI commands (note-mark migrate export-v1 or note-mark migrate export), the stored asset name is passed into filepath.Join() calls. An attacker-controlled asset name containing directory traversal sequences (e.g., ../) allows writing files to arbitrary locations, which can be escalated to RCE by overwriting system binaries, such as /bin/bash. The vulnerability is present in Note Mark’s backend component.
Attack Chain
- Attacker registers an account and authenticates to the Note Mark application.
- Attacker creates a notebook using a
POSTrequest to/api/books. - Attacker creates a note within the notebook using a
POSTrequest to/api/books/<BOOK_ID>/notes. - Attacker uploads an asset with a malicious payload and a path traversal filename in the
X-Nameheader to/api/notes/<NOTE_ID>/assets. TheX-Nameheader contains a path traversal sequence targeting a sensitive file like/bin/bash. - The application stores the unsanitized filename (including the path traversal) in the database.
- An administrator triggers a data export using
note-mark migrate export-v1 --export-dir /data/backupornote-mark migrate export. - The export process uses the unsanitized filename in
filepath.Join(), causing a file to be written to the attacker-specified location (e.g., overwriting/bin/bash). - The next time
bashis invoked, the attacker’s payload executes, resulting in code execution as root.
Impact
Successful exploitation allows an attacker to overwrite arbitrary files on the system with root privileges, leading to complete system compromise. Overwriting /bin/bash results in RCE the next time any user invokes bash. The number of affected installations is unknown, but the vulnerability exists in version 0.19.2 and earlier.
Recommendation
- Deploy the Sigma rule to detect asset uploads with path traversal sequences in the
X-Nameheader. - Apply
filepath.Base()to theX-Nameheader value inbackend/handlers/assets.gobefore storing it in the database, as described in the advisory. - Apply
filepath.Base()toasset.Nameinbackend/cli/migrate.goat lines 328 and 223 before using it in file path construction. - Upgrade to a patched version of Note Mark which addresses CVE-2026-44522.
Detection coverage 3
Detect Note Mark Asset Upload with Path Traversal Filename
highDetects asset upload with path traversal sequences in the X-Name header, indicative of CVE-2026-44522 exploitation.
Detect Note Mark Migrate Export with Path Traversal Filename
highDetects command execution of `note-mark migrate export-v1` or `note-mark migrate export` with path traversal sequences.
Detect Overwritten /bin/bash
criticalDetects modification of /bin/bash with a non-standard shebang, potentially indicating CVE-2026-44522 exploitation.
Detection queries are available on the platform. Get full rules →