Lucene search

K
huntrPorcupineyhairs7ACAC778-5BA4-4F02-99E2-E4E17A81E600
HistoryMar 20, 2022 - 11:13 a.m.

Path Traversal due to `send_file` call

2022-03-2011:13:18
porcupineyhairs
www.huntr.dev
13

0.001 Low

EPSS

Percentile

49.0%

A path traversal attack (also known as directory traversal) aims to access files and directories that are stored outside the web root folder. By manipulating variables that reference files with “dot-dot-slash (…/)” sequences and its variations or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system including application source code or configuration and critical system files. It should be noted that access to files is limited by system operational access control (such as in the case of locked or in-use files on the Microsoft Windows operating system).

This attack is also known as “dot-dot-slash”, “directory traversal”, “directory climbing” and “backtracking”.

Root Cause Analysis

Passing untrusted input to flask.send_filecan lead to path traversal attacks.

Proof of Concept

The bug can be verified using a proof of concept similar to the one shown below.

curl --path-as-is -i -s -k 'http://<domain>/remote/static/unindexed?file=/../../../../../../../../..//etc/passwd'

This bug was found using CodeQL by Github

0.001 Low

EPSS

Percentile

49.0%

Related for 7ACAC778-5BA4-4F02-99E2-E4E17A81E600