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

    Dynamic Code Evaluation: Script Injection

    ABSTRACT

    在運行時中解析用戶控制的指令,會讓攻擊者有機會執行惡意代碼。

    EXPLANATION

    許多現代編程語言都允許動態解析源代碼指令。這使得程序員可以執行基于用戶輸入的動態指令。當程序員錯誤地認為由用戶直接提供的指令僅會執行一些無害的操作時(如對當前的用戶對象進行簡單的計算或修改用戶的狀態),就會出現 code injection 漏洞:然而,若不經過適當的驗證,用戶指定的操作可能并不是程序員最初所期望的。

    例 1:在這段代碼注入示例中,請求參數被綁定到要評估的 Razor 模板。


    ...
    string name = Request["username"];
    string template = "Hello @Model.Name!Welcome " + name + "!";
    string result = Razor.Parse(template, new { Name = "World" });
    ...


    如果 operation 參數的值為良性值,程序就可以正常運行。例如,當該值為 "John" 時,result 變量被賦予的值將為 "Hello World!Welcome John!".然而,如果攻擊者指定的語言操作既有可能是有效的,又有可能是惡意的,那么,只有在對主進程具有完全權限的情況下才能執行這些操作。如果底層語言提供了訪問系統資源的途徑或允許執行系統命令,這種攻擊甚至會更加危險。例如,Razor 允許調用 C# 對象;如果攻擊者計劃將 " @{ System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents=false; proc.StartInfo.FileName=\"calc\"; proc.Start(); }" 指定為 name 的值,主機系統就會執行系統命令。

    REFERENCES

    [1] Standards Mapping - OWASP Top 10 2010 - (OWASP 2010) A1 Injection

    [2] Standards Mapping - OWASP Top 10 2007 - (OWASP 2007) A3 Malicious File Execution

    [3] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A6 Injection Flaws

    [4] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3510 CAT I, APP3570 CAT I

    [5] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP3510 CAT I, APP3570 CAT I

    [6] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 95

    [7] Standards Mapping - SANS Top 25 2009 - (SANS 2009) Insecure Interaction - CWE ID 116

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

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

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

    [11] Standards Mapping - FIPS200 - (FISMA) SI


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

    97av