CWE-382 J2EE不安全实践:使用System.exit()

admin 2022年1月2日04:15:28评论151 views字数 1657阅读5分31秒阅读模式

CWE-382 J2EE不安全实践:使用System.exit()

J2EE Bad Practices: Use of System.exit()

结构: Simple

Abstraction: Variant

状态: Draft

被利用可能性: unkown

基本描述

A J2EE application uses System.exit(), which also shuts down its container.

扩展描述

It is never a good idea for a web application to attempt to shut down the application container. Access to a function that can shut down the application is an avenue for Denial of Service (DoS) attacks.

相关缺陷

  • cwe_Nature: ChildOf cwe_CWE_ID: 705 cwe_View_ID: 1000 cwe_Ordinal: Primary

适用平台

Language: {'cwe_Name': 'Java', 'cwe_Prevalence': 'Undetermined'}

常见的影响

范围 影响 注释
Availability DoS: Crash, Exit, or Restart

可能的缓解方案

Architecture and Design

策略: Separation of Privilege

The shutdown function should be a privileged function available only to a properly authorized administrative user

Implementation

策略:

Web applications should not call methods that cause the virtual machine to exit, such as System.exit()

Implementation

策略:

Web applications should also not throw any Throwables to the application server as this may adversely affect the container.

Implementation

策略:

Non-web applications may have a main() method that contains a System.exit(), but generally should not call System.exit() from other locations in the code

示例代码

Included in the doPost() method defined below is a call to System.exit() in the event of a specific exception.

bad Java

Public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

try {

...

} catch (ApplicationSpecificException ase) {

logger.error("Caught: " + ase.toString());
System.exit(1);

}

}

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
7 Pernicious Kingdoms J2EE Bad Practices: System.exit()
OWASP Top Ten 2004 A9 CWE More Specific Denial of Service
The CERT Oracle Secure Coding Standard for Java (2011) ERR09-J Do not allow untrusted code to terminate the JVM
Software Fault Patterns SFP3 Use of an improper API

文章来源于互联网:scap中文网

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年1月2日04:15:28
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CWE-382 J2EE不安全实践:使用System.exit()http://cn-sec.com/archives/612875.html

发表评论

匿名网友 填写信息