Описание
path-sanitizer allows bypassing the existing filters to achieve path-traversal vulnerability
Summary
This is a POC for a path-sanitizer npm package. The filters can be bypassed and can result in path traversal.
Payload: ..=%5c can be used to bypass this on CLI (along with other candidates). Something similar would likely work on web apps as well.
PoC
Here's the code to test for the filter bypass:
Here is a video POC: (this is a Loom POC, only users with the UUID of the video can see it)
https://www.loom.com/share/b766ece5193842848ce7562fcd559256?sid=fd826eb6-0eee-4601-bf0e-9cfee5c56e9d
Impact
Any CLI tool or library using this package can be/will be vulnerable to Path traversal.
Ссылки
- https://github.com/cabraviva/path-sanitizer/security/advisories/GHSA-94p5-r7cc-3rpr
- https://nvd.nist.gov/vuln/detail/CVE-2024-56198
- https://github.com/cabraviva/path-sanitizer/commit/b6d2319eac910dffdfacc8460f5b5cc5a1518ead
- https://www.loom.com/share/b766ece5193842848ce7562fcd559256?sid=fd826eb6-0eee-4601-bf0e-9cfee5c56e9d
Пакеты
path-sanitizer
< 3.1.0
3.1.0
Связанные уязвимости
path-sanitizer is a simple lightweight npm package for sanitizing paths to prevent Path Traversal. Prior to 3.1.0, the filters can be bypassed using .=%5c which results in a path traversal. This vulnerability is fixed in 3.1.0.