CWE-496 公开数据赋值给私有的数组类型数据域

admin 2021年12月16日16:45:50评论120 views字数 1115阅读3分43秒阅读模式

CWE-496 公开数据赋值给私有的数组类型数据域

Public Data Assigned to Private Array-Typed Field

结构: Simple

Abstraction: Variant

状态: Incomplete

被利用可能性: unkown

基本描述

Assigning public data to a private array is equivalent to giving public access to the array.

相关缺陷

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

适用平台

Language: [{'cwe_Name': 'C', 'cwe_Prevalence': 'Undetermined'}, {'cwe_Name': 'C++', 'cwe_Prevalence': 'Undetermined'}, {'cwe_Name': 'Java', 'cwe_Prevalence': 'Undetermined'}, {'cwe_Name': 'C#', 'cwe_Prevalence': 'Undetermined'}]

常见的影响

范围 影响 注释
Integrity Modify Application Data The contents of the array can be modified from outside the intended scope.

可能的缓解方案

Implementation

策略:

Do not allow objects to modify private members of a class.

示例代码

In the example below, the setRoles() method assigns a publically-controllable array to a private field, thus allowing the caller to modify the private array directly by virtue of the fact that arrays in Java are mutable.

bad Java

private String[] userRoles;
public void setUserRoles(String[] userRoles) {

this.userRoles = userRoles;

}

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
7 Pernicious Kingdoms Public Data Assigned to Private Array-Typed Field
Software Fault Patterns SFP25 Tainted input to variable

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

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年12月16日16:45:50
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CWE-496 公开数据赋值给私有的数组类型数据域http://cn-sec.com/archives/612982.html

发表评论

匿名网友 填写信息