Programs must comply with the principle of least privilege not only by providing privileged blocks with the minimum permissions required for correct operation, but also by ensuring that privileged blocks contain only those operations that require the increased privileges. Superfluous code contained within a privileged block necessarily operates with the privileges of that block; this increases the potential attack surface exposed to an attacker. Consequently, privileged blocks are forbidden to must not contain superfluous code.
...
This is a violation of the principle of least privilege because a caller who does may not have the required privileges can indirectly also load the specified library provided the security policy allows doing so. This transfers the burden of ensuring security to the administrator who implements the security policy.
...
Wiki Markup |
---|
This compliant solution moves the call to {{System.loadLibrary()}} outside the {{doPrivileged()}} block. Any operations on the file descriptor {{f\[0\]}} mustshould also occur outside the privileged block to make it easier to audit privileged code. However, {{f\[0\]}} shouldmust not leak out to untrusted code (see [SEC00-J. Do not allow doPrivileged() blocks to leak sensitive information outside a trust boundary]). As a result, the "operations on the file" must not allow {{f\[0\]}} to escape out of {{changePassword()}}. Minimizing the amount of code that requires elevated privileges eases the necessary task of auditing privileged code. |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="aa31d591a5582398-56b56091-44a2451e-913886fa-c82ffbbbcb91007e86af7f9f"><ac:plain-text-body><![CDATA[ | [ISO/IEC TR 24772:2010 | http://www.aitcnet.org/isai/] | "Privilege Sandbox Issues [XYO]" | ]]></ac:plain-text-body></ac:structured-macro> |
CWE ID 272, "Least Privilege Violation" |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="035d74879ec04328-a7a30c03-49e94daf-8875ac16-1635ac1aec998e38a287050a"><ac:plain-text-body><![CDATA[ | [[API 2006 | AA. Bibliography#API 06]] | Class | ]]></ac:plain-text-body></ac:structured-macro> |
...