Skip to content

SA-2026-33:SQLI in OrderBy Parameters  - #158

Open
Chen-LiYin wants to merge 14 commits into
NETivism:developfrom
Chen-LiYin:develop-47100
Open

SA-2026-33:SQLI in OrderBy Parameters #158
Chen-LiYin wants to merge 14 commits into
NETivism:developfrom
Chen-LiYin:develop-47100

Conversation

@Chen-LiYin

Copy link
Copy Markdown
Contributor

SA-2026-33:SQLI in OrderBy Parameters 

修改的檔案與行號:

檔案 行號 漏洞程式碼 修改方式

CRM/Core/OptionValue.php    L422    " ORDER BY " . $orderBy " ORDER BY " . CRM_Utils_Type::escape($orderBy, 'MysqlOrderBy')

測試的方法

在 container 內執行測試

php -r "
error_reporting(E_ALL);
ini_set('display_errors', 1);
require '/var/www/html/modules/civicrm/CRM/Utils/Rule.php';
require '/var/www/html/modules/civicrm/CRM/Utils/Array.php';
require '/var/www/html/modules/civicrm/CRM/Utils/Type.php';

// 正常值 → 應該輸出 \`weight\`
var_dump(CRM_Utils_Type::escape('weight', 'MysqlColumnName'));

// 注入 payload → 應該輸出 fatal error(被擋下)
var_dump(CRM_Utils_Type::escape('(SELECT sleep(5))', 'MysqlColumnName'));
"

預期結果

測試 預期輸出 意義
weight string(8) "\weight" 正常值通過,SQL 安全
(SELECT sleep(5)) Fatal error: CRM_Core_Error 注入被阻擋,SQL 不會執行

第二個 fatal error 是預期行為——代表 escape 驗證失敗,CRM_Core_Error::fatal() 被觸發,注入成功阻擋。

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

Successfully merging this pull request may close these issues.

1 participant