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

    Privilege Management: Overly Broad Access Specifier

    ABSTRACT

    可從 JVM 中的其他位置調用 public 方法中的特權代碼。

    EXPLANATION

    安全編碼原則要求盡可能地提高訪問說明符的限制性。如果方法帶有 public 訪問說明符,則表示任意外部代碼都可以調用該方法。如果在代碼可動態進入系統(例如 Code Injection、Dangerous File Inclusion、File Upload 等)的庫或環境中共享代碼,則用于執行特權操作的公共方法可能非常危險。



    例 1:在下列代碼中,doPrivilegedOpenFile() 聲明為 public,并且執行了一個權限操作。


    public static void doPrivilegedOpenFile(final String filePath) {
    final BadFileNamePrivilegedAction pa = new BadFileNamePrivilegedAction(filePath);

    FileInputStream fis = null;
    ...
    fis = (FileInputStream)AccessController.doPrivileged(pa);
    ...
    }

    REFERENCES

    [1] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3500 CAT II

    [2] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP3500 CAT II

    [3] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 265

    [4] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 - (PCI 1.2) Requirement 6.5.7, Requirement 7.2

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

    [6] Secure Coding Guidelines for the Java Programming Language, version 2.0 Sun Microsystems, Inc.

    [7] M. S. Ware Writing secure Java code:taxonomy of heuristics and an evaluation of static analysis tools


    Copyright 2013 Fortify Software - All rights reserved.
    (Generated from version 2013.1.1.0008 of the Fortify Secure Coding Rulepacks)
    desc.structural.java.privilege_management_overly_broad_access_specifier

    97av