前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Roundcube mail 3 Xss

Roundcube mail 3 Xss

作者头像
LoRexxar
发布2023-02-21 21:24:20
7310
发布2023-02-21 21:24:20
举报
文章被收录于专栏:LoRexxar's BlogLoRexxar's Blog

3个没用的Xss

Store Xss in /installer/test.php

in install step2

image.png-66.2kB
image.png-66.2kB

Access trigger

代码语言:javascript
复制
http://127.0.0.1/roundcubemail-1.4.4/installer/index.php?_step=3
image.png-178.8kB
image.png-178.8kB

code anlysize

input in step2

代码语言:javascript
复制
if (!empty($_POST['submit'])) {
  $_SESSION['config'] = $RCI->create_config();

  if ($RCI->save_configfile($_SESSION['config'])) {
     echo '<p class="notice">The config file was saved successfully into <tt>'.RCMAIL_CONFIG_DIR.'</tt> directory of your Roundcube installation.';

follow intocreate_config\program\include\rcmail_install.php line 216

代码语言:javascript
复制
if ($prop == 'db_dsnw' && !empty($_POST['_dbtype'])) {
    if ($_POST['_dbtype'] == 'sqlite') {
        $value = sprintf('%s://%s?mode=0646', $_POST['_dbtype'],
            $_POST['_dbname'][0] == '/' ? '/' . $_POST['_dbname'] : $_POST['_dbname']);
    }
    else if ($_POST['_dbtype']) {
        $value = sprintf('%s://%s:%s@%s/%s', $_POST['_dbtype'],
            rawurlencode($_POST['_dbuser']), rawurlencode($_POST['_dbpass']), $_POST['_dbhost'], $_POST['_dbname']);
    }
}

Regarding the configuration of db, only when it is not sqlite, the user and pass are filtered, and other parameters are not filtered. Direct incoming will be put into config.

in step3,installer/test.php,directly export config out.

image.png-40kB
image.png-40kB

store xss in smtp config

image.png-29.4kB
image.png-29.4kB
image.png-33.5kB
image.png-33.5kB

code analysize

There is no filtering when entering variables

When the output is not defined by the html_inputfield class, it will take effect if the output is obtained directly

image.png-42.5kB
image.png-42.5kB

store xss in email in database

image.png-37.8kB
image.png-37.8kB
image.png-46.1kB
image.png-46.1kB

code analysize

When accessing index.php, the corresponding page will render the template, when obtaining the template, from

代码语言:javascript
复制
program/include/rcmail_output_html.php line 2094


public function current_username($attrib)
{
    static $username;

    // alread fetched
    if (!empty($username)) {
        return $username;
    }
    // Current username is an e-mail address
    if (strpos($_SESSION['username'], '@')) {
        $username = $_SESSION['username'];
    }
    // get e-mail address from default identity
    else if ($sql_arr = $this->app->user->get_identity()) {
        $username = $sql_arr['email'];
    }
    else {
        $username = $this->app->user->get_username();
    }
    
    return rcube_utils::idn_to_utf8($username);
}

in program/lib/roundcube/rcube_user.php line 304

代码语言:javascript
复制
function get_identity($id = null)
{
    $id = (int)$id;
    // cache identities for better performance
    if (!array_key_exists($id, $this->identities)) {
        $result = $this->list_identities($id ? "AND `identity_id` = $id" : '');
        $this->identities[$id] = $result[0];
    }

    return $this->identities[$id];
}

Directly from the database identities.

And this value is inserted into the database by call function insert_identity

代码语言:javascript
复制
program/lib/roundcube/rcube_user.php line 397

function insert_identity($data)
{
    if (!$this->ID) {
        return false;
    }

    unset($data['user_id']);

    $insert_cols   = array();
    $insert_values = array();

    foreach ((array)$data as $col => $value) {
        $insert_cols[]   = $this->db->quote_identifier($col);
        $insert_values[] = $value;
    }

    $insert_cols[]   = $this->db->quote_identifier('user_id');
    $insert_values[] = $this->ID;

    $sql = "INSERT INTO ".$this->db->table_name('identities', true).
        " (`changed`, ".implode(', ', $insert_cols).")".
        " VALUES (".$this->db->now().", ".implode(', ', array_pad(array(), count($insert_values), '?')).")";

    $insert = $this->db->query($sql, $insert_values);

    // clear the cache
    $this->identities = array();
    $this->emails     = null;

    return $this->db->affected_rows($insert) ? $this->db->insert_id('identities') : false;
}

This function is mainly called in two places, one is the installation place, and the other is the login place.

代码语言:javascript
复制
/program/lib/roundcube/rcube_user.php lime 648

$rcube->user = $user_instance;
$mail_domain = $rcube->config->mail_domain($data['host']);
$user_name   = $data['user_name'];
$user_email  = $data['user_email'];
$email_list  = $data['email_list'];

if (empty($email_list)) {
    if (empty($user_email)) {
        $user_email = strpos($data['user'], '@') ? $user : sprintf('%s@%s', $data['user'], $mail_domain);
    }
    $email_list[] = $user_email;
}
本文参与?腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020/06/10,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客?前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与?腾讯云自媒体分享计划? ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Store Xss in /installer/test.php
    • code anlysize
    • store xss in smtp config
      • code analysize
      • store xss in email in database
        • code analysize
        相关产品与服务
        数据库
        云数据库为企业提供了完善的关系型数据库、非关系型数据库、分析型数据库和数据库生态工具。您可以通过产品选择和组合搭建,轻松实现高可靠、高可用性、高性能等数据库需求。云数据库服务也可大幅减少您的运维工作量,更专注于业务发展,让企业一站式享受数据上云及分布式架构的技术红利!
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
        http://www.vxiaotou.com