目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1336

100%

CWE-378 创建拥有不安全权限的临时文件 类漏洞列表 35

CWE-378 创建拥有不安全权限的临时文件 类弱点 35 条 CVE 漏洞汇总,含 AI 中文分析。

CWE-378属于临时文件权限配置不当漏洞。当应用程序创建临时文件时若未设置严格权限,攻击者可利用此缺陷通过符号链接攻击或竞态条件,读取敏感数据或篡改文件内容以执行恶意代码。开发者应避免使用默认权限,需显式指定仅所有者可读写,并采用原子性操作确保文件创建与权限设置的同步,从而防止未授权访问。

MITRE CWE 官方描述
CWE:CWE-378 以不安全权限创建临时文件 英文:在不采取适当措施或控制的情况下打开临时文件,可能导致该文件、其内容以及受其影响的任何函数易受攻击。
常见影响 (3)
ConfidentialityRead Application Data
If the temporary file can be read by the attacker, sensitive information may be in that file which could be revealed.
Authorization, OtherOther
If that file can be written to by the attacker, the file might be moved into a place to which the attacker does not have access. This will allow the attacker to gain selective resource access-control privileges.
Integrity, OtherOther
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.
缓解措施 (3)
RequirementsMany contemporary languages have functions which properly handle this condition. Older C temp file functions are especially susceptible.
ImplementationEnsure that you use proper file permissions. This can be achieved by using a safe temp file function. Temporary files should be writable and readable only by the process that owns the file.
ImplementationRandomize temporary file names. This can also be achieved by using a safe temp-file function. This will ensure that temporary files will not be created in predictable places.
代码示例 (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.
FILE *stream; if( (stream = tmpfile()) == NULL ) { perror("Could not open new temporary file\n"); return (-1); } // write data to tmp file ... // remove tmp file rmtmp();
Bad · C
try { File temp = File.createTempFile("pattern", ".suffix"); temp.deleteOnExit(); BufferedWriter out = new BufferedWriter(new FileWriter(temp)); out.write("aString"); out.close(); } catch (IOException e) { }
Bad · Java
CVE ID标题CVSS风险等级Published
CVE-2021-25314 ClusterLabs Hawk 安全漏洞 — SUSE Linux Enterprise High Availability 12-SP3 7.8 High2021-04-14
CVE-2021-21290 Netty 安全漏洞 — netty 6.2 Medium2021-02-08
CVE-2020-8908 Google Guava 访问控制错误漏洞 — Guava 3.3 Low2020-12-10
CVE-2020-27216 Eclipse Jetty 安全漏洞 — Eclipse Jetty 5.8 -2020-10-23
CVE-2016-9485 ForeScout CounterACT 权限许可和访问控制漏洞 — Windows SecureConnector agent 7.8 -2018-07-13

CWE-378(创建拥有不安全权限的临时文件) 是常见的弱点类别,本平台收录该类弱点关联的 35 条 CVE 漏洞。