CWE-377 不安全的临时文件

admin 2022年1月2日04:09:41CWE(弱点枚举)评论19 views1603字阅读5分20秒阅读模式

CWE-377 不安全的临时文件

Insecure Temporary File

结构: Simple

Abstraction: Base

状态: Incomplete

被利用可能性: unkown

基本描述

Creating and using insecure temporary files can leave application and system data vulnerable to attack.

相关缺陷

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

适用平台

Language: {'cwe_Class': 'Language-Independent', 'cwe_Prevalence': 'Undetermined'}

常见的影响

范围 影响 注释
['Confidentiality', 'Integrity'] ['Read Files or Directories', 'Modify Files or Directories']

示例代码

The following code uses a temporary file for storing intermediate data gathered from the network before it is processed.

bad C

if (tmpnam_r(filename)) {


FILE* tmp = fopen(filename,"wb+");
while((recv(sock,recvbuf,DATA_SIZE, 0) > 0)&(amt!=0)) amt = fwrite(recvbuf,1,DATA_SIZE,tmp);

}
...

This otherwise unremarkable code is vulnerable to a number of different attacks because it relies on an insecure method for creating temporary files. The vulnerabilities introduced by this function and others are described in the following sections. The most egregious security problems related to temporary file creation have occurred on Unix-based operating systems, but Windows applications have parallel risks. This section includes a discussion of temporary file creation on both Unix and Windows systems. Methods and behaviors can vary between systems, but the fundamental risks introduced by each are reasonably constant.

Notes

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
7 Pernicious Kingdoms Insecure Temporary File
CERT C Secure Coding CON33-C Imprecise Avoid race conditions when using library functions
The CERT Oracle Secure Coding Standard for Java (2011) FIO00-J Do not operate on files in shared directories

相关攻击模式

  • CAPEC-155

引用

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

特别标注: 本站(CN-SEC.COM)所有文章仅供技术研究,若将其信息做其他用途,由用户承担全部法律及连带责任,本站不承担任何法律及连带责任,请遵守中华人民共和国安全法.
  • 我的微信
  • 微信扫一扫
  • weinxin
  • 我的微信公众号
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年1月2日04:09:41
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                  CWE-377 不安全的临时文件 http://cn-sec.com/archives/612893.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: