Path Traversal in pheditor/pheditor

Valid

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.

We created a GitHub Issue asking the maintainers to create a SECURITY.md a year ago
Z-Old
a year ago

Admin


Hey hitisec, I've emailed the maintainers for you.

We have contacted a member of the pheditor team and are waiting to hear back a year ago
pheditor/pheditor maintainer validated this vulnerability a year ago
hitisec has been awarded the disclosure bounty
The fix bounty is now up for grabs
pheditor/pheditor maintainer confirmed that a fix has been merged on 69a79e a year ago
The fix bounty has been dropped
to join this conversation