CWE

Common Weakness Enumeration

社区开发的软件和硬件弱点类型清单

2021 CWE Most Important Hardware Weaknesses
CWE Top 25 Most Dangerous Weaknesses
Home>CWE List> cwe-单个字典定义(4.10)
ID

CWE-378: Creation of Temporary File With Insecure Permissions

弱点ID:378
Abstraction:Base
Structure:Simple
查看自定义信息:
+描述
Opening temporary files without appropriate measures or controls can leave the file, its contents and any function that it impacts vulnerable to attack.
+Relationships
Section HelpThis 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.
+与观点“研究概念”相关(CWE-1000)
Nature 类型 ID Name
ChildOf Class班级 - 以非常抽象的方式描述的弱点,通常与任何特定的语言或技术无关。比支柱弱点更具体,但比基本弱点更一般。班级弱点通常用以下维度的1或2来描述问题:行为,属性和资源。 377 Insecure Temporary File
Section HelpThis 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.
+与“软件开发”视图相关(CWE-699)
Nature 类型 ID Name
MemberOf 类别类别 - 包含共享共同特征的其他条目的CWE条目。 1219 File Handling Issues
+Modes Of Introduction
Section HelpThe 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
Section HelpThis 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

Class: Not Language-Specific(Undetermined Prevalence)

+Common Consequences
Section HelpThis 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.
Scope 影响 Likelihood
保密

Technical Impact:Read Application Data

如果攻击者可以读取临时文件,则可以在该文件中读取敏感信息。
授权
Other

Technical Impact:Other

如果该文件可以由攻击者写信,则该文件可能会移至攻击者无法访问的地方。这将使攻击者能够获得选择性的资源访问权限特权。
正直
Other

Technical Impact:Other

Depending on the data stored in the temporary file, there is the potential for an attacker to gain an additional input vector which is trusted as non-malicious. It may be possible to make arbitrary changes to data structures, user information, or even process ownership.
+Likelihood Of Exploit
高的
+示例的例子

示例1

In the following code examples a temporary file is created and written to. After using the temporary file, the file is closed and deleted from the file system.

(bad code)
示例语言:C
文件 *流;
if(((stream = tmpfile())== null){

perror("Could not open new temporary file\n");
return (-1);
}
// write data to tmp file
。。。
// remove tmp file
rmtmp();

但是,在此C/C ++代码中,方法tmpfile()用于创建和打开临时文件。tmpfile()方法的工作方式与fopen()方法在读/写许可中的工作方式相同,从而允许攻击者读取临时文件中包含的潜在敏感信息或修改文件的内容。

(bad code)
示例语言:Java
尝试 {
file temp = file.createTemPfile(“模式”,“ .suffix”);
temp.deleteOnExit();
BufferedWriter out = new BufferedWriter(new FileWriter(temp));
out.write("aString");
out.close();
}
捕获(ioexception e){
}

Similarly, the createTempFile() method used in the Java code creates a temp file that may be readable and writable to all users.

另外,上面使用的两种方法都将文件放入默认目录中。在UNIX系统上,默认目录通常为“/tmp”或“/var/tmp”,在Windows系统上,默认目录通常为“ C:\\ Windows \\ temp”,攻击者可以轻松访问,可能可以启用它们读取和修改临时文件的内容。

+潜在的缓解

阶段: Requirements

许多现代语言具有适当处理这种情况的功能。较旧的C温度文件功能特别容易受到影响。

阶段:实施

确保您使用适当的文件权限。这可以通过使用安全的温度文件功能来实现。临时文件应是可写的,并且只有由拥有文件的过程才能可读。

阶段:实施

随机化临时文件名。这也可以通过使用安全的临时文件函数来实现。这将确保不会在可预测的位置创建临时文件。
+会员资格
Section HelpThis 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.
Nature 类型 ID Name
MemberOf 类别类别 - 包含共享共同特征的其他条目的CWE条目。 964 SFP Secondary Cluster: Exposure Temporary File
+分类映射
Mapped Taxonomy Name Node ID 合身 Mapped Node Name
CLASP Improper temp file opening
+参考
[Ref-18] Secure Software,Inc.。“ The CLASP应用程序安全过程”。2005年。<https://cwe.mitre.org/documents/sources/TheCLASPApplicationSecurityProcess.pdf>。
+Content History
+提交
提交日期 Submitter 组织
2006-07-19 CLASP
+Modifications
Modification Date 修饰符 组织
2008-07-01 Eric Dalci 雪茄
updated Time_of_Introduction
2008-09-08 CWE Content Team MITRE
更新的common_cconsquences, Relationships, Other_Notes, Taxonomy_Mappings
2009-10-29 CWE Content Team MITRE
更新的common_cconsquences, Other_Notes
2011-06-01 CWE Content Team MITRE
更新的common_cconsquences
2012-05-11 CWE Content Team MITRE
更新的关系
2012-10-30 CWE Content Team MITRE
更新了示范_examples,势_mitigations
2014-06-23 CWE Content Team MITRE
更新的势_MINEIGATIONS
2014-07-30 CWE Content Team MITRE
更新的关系
2017-11-08 CWE Content Team MITRE
updated Applicable_Platforms, Demonstrative_Examples
2020-02-24 CWE Content Team MITRE
更新的引用,关系
2021-03-15 CWE Content Team MITRE
更新了示范_examples
+先前的输入名称
改变日期 Previous Entry Name
2008-04-11 Improper Temporary File Opening
提供更多信息 - 请选择其他过滤器。
Page Last Updated:January 31, 2023