<span id="7ztzv"></span>
<sub id="7ztzv"></sub>

<span id="7ztzv"></span><form id="7ztzv"></form>

<span id="7ztzv"></span>

        <address id="7ztzv"></address>

            Double Free

            ABSTRACT

            在同一個內存地址上兩次調用 free(),會引發 buffer overflow。

            EXPLANATION

            當同一內存地址被當作參數不止一次地調用 free() 時,會出現 Double free 錯誤。



            針對同一個值兩次調用 free(),會導致 buffer overflow。當程序使用同一參數兩次調用 free() 時,程序中的內存管理數據結構會遭到破壞。這種破壞會導致程序崩潰。有時在某些情況下,還會導致兩次調用 malloc() 延遲,而返回相同的指針。如果 malloc() 兩次都返回同一個值,稍候程序便會允許攻擊者控制整個已經寫入雙倍分配內存的數據,從而使程序更加容易受到 buffer overflow 的攻擊。

            例 1:以下代碼顯示了一個關于 double free 漏洞的簡單例子。


            char* ptr = (char*)malloc (SIZE);
            ...
            if (abrt) {
            free(ptr);
            }
            ...
            free(ptr);


            Double free 漏洞的產生有兩個常見(有時候這兩個原因會同時發生作用)原因:

            - 錯誤狀況及其他異常情況。

            — 不清楚由程序的哪一部分負責釋放內存。

            雖然某些 double free 漏洞并不比上一個例子復雜多少,但是大部分漏洞都分散在上百行代碼中,甚至還會出現在不同的文件中。程序員似乎特別容易受到多次釋放全程變量的影響。

            REFERENCES

            [1] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A5 Buffer Overflow

            [2] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3590.1 CAT I

            [3] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP3590.1 CAT I

            [4] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 415

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

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

            [7] J. Koziol et al. The Shellcoder's Handbook:Discovering and Exploiting Security Holes John Wiley & Sons


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

            <span id="7ztzv"></span>
            <sub id="7ztzv"></sub>

            <span id="7ztzv"></span><form id="7ztzv"></form>

            <span id="7ztzv"></span>

                  <address id="7ztzv"></address>

                      亚洲欧美在线