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

CMS Made Simple xss #2

Open
XiaoZhis opened this issue Jun 17, 2017 · 0 comments
Open

CMS Made Simple xss #2

XiaoZhis opened this issue Jun 17, 2017 · 0 comments

Comments

@XiaoZhis
Copy link
Owner

XiaoZhis commented Jun 17, 2017

USE CVE-2017-9668

when adding a user group, there is no XSS filtering, resulting in storage-type XSS generation, via the description parameter in an addgroup action.

code:
$CMS_ADMIN_PAGE=1;

require_once("../lib/include.php");
require_once("../lib/classes/class.group.inc.php");
$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY];

check_login();

$error = "";

$group= "";
if (isset($_POST["group"])) $group = $_POST["group"];

$description= "";
if (isset($_POST["description"])) $description = $_POST["description"];

$active = 1;
if (!isset($_POST["active"]) && isset($_POST["addgroup"])) $active = 0;

if (isset($_POST["cancel"])) {
redirect("listgroups.php".$urlext);
return;
}

$userid = get_userid();
$access = check_permission($userid, 'Manage Groups');

if ($access) {
if (isset($_POST["addgroup"])) {
try {
if ($group == '') throw new \CmsInvalidDataException(lang('nofieldgiven', lang('groupname')));

        $groupobj = new Group();
        $groupobj->name = $group;
        $groupobj->description = $description;
        $groupobj->active = $active;

        Events::SendEvent('Core', 'AddGroupPre', array('group' => &$groupobj));

        $result = $groupobj->save();
        if( !$result ) throw new \RuntimeException(lang('errorinsertinggroup'));

        Events::SendEvent('Core', 'AddGroupPost', array('group' => &$groupobj));
        // put mention into the admin log
        audit($groupobj->id, 'Admin User Group: '.$groupobj->name, 'Added');
        redirect("listgroups.php".$urlext);
        return;
    }
    catch( \Exception $e ) {
        $error .= '<li>'.$e->GetMessage().'</li>';
    }
}

}

User & group -> group

222

111

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