CWE-499 可序列化的类中包含敏感信息

admin 2021年12月16日15:50:35评论340 views字数 1764阅读5分52秒阅读模式

CWE-499 可序列化的类中包含敏感信息

Serializable Class Containing Sensitive Data

结构: Simple

Abstraction: Variant

状态: Draft

被利用可能性: High

基本描述

The code contains a class with sensitive data, but the class does not explicitly deny serialization. The data can be accessed by serializing the class through another class.

扩展描述

Serializable classes are effectively open classes since data cannot be hidden in them. Classes that do not explicitly deny serialization can be serialized by any other class, which can then in turn use the data stored inside it.

相关缺陷

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

  • cwe_Nature: CanPrecede cwe_CWE_ID: 200 cwe_View_ID: 1000

  • cwe_Nature: CanPrecede cwe_CWE_ID: 200 cwe_View_ID: 699

适用平台

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

常见的影响

范围 影响 注释
Confidentiality Read Application Data an attacker can write out the class to a byte stream, then extract the important data from it.

可能的缓解方案

Implementation

策略:

In Java, explicitly define final writeObject() to prevent serialization. This is the recommended solution. Define the writeObject() function to throw an exception explicitly denying serialization.

Implementation

策略:

Make sure to prevent serialization of your objects.

示例代码

This code creates a new record for a medical patient:

bad Java

class PatientRecord {

private String name;
private String socialSecurityNum;
public Patient(String name,String ssn) {

this.SetName(name);
this.SetSocialSecurityNumber(ssn);

}

}

This object does not explicitly deny serialization, allowing an attacker to serialize an instance of this object and gain a patient's name and Social Security number even though those fields are private.

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
CLASP Information leak through serialization
The CERT Oracle Secure Coding Standard for Java (2011) SER03-J Do not serialize unencrypted, sensitive data
The CERT Oracle Secure Coding Standard for Java (2011) SER05-J Do not serialize instances of inner classes
Software Fault Patterns SFP23 Exposed Data

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

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年12月16日15:50:35
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CWE-499 可序列化的类中包含敏感信息https://cn-sec.com/archives/613241.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息