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

There is a File Upload vulnerablility that can upload a webshell in the CMS. #2

Open
T1oPlato opened this issue Jun 9, 2021 · 1 comment

Comments

@T1oPlato
Copy link

T1oPlato commented Jun 9, 2021

After logging in the administrator,open the following page to edit a blog

./admin/main/mod-blog
3

the code of the CMS' uploader<Uploader.php>
code:

public function image($file, $path) {
    if (!$file['error']) {
        if (!$file['error']) {
            $name = md5(rand(100, 200));
            $ext = explode('.', $file['name']);
            $filename = $name . '.' . $ext[1];
            if(!is_writable($path . "/public/images/")) {
                throw new Exception("Directory " . $path . "/public/images is not writable.
                Set chmod permissions to 777.");
            }
            $destination = $path . "/public/images/" . $filename; //change this directory
            $location = $file["tmp_name"];
            move_uploaded_file($location, $destination);
        } else {
            throw new Exception("Ooops!  Your upload triggered
            the following error:  " . $file['error']);
        }
    }
    return $this->getBasepath($path) . "/public/images/" . $filename;
}

public function getBasepath($path) {
    $config = simplexml_load_file($path . "/site/etc/balero.config.xml");
    return $config->site[0]->basepath;
}

Shellcode
create it as shell.php.jpg
1

You'll successfully connect it with AntSword.
5

@anibalg0mez
Copy link

We are migrating the entire core to a new version, maybe you can fix with this:

https://github.com/anibalg0mez/balero-framework/blob/development/Framework/Uploader.php

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

2 participants