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

Possible XSS Vulnerability #2252

Closed
enferas opened this issue Jun 6, 2022 · 6 comments
Closed

Possible XSS Vulnerability #2252

enferas opened this issue Jun 6, 2022 · 6 comments

Comments

@enferas
Copy link

enferas commented Jun 6, 2022

Hello,

I would like to report for possible XSS vulnerability.

In file https://github.com/serghey-rodin/vesta/blob/master/web/api/v1/upload/UploadHandler.php

the source in function post

    public function post($print_response = true) {
        //....
        // the source $_FILES[$this->options['param_name']]
        $upload = isset($_FILES[$this->options['param_name']]) ? $_FILES[$this->options['param_name']] : null;
        // ....
        foreach ($upload['tmp_name'] as $index => $value) {
            // $files will have the source which return from handle_file_upload
            $files[] = $this->handle_file_upload(
                $upload['tmp_name'][$index],
                $file_name ? $file_name : $upload['name'][$index],
                $size ? $size : $upload['size'][$index],
                $upload['type'][$index], // The source
                $upload['error'][$index],
                $index,
                $content_range
            );
        }
        //.....
        // call generate_response and pass the source in the array in $files
        return $this->generate_response(
            array($this->options['param_name'] => $files),
            $print_response
        );
    }

function handle_file_upload

    protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
        //.....
        // the source in $file->type
        $file->type = $type;
        //....
        return $file;
    }

function generate_response

    protected function generate_response($content, $print_response = true) {
        if ($print_response) {
            $json = json_encode($content);
            //.....
            $this->body($json);
        }
    }

Finally, the sink in function body

protected function body($str) {
        // the sink
        echo $str;
    }
@byjameson
Copy link

yes this is bug

@myvesta
Copy link

myvesta commented Jun 15, 2022

Can you check is this issue exists in https://github.com/myvesta/vesta fork?

@jaapmarcus
Copy link
Contributor

@anton-reutov
Copy link
Collaborator

divinity76 added a commit to divinity76/vesta that referenced this issue Jul 23, 2022
@divinity76
Copy link
Contributor

proposed a fix: #2258

fwiw VestaCP development has largely halted, notable maintained forks are https://github.com/hestiacp/hestiacp and https://github.com/myvesta/vesta

@anton-reutov
Copy link
Collaborator

Thank you guys for the help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants