執行的 LDAP 指令中包含由用戶控制的過濾字符串以外的值,這可能會讓攻擊者借機修改指令的意義或執行非法的 LDAP 命令。
LDAP manipulation 錯誤在以下情況中出現:
1. 數據從一個不可信賴的數據源進入程序。
2. 數據在一個動態 LDAP 指令的濾字符串之外使用。
例 1:以下代碼從套接字中讀取 dn 字符串,然后使用該字符串來執行 LDAP 查詢。
...
rc = ldap_simple_bind_s( ld, NULL, NULL );
if ( rc != LDAP_SUCCESS ) {
...
}
...
fgets(dn, sizeof(dn), socket);
if ( ( rc = ldap_search_ext_s( ld, dn, LDAP_SCOPE_BASE,
filter, NULL, 0, NULL, NULL, LDAP_NO_LIMIT,
LDAP_NO_LIMIT, &result ) ) != LDAP_SUCCESS ) {
...
ou 值來篡改查詢結果。問題在于開發人員沒能充分利用適當的 access control 機制來限制隨后的查詢,使其只能讀取那些允許當前用戶讀取的雇員記錄。
[1] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A1 Unvalidated Input
[2] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3510 CAT I
[3] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP3510 CAT I
[4] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 90
[5] Standards Mapping - SANS Top 25 2009 - (SANS 2009) Insecure Interaction - CWE ID 116
[6] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 - (PCI 1.2) Requirement 6.3.1.1
[7] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.1
[8] Standards Mapping - FIPS200 - (FISMA) SI