CWE-246 J2EE不安全实践:对套接字的直接使用

admin 2021年12月16日16:01:35CWE(弱点枚举)评论39 views1629字阅读5分25秒阅读模式

CWE-246 J2EE不安全实践:对套接字的直接使用

J2EE Bad Practices: Direct Use of Sockets

结构: Simple

Abstraction: Variant

状态: Draft

被利用可能性: unkown

基本描述

The J2EE application directly uses sockets instead of using framework method calls.

扩展描述

The J2EE standard permits the use of sockets only for the purpose of communication with legacy systems when no higher-level protocol is available. Authoring your own communication protocol requires wrestling with difficult security issues.

Without significant scrutiny by a security expert, chances are good that a custom communication protocol will suffer from security problems. Many of the same issues apply to a custom implementation of a standard protocol. While there are usually more resources available that address security concerns related to implementing a standard protocol, these resources are also available to attackers.

相关缺陷

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

  • cwe_Nature: ChildOf cwe_CWE_ID: 695 cwe_View_ID: 699 cwe_Ordinal: Primary

适用平台

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

常见的影响

范围 影响 注释
Other Quality Degradation

可能的缓解方案

Architecture and Design

策略:

Use framework method calls instead of using sockets directly.

示例代码

The following example opens a socket to connect to a remote server.

bad Java

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


// Perform servlet tasks.

...

// Open a socket to a remote server (bad).

Socket sock = null;

try {

sock = new Socket(remoteHostname, 3000);

// Do something with the socket.

...

} catch (Exception e) {

...

}

}

A Socket object is created directly within the Java servlet, which is a dangerous way to manage remote connections.

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
7 Pernicious Kingdoms J2EE Bad Practices: Sockets
Software Fault Patterns SFP3 Use of an improper API

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

特别标注: 本站(CN-SEC.COM)所有文章仅供技术研究,若将其信息做其他用途,由用户承担全部法律及连带责任,本站不承担任何法律及连带责任,请遵守中华人民共和国安全法.
  • 我的微信
  • 微信扫一扫
  • weinxin
  • 我的微信公众号
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年12月16日16:01:35
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                  CWE-246 J2EE不安全实践:对套接字的直接使用 http://cn-sec.com/archives/613136.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: