Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security Issue: arbitrary file deletion vulnerability in “\system\admin\views\backup.html.php” #462

Closed
wszdhf opened this issue May 12, 2021 · 4 comments

Comments

@wszdhf
Copy link

wszdhf commented May 12, 2021

Hi there,
I found an arbitrary file deletion vulnerability in Htmly.
Proof of Concept:
tested on Windows7 and Htmly version 2.8.1 and 2.8.0
1. Log in to the dashboard,click Tools -->Backup-->create backup to create backup.
2. Arbitrary file deletion: click Delete and modify the file parameter.
payload: GET /htmly1/admin/backup?file=htmly_2021-05-12-09-33-30.zip/../../../../../../windows/win.ini&submit=Delete

1
2
3
4
5

@danpros
Copy link
Owner

danpros commented May 12, 2021

Hello,

Are you sure it can delete file outside the backup folder?

I already specify:

if (login()) {
    if (isset($_GET['file'])) {
        $file = _h($_GET['file']);

        if (!empty($file)) {
            unlink("backup/$file");
        }

    }
}

So it always check if the user login or not and than always search the file inside backup folder in htmly installations folder.

@ProjectPatatoe
Copy link
Contributor

I just confirmed this on a ubuntu/apache2. I am able to delete a file in htmly's root directory.

ProjectPatatoe added a commit to ProjectPatatoe/htmly that referenced this issue May 12, 2021
@wszdhf
Copy link
Author

wszdhf commented May 13, 2021

Hello,

Are you sure it can delete file outside the backup folder?

I already specify:

if (login()) {
    if (isset($_GET['file'])) {
        $file = _h($_GET['file']);

        if (!empty($file)) {
            unlink("backup/$file");
        }

    }
}

So it always check if the user login or not and than always search the file inside backup folder in htmly installations folder.

yes,it can delete file outside the backup folder. As shown in the above picture,i can delete "C:\Windows\win.ini".
you can read this: https://portswigger.net/web-security/file-path-traversal

@danpros
Copy link
Owner

danpros commented May 13, 2021

Thanks @wszdhf for the report and @ProjectPatatoe for the pull request.

@wszdhf wszdhf closed this as completed Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants