CWE-498: Cloneable Class Containing Sensitive Information
弱点ID:498
Abstraction:变体 Structure:Simple
View customized information:
描述
该代码包含一个带有敏感数据的类,但是该类是可克的。然后可以通过克隆类访问数据。
Extended Description
Cloneable classes are effectively open classes, since data cannot be hidden in them. Classes that do not explicitly deny cloning can be cloned by any other class without running the constructor.
Relationships
This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to similar items that may exist at higher and lower levels of abstraction. In addition, relationships such as PeerOf and CanAlsoBe are defined to show similar weaknesses that the user may want to explore.
The different Modes of Introduction provide information about how and when this weakness may be introduced. The Phase identifies a point in the life cycle at which introduction may occur, while the Note provides a typical scenario related to introduction during the given phase.
阶段
Note
执行
Applicable Platforms
This listing shows possible areas for which the given weakness could appear. These may be for specific named Languages, Operating Systems, Architectures, Paradigms, Technologies, or a class of such platforms. The platform is listed along with how frequently the given weakness appears for that instance.
Languages
C++(Undetermined Prevalence)
Java(Undetermined Prevalence)
C#(Undetermined Prevalence)
Common Consequences
This table specifies different individual consequences associated with the weakness. The Scope identifies the application security area that is violated, while the Impact describes the negative technical impact that arises if an adversary succeeds in exploiting this weakness. The Likelihood provides information about how likely the specific consequence is expected to be seen relative to the other consequences in the list. For example, there may be high likelihood that a weakness will be exploited to achieve a certain impact, but a low likelihood that it will be exploited to achieve a different impact.
} 公共字符串名称; public String clas; public Teacher(String name,String clas) {
this.name = name; this.clas = clas;
}
}
通过定义克隆函数,使类无容易失败:
(good code)
示例语言:Java
public final void clone() throws java.lang.CloneNotSupportedException {
扔新的Java.lang.clonotsupportedException();
}
潜在的缓解
阶段:实施
如果您确实使您的课程可以克隆,请确保您的克隆方法是最终的,并抛出super.clone()。
会员资格
This MemberOf Relationships table shows additional CWE Categories and Views that reference this weakness as a member. This information is often useful in understanding where a weakness fits within the context of external information sources.
View - a subset of CWE entries that provides a way of examining CWE content. The two main view structures are Slices (flat lists) and Graphs (containing relationships between entries).