<pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
    <pre id="vvttv"></pre>

      <p id="vvttv"></p>

          <p id="vvttv"></p>

                <p id="vvttv"></p>

                <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                  <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                    <p id="vvttv"></p>

                    Buffer Overflow: Format String (%f/%F)

                    ABSTRACT

                    該程序使用了界定不當的 format string,其中包含一個 %f 或 %F 浮點說明符。特別大的浮點值會導致該程序在分配的內存邊界之外寫入數據,這會損壞數據、引起程序崩潰或為惡意代碼的執行提供機會。

                    EXPLANATION

                    Buffer overflow 可能是人們最熟悉的一種軟件安全漏洞。雖然絕大多數軟件開發者都知道什么是 Buffer overflow 漏洞,但是無論是對繼承下來的或是新開發的應用程序來說,Buffer overflow 攻擊仍然是一種最常見的攻擊形式。對于這個問題出現的原因,一方面是造成 buffer overflow 漏洞的方式有很多種,另一方面是用于防止 buffer overflow 的技術也容易出錯。

                    在一個典型的 buffer overflow 攻擊中,攻擊者將數據傳送到某個程序,程序會將這些數據儲存到一個較小的堆棧緩沖區內。結果,調用堆棧上的信息會被覆蓋,其中包括函數的返回指針。數據會被用來設置返回指針的值,這樣,當該函數返回時,函數的控制權便會轉移給包含在攻擊者數據中的惡意代碼。

                    雖然這種類型的堆棧 buffer overflow 在某些平臺和開發組織中十分常見,但仍不乏存在其他各種類型的 buffer overflow,其中包括堆 buffer overflow 和 off-by-one 錯誤等。有關 buffer overflow 如何進行攻擊的詳細信息,許多優秀的著作都進行了相關介紹,如 Building Secure Software[1]、Writing Secure Code[2] 以及 The Shellcoder's Handbook[3]。

                    在代碼層上,buffer overflow 漏洞通常會違反程序員的各種假設。C 和 C++ 中的很多內存處理函數都沒有執行邊界檢查,因而可輕易地超出緩沖區所操作的、已分配的邊界。即使是邊界函數(如 strncpy()),使用方式不正確也會引發漏洞。對內存的處理加之有關數據段大小和結構方面所存在種種錯誤假設,是導致大多數 buffer overflow 漏洞產生的根源。

                    在這里,一個結構不良的 format string 會導致程序在分配的內存邊界之外寫入數據。

                    示例:以下代碼會溢出 buf,因為根據 f 的大小,format string 說明符 "%d %.1f ..." 可能會超出分配的內存大小。


                    void formatString(int x, float f) {
                    char buf[40];
                    sprintf(buf, "%d %.1f ...", x, f);
                    }

                    REFERENCES

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

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

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

                    [4] J. Viega, G. McGraw Building Secure Software Addison-Wesley

                    [5] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 787

                    [6] Standards Mapping - Web Application Security Consortium 24 + 2 - (WASC 24 + 2) Format String Attack

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

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

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

                    [10] Standards Mapping - SANS Top 25 2009 - (SANS 2009) Risky Resource Management - CWE ID 119

                    [11] Standards Mapping - SANS Top 25 2011 - (SANS Top 25 2011) Risky Resource Management - CWE ID 134

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

                    [13] M. Howard, D. LeBlanc Writing Secure Code, Second Edition Microsoft Press


                    Copyright 2013 Fortify Software - All rights reserved.
                    (Generated from version 2013.1.1.0008 of the Fortify Secure Coding Rulepacks)
                    desc.internal.cpp.buffer_overflow_format_string_%f_%F

                      <pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
                      <pre id="vvttv"></pre>

                        <p id="vvttv"></p>

                            <p id="vvttv"></p>

                                  <p id="vvttv"></p>

                                  <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                                    <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                                      <p id="vvttv"></p>

                                      这里只有精品视频