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

XSS vulnerability #176

Open
enferas opened this issue Jul 18, 2022 · 1 comment
Open

XSS vulnerability #176

enferas opened this issue Jul 18, 2022 · 1 comment

Comments

@enferas
Copy link

enferas commented Jul 18, 2022

Hello,

I would like to report for XSS vulnerability.

In file https://github.com/cobub/razor/blob/2c991aff4a9c83f99e77a03e26056715706f15c0/web/application/controllers/manage/product.php

//line 98
function uploadchannel()
    {
        $platform = $_POST['platform'];
        $channel = $this->channel->getchanbyplat($platform);
        echo json_encode($channel);
    }

In file

function getchanbyplat($platform)

//line 421
function getchanbyplat($platform)
    {
        $userid=$this->common->getUserId();    
        $sql="select * from  ".$this->db->dbprefix('channel')."  where active=1 and platform='$platform' and type='system' union 
        select * from  ".$this->db->dbprefix('channel')."  where active=1 and platform='$platform' and type='user'and user_id=$userid"; 
        $query = $this->db->query($sql);
        if ($query!=null&&$query->num_rows()>0) {
                return $query->result_array();
        }
          return null; 
    }

We can see that the $platform variable is used inside the the sql query without sanitization.
So the attacker can use the UNION command inside the platform to join a harmful input to the results of the query.
For example: $platform = 'something' UNION select '<script>alert(document.cookie)<\script>' AS '.

Thus the XSS will happen at echo json_encode($channel);

I recommend to have a check and delete for the character (') in the platform variable.

@enferas
Copy link
Author

enferas commented Sep 13, 2022

CVE-2022-36747 is assigned for this vulnerability.

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

1 participant