如果沒有適當的 access control,就會執行一個包含用戶控制主鍵的 EXEC DLI 命令,從而允許攻擊者訪問未經授權的記錄。
DLI access control 錯誤在以下情況下出現:
1. 數據從一個不可信賴的數據源進入程序。
2. 這個數據用來指定 EXEC DLI 命令中主鍵的值。
例 1:以下代碼用到一個參數化指令,這個指令會轉義元字符,以防止 injection 漏洞,并構建和執行一個 EXEC DLI 命令。該 EXEC DLI 命令可以檢索與指定標識符相匹配的清單。您可以從與當前被授權用戶有關的所有清單中選擇這些標識符。
...
ACCEPT ID.
EXEC DLI
GU
SEGMENT(INVOICES)
WHERE (INVOICEID = ID)
END-EXEC.
...
ID 值。雖然接口生成了一個當前用戶的標識符清單,但是攻擊者可以繞過這個接口,從而獲取所需的任何清單。因為此例中的代碼沒有執行檢查,確保用戶有權訪問需要的清單,所以代碼會顯示所有清單,即使這些清單并不屬于當前用戶。
[1] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A2 Broken Access Control
[2] Standards Mapping - OWASP Top 10 2007 - (OWASP 2007) A4 Insecure Direct Object Reference
[3] Standards Mapping - OWASP Top 10 2010 - (OWASP 2010) A4 Insecure Direct Object References
[4] Standards Mapping - FIPS200 - (FISMA) AC
[5] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3510 CAT I
[6] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP3510 CAT I
[7] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 639
[8] Standards Mapping - Web Application Security Consortium 24 + 2 - (WASC 24 + 2) Insufficient Authorization
[9] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.2
[10] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 - (PCI 1.2) Requirement 6.5.4
[11] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 - (PCI 2.0) Requirement 6.5.8