<dd id="sga4y"><optgroup id="sga4y"></optgroup></dd>
<nav id="sga4y"><code id="sga4y"></code></nav>
  • <optgroup id="sga4y"></optgroup>

    Access Control: LDAP

    ABSTRACT

    在沒有適當 access control 的情況下,執行一個包含用戶控制值的 LDAP 聲明,這可以讓攻擊者訪問未授權的目錄條目。

    EXPLANATION

    Database access control 錯誤在以下情況下發生:

    1. 數據從一個不可信賴的數據源進入程序。

    2. 數據用于在 LDAP 查詢中指定一個數據值。

    例 1:以下代碼會在使用雇員名稱創建 LDAP 查詢之前,使用一個白名單來驗證雇員名稱的有效性。該驗證避免了 LDAP injection 漏洞,但仍可能留下代碼漏洞。


    ...
    fgets(username, sizeof(username), socket);

    char* regex = "^[a-zA-Z\-\.']$";
    re = pcre_compile(regex, 0, &err, &errOffset, NULL);

    rc = pcre_exec(re, NULL, username, strlen(username), 0, 0, NULL, 0);

    if(rc == 1) {
    snprintf(filter, sizeof(filter), "(employee=%s)", username);
    if ( ( rc = ldap_search_ext_s( ld, FIND_DN, LDAP_SCOPE_BASE,
    filter, NULL, 0, NULL, NULL, LDAP_NO_LIMIT,
    LDAP_NO_LIMIT, &result ) ) == LDAP_SUCCESS ) {
    ...
    }
    }


    問題在于開發人員未能考慮到如果攻擊者提供可供選擇的 username 值,會發生什么情況。因為本例子中的代碼是在匿名綁定情況下執行查詢,不管當前已驗證用戶的身份如何,它都會將有效的雇員 ID 返回至目錄入口。

    REFERENCES

    [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 - SANS Top 25 2011 - (SANS Top 25 2011) Porous Defenses - CWE ID 863

    [10] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.2

    [11] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 - (PCI 1.2) Requirement 6.5.4

    [12] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 - (PCI 2.0) Requirement 6.5.8


    Copyright 2013 Fortify Software - All rights reserved.
    (Generated from version 2013.1.1.0008 of the Fortify Secure Coding Rulepacks)
    desc.dataflow.cpp.access_control_ldap

    97av