<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>

                    Directory Restriction

                    ABSTRACT

                    對 chroot() 系統調用的使用不當會讓攻擊者從 chroot 監牢中逃脫出來。

                    EXPLANATION

                    chroot() 系統調用允許程序修改其 file system 根目錄的含義。適當地調用 chroot() 后,程序無法訪問在新的根目錄下定義的目錄樹之外的任何文件。這樣的環境稱為 chroot 監牢,通常用來防止攻擊者破壞進程,繼而訪問未經授權的文件。例如,在 chroot 監牢環境中運行多個 FTP 服務器,可以防止攻擊者發現新服務器漏洞后下載密碼文件或者其他系統中的敏感文件。

                    對 chroot() 的使用不當可能會讓攻擊者從 chroot 監牢中逃脫出來。因為 chroot() 函數的調用不會改變進程當前的工作目錄,所以在調用 chroot() 之后,相對路徑可能仍然會引用 chroot 監牢之外的 file system 資源。

                    例 1:考慮以下這段來自(假設的)FTP 服務器的源代碼:


                    chroot("/var/ftproot");
                    ...
                    fgets(filename, sizeof(filename), network);
                    localfile = fopen(filename, "r");
                    while ((len = fread(buf, 1, sizeof(buf), localfile)) != EOF) {
                    fwrite(buf, 1, sizeof(buf), network);
                    }
                    fclose(localfile);


                    這段代碼負責從網絡中讀取文件名,然后將相應的文件在本地機器上打開,并通過網絡傳送內容。這段代碼可用來執行 FTP GET 命令。FTP 服務器在其初始化例程中調用 chroot(),試圖阻止對 /var/ftproot 之外的文件的訪問。但因為服務器沒有通過調用 chdir("/") 來更改當前的工作目錄,所以攻擊者可以請求文件的 "../../../../../etc/passwd",并獲取該系統密碼文件的副本。

                    REFERENCES

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

                    [2] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 243

                    [3] A. Chuvakin Using Chroot Securely


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

                      <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>

                                      这里只有精品视频