界: Time and State

分布式计算是关于时间和状态的。也就是说,为了让多个组件相互通信,必须共享状态,所有这些都需要时间。

大多数程序员都会将其工作拟人化。他们会让一个控制线程以同样的方式(他们必须自己完成工作时采取的方式)执行整个程序。然而,现代计算机不同任务之间切换得非常快,在多核、多 CPU 或分布式系统中,两个事件可能完全同时发生。程序员预期的程序执行过程与实际情况之间存在差距,即存在缺陷。这些缺陷与线程、流程、时间和信息之间的意外交互有关。这些交互是通过共享状态发生的:信号量、变量、文件系统,以及总而言之,可以存储信息的任何内容。

19 个项目已找到
弱点
Abstract
把一个不可序列化的对象作为 HttpSessionState 属性来储存会破坏应用程序的可靠性。
Explanation
默认情况下,ASP.NET 服务器会存储 HttpSessionState 对象、其属性及其在内存中引用的任何对象。该模型将活动会话状态限制为只利用一台计算机的系统内存所能提供的资源。为了超越这些限制来扩展容量,要频繁地为服务器配置持久会话状态信息,这样不但可以扩展容量,还允许在多台机器上来回复制以提高整体性能。为了能够维持其会话状态,服务器必须对 HttpSessionState 对象进行序列化,这就要求存储在服务器中的所有对象都是可序列化的。

为了让会话能够正确地进行序列化,应用程序以会话属性形式存储的所有对象都必须声明 [Serializable] 属性。另外,如果对象需要用自定义的序列化方法,它还必须实施一个 ISerializable 接口。

例 1:下面这个类会把自己添加到会话中,但因为它是不可序列化的,因此会话也就不能正确序列化。


public class DataGlob {
String GlobName;
String GlobValue;

public void AddToSession(HttpSessionState session) {
session["glob"] = this;
}
}
References
[1] Session State Providers Microsoft Corporation
[2] Underpinnings of the Session State Implementation in ASP.NET Microsoft Corporation
[3] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 4.1
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 2
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[7] Standards Mapping - Common Weakness Enumeration CWE ID 579
[8] Standards Mapping - OWASP Top 10 2004 A3 Broken Authentication and Session Management
[9] Standards Mapping - OWASP Top 10 2007 A7 Broken Authentication and Session Management
[10] Standards Mapping - OWASP Top 10 2010 A3 Broken Authentication and Session Management
[11] Standards Mapping - OWASP Top 10 2013 A2 Broken Authentication and Session Management
[12] Standards Mapping - OWASP Top 10 2017 A2 Broken Authentication
[13] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[14] Standards Mapping - OWASP Mobile 2014 M1 Weak Server Side Controls
[15] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.3
[16] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.5.7
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.8
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.10
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.10
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.10
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.10
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[23] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[24] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection
desc.structural.dotnet.asp_dotnet_bad_practices_non_serializable_object_stored_in_session
Abstract
调用 sleep() 同时保持锁定可能会导致性能下降以及死锁。
Explanation
如果多个线程尝试获取一个资源上的锁定,在调用 sleep() 的同时保持锁定可导致所有其他线程等待释放该资源,这就会造成性能下降和死锁。

例 1:下列代码调用 sleep() 同时还保持锁定。

ReentrantLock rl = new ReentrantLock();
...
rl.lock();
Thread.sleep(500);
...
rl.unlock();
References
[1] LCK09-J. Do not perform operations that can block while holding a lock CERT
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5.0
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - Common Weakness Enumeration CWE ID 557
[7] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-000336, CCI-000366, CCI-001094
[8] Standards Mapping - NIST Special Publication 800-53 Revision 4 CM-4 Security Impact Analysis (P2), CM-6 Configuration Settings (P1), SC-5 Denial of Service Protection (P1)
[9] Standards Mapping - NIST Special Publication 800-53 Revision 5 CM-4 Impact Analyses, CM-6 Configuration Settings, SC-5 Denial of Service Protection
[10] Standards Mapping - OWASP Top 10 2004 A9 Application Denial of Service
[11] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.9
[12] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP6080 CAT II
[13] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP6080 CAT II
[14] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP6080 CAT II
[15] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP6080 CAT II
[16] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP6080 CAT II
[17] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP6080 CAT II
[18] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP6080 CAT II
[19] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002400 CAT II
[20] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002400 CAT II
[21] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002400 CAT II
[22] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002400 CAT II
[23] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002400 CAT II
[24] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002400 CAT II
[25] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002400 CAT II
[26] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002400 CAT II
[27] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002400 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002400 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002400 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002400 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002400 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002400 CAT II, APSC-DV-002950 CAT II
[33] Standards Mapping - Web Application Security Consortium Version 2.00 Denial of Service (WASC-10)
[34] Standards Mapping - Web Application Security Consortium 24 + 2 Denial of Service
desc.controlflow.java.code_correctness_call_to_sleep_in_lock
Abstract
Double-checked locking 是一种不正确的用法,并不能达到预期目标。
Explanation
许多才智卓越的人都试图使用 double-checked locking 方法来提高性能,并为此付出了大量的时间,但是无一成功。

例 1:乍一看,下列代码似乎既能避免不必要的同步又能保证线程的安全性。


if (fitz == null) {
synchronized (this) {
if (fitz == null) {
fitz = new Fitzer();
}
}
}
return fitz;


程序员希望保证仅分配一个 Fitzer() 对象,但又不希望每次调用该代码时都进行一次同步。这就是所谓的 double-checked locking 方法。

令人遗憾的是,它并不起作用,并且可以分配多个 Fitzer() 对象。有关更多详细信息,请参见 The "Double-Checked Locking is Broken" Declaration [1]。
References
[1] D. Bacon et al. The "Double-Checked Locking is Broken" Declaration
[2] LCK10-J. Use a correct form of the double-checked locking idiom CERT
[3] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 3.0
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[7] Standards Mapping - Common Weakness Enumeration CWE ID 609
[8] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.6
[9] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.6
[10] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.6
[11] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.6
[12] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[13] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection
[14] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection
desc.structural.java.code_correctness_double_checked_locking
Abstract
如果线程向其他线程发出信号后并未解除锁定 mutex,则其他线程将保持锁定并继续等待 mutex。
Explanation
在线程向其他等待 mutex 的线程发出信号后,它必须调用 pthread_mutex_unlock() 来解除锁定 mutex,然后其他线程才能开始运行。如果发出信号的线程无法解除锁定 mutex,则在第二个线程中调用 pthread_cond_wait() 函数时不会返回任何值,该线程也将无法执行。

例 1:以下代码通过调用 pthread_cond_signal() 向其他等待 mutex 的线程发出信号,但无法解除锁定 mutex,而其他线程会继续等待 mutex。


...
pthread_mutex_lock(&count_mutex);

// Signal waiting thread
pthread_cond_signal(&count_threshold_cv);
...
References
[1] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[2] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2.0
[3] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[4] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[5] Standards Mapping - Common Weakness Enumeration CWE ID 373
[6] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-000336, CCI-000366, CCI-001094
[7] Standards Mapping - Motor Industry Software Reliability Association (MISRA) C Guidelines 2012 Rule 1.3
[8] Standards Mapping - NIST Special Publication 800-53 Revision 4 CM-4 Security Impact Analysis (P2), CM-6 Configuration Settings (P1), SC-5 Denial of Service Protection (P1)
[9] Standards Mapping - NIST Special Publication 800-53 Revision 5 CM-4 Impact Analyses, CM-6 Configuration Settings, SC-5 Denial of Service Protection
[10] Standards Mapping - OWASP Top 10 2004 A9 Application Denial of Service
[11] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.9
[12] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP6080 CAT II
[13] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP6080 CAT II
[14] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP6080 CAT II
[15] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP6080 CAT II
[16] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP6080 CAT II
[17] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP6080 CAT II
[18] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP6080 CAT II
[19] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002400 CAT II
[20] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002400 CAT II
[21] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002400 CAT II
[22] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002400 CAT II
[23] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002400 CAT II
[24] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002400 CAT II
[25] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002400 CAT II
[26] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002400 CAT II
[27] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002400 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002400 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002400 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002400 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002400 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002400 CAT II, APSC-DV-002950 CAT II
[33] Standards Mapping - Web Application Security Consortium Version 2.00 Denial of Service (WASC-10)
[34] Standards Mapping - Web Application Security Consortium 24 + 2 Denial of Service
desc.structural.cpp.code_correctness_erroneous_synchronization
Abstract
创建和使用 insecure temporary file 会容易使应用程序和系统数据受到攻击。
Explanation
应用程序会非常频繁地使用临时文件,因此您可以使用多种不同的机制在 C 库和 Windows(R) API 中创建临时文件。而多数函数都很容易受到各种攻击。
示例:以下代码使用一个临时文件,在它被处理之前用来存储从网络上收集到的中间数据。


...
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);
}
...


这种其他情况下无法标记的代码很容易受到多种不同形式的攻击,因为它靠一种不安全的方法来创建临时文件。以下部分主要描述了由该函数和其他函数引入的漏洞。大部分与临时文件创建有关的突出安全问题已经在基于 Unix 的操作系统上屡见不鲜,但是 Windows 应用程序同样存在着这样的风险。这部分对在 Unix 和 Windows 系统上创建临时文件的问题进行了讨论。

不同系统之间使用的方法和行为可能各不不同,但是被引入的基本风险则相差不大。针对创建临时文件的安全方法,要了解有关安全的核心语言函数的信息及建议,请查看“建议”部分。

对于旨在帮助创建临时文件的函数,可以根据它们是仅提供文件名还是实际打开新文件分成两个组。

第 1 组 —“唯一的”文件名:

在第一组中,C 库和 WinAPI 函数用来帮助创建一个临时文件。它们可为程序随后打开的新的临时文件生成一个唯一的文件名。这组包含了诸如 tmpnam()tempnam()mktemp() 等 C 库函数以及 C++ 中以 _(下划线)开头的相应函数和 Windows API 中的 GetTempFileName() 函数。这组函数在文件名的选择方面很可能会在底层碰到 race condition。虽然函数可以保证在选择文件时其文件名是唯一的,但是还无法防止其他进程或攻击者在选择文件后,而应用程序尚未尝试打开该文件前的这段时间内创建一个同名文件。不止是由其他程序调用相同函数所引发的合法冲突,攻击者还非常有可能创建一个恶意的冲突,因为这些函数创建的文件名没有进行充分的随机化,使其难以被攻击者猜测。

如果使用选定的名称创建文件,那么根据打开方式的不同,文件现有的内容或访问权限可能会保持不变。如果文件的现有内容是恶意的,攻击者可能会在应用程序从临时文件中读取数据时向程序中注入危险数据。如果攻击者预先创建了一个能轻松获取访问权限的文件,那么可能会访问、修改或破坏应用程序存储在临时文件里的数据。在基于 Unix 的系统上,如果攻击者预先创建了一个作为另一个重要文件链接的文件,则可能会引发更加严重的攻击。然后,如果应用程序被截短或向文件中写入数据,那么它可能会在不知不觉中帮助攻击者,为其执行各种恶意操作。如果程序再使用提高了的权限运行,那会使问题变得更加严重。

最后,最好的情况就是通过调用 open() 函数并使用 O_CREATO_EXCL 标记来打开文件,或者通过调用 CreateFile() 函数并使用 CREATE_NEW 属性来打开文件,这样,如果文件已经存在,该操作就会失败,因此可以有效地防止上述攻击类型。然而,如果攻击者可以准确预测一系列临时文件名,那么就可以阻止应用程序打开必要的临时存储空间,从而导致拒绝服务 (DoS) 攻击。如果仅从一小部分随机数中选择由这些函数生成的文件名,那么会很容易发动这种类型的攻击。

第 2 组 —“唯一的”文件:

在第二组中,C 库函数通过生成唯一的文件名且打开这个文件,来解决一些与临时文件有关的安全问题。这部分包含了像 tmpfile() 这样的 C 库函数和与之对应的以 _(下划线)开头的 C++ 函数,以及表现更为出色的 C 库函数 mkstemp()

tmpfile() 样式的函数可以构造唯一的文件名,并在传递了 "wb+" 标志的情况下能够按照与 fopen() 函数相同的方式(即,作为在读/写模式下的二进制文件)打开文件。如果文件已存在,tmpfile() 将把文件的大小缩小为 0,也许能缓解前面提到的安全问题(唯一文件名的选择与随后打开所选文件之间的 race condition)。然而,该操作显然不能解决函数的安全性问题。首先,攻击者可以预先创建一个能轻松获取访问权限的文件,该文件可能会被用 tmpfile() 函数打开的文件保留。其次,在基于 Unix 的系统上,如果攻击者预先创建了一个文件作为另一重要文件的链接,应用程序可能会使用提高了的权限去截短该文件,这样就能按照攻击者的意愿执行破坏。最后,如果 tmpfile() 创建了一个新文件,那么应用在该文件上的访问权限在不同的操作系统间是不同的,因此,应用程序的数据极易受到攻击,即便是攻击者无法预测要使用的文件名。

最后,mkstemp() 函数是一种创建临时文件的安全方法。它根据用户提供的模板(该模板由一系列随机生成的字符组成),尝试创建或打开一个唯一的文件。如果它无法创建一个这样的文件,则操作失败,并返回 -1。在最新的系统中,文件使用 0600 模式打开,这就意味着文件不会被篡改,除非用户直接更改其访问权限。然而,mkstemp() 仍然会受到使用可预测文件名的威胁,且如果攻击者通过猜测和预先创建将要使用的文件名的文件,而导致 mkstemp() 函数失效,将使应用程序极易受到 denial of service 攻击。
References
[1] B. Schneier Yarrow: A secure pseudorandom number generator
[2] CryptLib
[3] Crypto++
[4] BeeCrypt
[5] OpenSSL
[6] CryptoAPI: CryptGenRandom() Microsoft
[7] RtlGenRandom() Microsoft
[8] .NET System.Security.Cryptography: Random Number Generation Microsoft
[9] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[10] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2.0
[11] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 2
[12] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[13] Standards Mapping - CIS Kubernetes Benchmark partial
[14] Standards Mapping - Common Weakness Enumeration CWE ID 377
[15] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001090
[16] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[17] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-4 Information in Shared Resources (P1)
[18] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-4 Information in Shared System Resources
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 3.3.1, Requirement 3.5.1
[20] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002380 CAT II
[21] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002380 CAT II
[22] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002380 CAT II
[23] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002380 CAT II
[24] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002380 CAT II
[25] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002380 CAT II
[26] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002380 CAT II
[27] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002380 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002380 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002380 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002380 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002380 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002380 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002380 CAT II
desc.semantic.cpp.insecure_temporary_file
Abstract
创建和使用 insecure temporary file 会容易使应用程序和系统数据受到攻击。
Explanation
应用程序需要非常频繁地使用临时文件,因此存在许多不同的机制来创建这些临时文件。而多数函数都很容易受到各种攻击。
示例:以下代码使用一个临时文件,在它被处理之前用来存储从网络上收集到的中间数据。


...
try:
tmp_filename = os.tempnam()
tmp_file = open(tmp_filename, 'w')
data = s.recv(4096)
while True:
more = s.recv(4096)
tmp_file.write(more)
if not more:
break
except socket.timeout:
errMsg = "Connection timed-out while connecting"
self.logger.exception(errMsg)
raise Exception
...


这种其他情况下无法标记的代码很容易受到多种不同形式的攻击,因为它靠一种不安全的方法来创建临时文件。以下部分主要描述了由该函数和其他函数引入的漏洞。大部分与临时文件创建有关的突出安全问题已经在基于 Unix 的操作系统上屡见不鲜,但是 Windows 应用程序同样存在着这样的风险。

不同系统之间使用的方法和行为可能各不不同,但是被引入的基本风险则相差不大。针对创建临时文件的安全方法,要了解有关安全的核心语言函数的信息及建议,请查看“建议”部分。

对于旨在帮助创建临时文件的函数,可以根据它们是仅提供文件名还是实际打开新文件分成两个组。

第 1 组 —“唯一的”文件名:

旨在帮助创建临时文件的第一组函数,可为程序随后打开的新临时文件生成唯一的文件名。这组函数在文件名的选择方面很可能会在底层碰到 race condition。虽然函数可以保证在选择文件时其文件名是唯一的,但是还无法防止其他进程或攻击者在选择文件后,而应用程序尚未尝试打开该文件前的这段时间内创建一个同名文件。不止是由其他程序调用相同函数所引发的合法冲突,攻击者还非常有可能创建一个恶意的冲突,因为这些函数创建的文件名没有进行充分的随机化,使其难以被攻击者猜测。

如果使用选定的名称创建文件,那么根据打开方式的不同,文件现有的内容或访问权限可能会保持不变。如果文件的现有内容是恶意的,攻击者可能会在应用程序从临时文件中读取数据时向程序中注入危险数据。如果攻击者预先创建了一个能轻松获取访问权限的文件,那么可能会访问、修改或破坏应用程序存储在临时文件里的数据。在基于 Unix 的系统上,如果攻击者预先创建了一个作为另一个重要文件链接的文件,则可能会引发更加严重的攻击。然后,如果应用程序被截短或向文件中写入数据,那么它可能会在不知不觉中帮助攻击者,为其执行各种恶意操作。如果程序再使用提高了的权限运行,那会使问题变得更加严重。

最后,最好通过使用 os.O_CREATos.O_EXCL 标记调用 open() 来打开文件,如果该文件已存在,则操作将失败,从而可防止上述攻击类型。然而,如果攻击者可以准确预测一系列临时文件名,那么就可以阻止应用程序打开必要的临时存储空间,从而导致拒绝服务 (DoS) 攻击。如果仅从一小部分随机数中选择由这些函数生成的文件名,那么会很容易发动这种类型的攻击。

第 2 组 —“唯一的”文件:

第二组函数通过生成唯一的文件名且打开这个文件,来解决一些与临时文件有关的安全问题。这一组包括 tmpfile() 等函数。

tmpfile() 样式的函数可以构造唯一的文件名,并在传递了 "wb+" 标志的情况下能够按照与 open() 函数相同的方式(即,作为在读/写模式下的二进制文件)打开文件。如果文件已存在,tmpfile() 将把文件的大小缩小为 0,也许能缓解前面提到的安全问题(唯一文件名的选择与随后打开所选文件之间的 race condition)。然而,该操作显然不能解决函数的安全性问题。首先,攻击者可以预先创建一个能轻松获取访问权限的文件,该文件可能会被用 tmpfile() 函数打开的文件保留。其次,在基于 Unix 的系统上,如果攻击者预先创建了一个文件作为另一重要文件的链接,应用程序可能会使用提高了的权限去截短该文件,这样就能按照攻击者的意愿执行破坏。最后,如果 tmpfile() 创建了一个新文件,那么应用在该文件上的访问权限在不同的操作系统间是不同的,因此,应用程序的数据极易受到攻击,即便是攻击者无法预测要使用的文件名。
References
[1] B. Schneier Yarrow: A secure pseudorandom number generator
[2] Python Library Reference: os Python
[3] Python Library Reference: tempfile Python
[4] Symlink race WikiPedia
[5] Time of check to time of use WikiPedia
[6] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[7] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2.0
[8] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 2
[9] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[10] Standards Mapping - CIS Kubernetes Benchmark partial
[11] Standards Mapping - Common Weakness Enumeration CWE ID 377
[12] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001090
[13] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[14] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-4 Information in Shared Resources (P1)
[15] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-4 Information in Shared System Resources
[16] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 3.3.1, Requirement 3.5.1
[17] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002380 CAT II
[18] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002380 CAT II
[19] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002380 CAT II
[20] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002380 CAT II
[21] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002380 CAT II
[22] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002380 CAT II
[23] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002380 CAT II
[24] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002380 CAT II
[25] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002380 CAT II
[26] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002380 CAT II
[27] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002380 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002380 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002380 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002380 CAT II
desc.semantic.python.insecure_temporary_file
Abstract
该方法设置了一个永远都不会过期的会话。
Explanation
会话持续时间越长,攻击者危害用户帐户的机会就越大。当会话处于活动状态时,攻击者可能会强力攻击用户的密码、破解用户的无线加密密钥或者通过打开的浏览器强占会话。如果创建大量的会话,较长的会话超时时间还会阻止系统释放内存,并最终导致 denial of service。

例 1: 以下示例中的代码为实现最长不活动时间间隔而设置了负值,以使会话保持无限期的活动状态。

...
HttpSession sesssion = request.getSession(true);
sesssion.setMaxInactiveInterval(-1);
...
References
[1] Standards Mapping - CIS Azure Kubernetes Service Benchmark 2.0
[2] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5.0
[3] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[4] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[5] Standards Mapping - CIS Kubernetes Benchmark partial
[6] Standards Mapping - Common Weakness Enumeration CWE ID 613
[7] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-000879, CCI-002361
[8] Standards Mapping - FIPS200 IA
[9] Standards Mapping - NIST Special Publication 800-53 Revision 4 AC-12 Session Termination (P2), MA-4 Nonlocal Maintenance (P2)
[10] Standards Mapping - NIST Special Publication 800-53 Revision 5 AC-12 Session Termination
[11] Standards Mapping - OWASP Top 10 2004 A3 Broken Authentication and Session Management
[12] Standards Mapping - OWASP Top 10 2007 A7 Broken Authentication and Session Management
[13] Standards Mapping - OWASP Top 10 2010 A3 Broken Authentication and Session Management
[14] Standards Mapping - OWASP Top 10 2013 A2 Broken Authentication and Session Management
[15] Standards Mapping - OWASP Top 10 2017 A2 Broken Authentication
[16] Standards Mapping - OWASP Top 10 2021 A07 Identification and Authentication Failures
[17] Standards Mapping - OWASP Application Security Verification Standard 4.0 2.8.1 Single or Multi Factor One Time Verifier Requirements (L1 L2 L3), 2.8.6 Single or Multi Factor One Time Verifier Requirements (L2 L3), 3.3.1 Session Logout and Timeout Requirements (L1 L2 L3), 3.3.2 Session Logout and Timeout Requirements (L1 L2 L3), 3.3.4 Session Logout and Timeout Requirements (L2 L3), 3.6.1 Re-authentication from a Federation or Assertion (L3), 3.6.2 Re-authentication from a Federation or Assertion (L3)
[18] Standards Mapping - OWASP Mobile 2014 M9 Improper Session Handling
[19] Standards Mapping - OWASP Mobile 2024 M3 Insecure Authentication/Authorization
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.3, Requirement 8.5.15
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.5.7, Requirement 8.5.15
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.8, Requirement 8.5.15
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.10, Requirement 8.1.8
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.10, Requirement 8.1.8
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.10, Requirement 8.1.8
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.10, Requirement 8.1.8
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4, Requirement 8.2.8
[28] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection, Control Objective 5.3 - Authentication and Access Control
[29] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective 5.3 - Authentication and Access Control
[30] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective 5.3 - Authentication and Access Control, Control Objective C.2.1.2 - Web Software Access Controls, Control Objective C.2.3.2 - Web Software Access Controls
[31] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3415 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3415 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3415 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3415 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3415 CAT II
[36] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3415 CAT II
[37] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3415 CAT II
[38] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[39] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[40] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[41] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-000070 CAT II, APSC-DV-000080 CAT II, APSC-DV-001980 CAT II
[52] Standards Mapping - Web Application Security Consortium Version 2.00 Insufficient Session Expiration (WASC-47)
[53] Standards Mapping - Web Application Security Consortium 24 + 2 Insufficient Session Expiration
desc.structural.java.j2ee_bad_practices_insufficient_session_expiration
Abstract
Web 应用程序不应试图关闭自身的容器。
Explanation
让 Web 应用程序试图关闭自身的容器并不是什么好主意。调用终止方法的操作可能包含在遗忘调试代码中,或者包含在从非 J2EE 应用程序导入的代码中。
References
[1] ERR09-J. Do not allow untrusted code to terminate the JVM CERT
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 1.0
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 3
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - Common Weakness Enumeration CWE ID 382
[7] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001094
[8] Standards Mapping - NIST Special Publication 800-53 Revision 4 SC-5 Denial of Service Protection (P1)
[9] Standards Mapping - NIST Special Publication 800-53 Revision 5 SC-5 Denial of Service Protection
[10] Standards Mapping - OWASP Top 10 2004 A9 Application Denial of Service
[11] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.9
[12] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP6080 CAT II
[13] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP6080 CAT II
[14] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP6080 CAT II
[15] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP6080 CAT II
[16] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP6080 CAT II
[17] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP6080 CAT II
[18] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP6080 CAT II
[19] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002400 CAT II
[20] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002400 CAT II
[21] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002400 CAT II
[22] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002400 CAT II
[23] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002400 CAT II
[24] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002400 CAT II
[25] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002400 CAT II
[26] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002400 CAT II
[27] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002400 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002400 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002400 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002400 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002400 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002400 CAT II
[33] Standards Mapping - Web Application Security Consortium Version 2.00 Denial of Service (WASC-10)
[34] Standards Mapping - Web Application Security Consortium 24 + 2 Denial of Service
desc.semantic.java.j2ee_badpractices_jvm_termination
Abstract
把一个不可序列化的对象作为 HttpSession 属性来储存会破坏应用程序的可靠性。
Explanation
一个 J2EE 应用程序可以利用多个 JVM,以提高应用程序的可靠性和性能。为了在最终用户中将多个 JVM 显示为单个的应用程序,J2EE 容器可以在多个 JVM 之间复制 HttpSession 对象,所以当一个 JVM 不可用时,另一个 JVM 可以在不中断应用程序流程的情况下接替步骤的执行。

为了使会话复制能够正常运行,作为应用程序属性存储在会话中的数值必须实现 Serializable 接口。

例 1:下面这个类把自己添加到会话中,但由于它不是可序列化的,因此该会话就再也不能被复制了。


public class DataGlob {
String globName;
String globValue;

public void addToSession(HttpSession session) {
session.setAttribute("glob", this);
}
}
References
[1] The Java Servlet Specification Sun Microsystems
[2] The java.io.Serializable Interface Oracle
[3] MSC08-J. Do not store non-serializable objects as attributes in an HTTP session CERT
[4] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[5] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 4.1
[6] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 2
[7] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[8] Standards Mapping - Common Weakness Enumeration CWE ID 579
[9] Standards Mapping - OWASP Top 10 2004 A3 Broken Authentication and Session Management
[10] Standards Mapping - OWASP Top 10 2007 A7 Broken Authentication and Session Management
[11] Standards Mapping - OWASP Top 10 2010 A3 Broken Authentication and Session Management
[12] Standards Mapping - OWASP Top 10 2013 A2 Broken Authentication and Session Management
[13] Standards Mapping - OWASP Top 10 2017 A2 Broken Authentication
[14] Standards Mapping - OWASP Top 10 2021 A07 Identification and Authentication Failures
[15] Standards Mapping - OWASP Mobile 2014 M1 Weak Server Side Controls
[16] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.3
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.5.7
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.8
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.10
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.10
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.10
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.10
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[24] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection
[26] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection
desc.structural.java.j2ee_bad_practices_non_serializable_object_stored_in_session
Abstract
禁止在某些环境下使用 Web 应用程序中的线程管理,因为此时使用线程管理非常容易出错。
Explanation
J2EE 标准禁止在某些环境下使用 Web 应用程序中的线程管理,因为此时使用线程管理非常容易出错。线程管理起来很困难,并且可能还会以不可预知的方式干扰应用程序容器。即使容器没有受到干扰,线程管理通常还会导致各种难以发现的错误,如死锁、race condition 及其他同步错误等。
References
[1] Java 2 Platform Enterprise Edition Specification, v1.4 Sun Microsystems
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 3.0
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 5
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - Common Weakness Enumeration CWE ID 383
[7] Standards Mapping - OWASP API 2023 API8 Security Misconfiguration
desc.semantic.java.j2ee_badpractices_threads
Abstract
函数使用 block.timestampblock.number 作为代理的时间。
Explanation
block.timestampblock.number 关联的值通常由开发人员用于触发与时间相关的事件,但是,这些值通常给人以一种此类时间使用起来不太安全的感觉。

由于区块链的去中心化性质,节点只能在一定程度上同步时间。使用 block.timestamp 说的好听点是不可靠,在最坏的情况下,恶意矿工如果看到这样做的好处,则会改变其区块的时间戳。

至于 block.number,即使可以预测区块之间的时间(大约 14 秒),区块时间也不恒定,可能会随着网络活动而发生变化。这使得 block.number 对于与时间相关的计算来说变得不可靠。

示例 1:以下代码使用 block.number 在一定时间后解锁资金。


function withdraw() public {
require(users[msg.sender].amount > 0, 'no amount locked');
require(block.number >= users[msg.sender].unlockBlock, 'lock period not over');
uint amount = users[msg.sender].amount;
users[msg.sender].amount = 0;
(bool success, ) = msg.sender.call.value(amount)("");
require(success, 'transfer failed');
}
References
[1] Enterprise Ethereum Alliance Don't misuse block data
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 2.0
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2.0
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 3
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - Smart Contract Weakness Classification SWC-116
desc.structural.solidity.swc116
Abstract
所设置的回调可能导致争用条件。
Explanation
Node.js 允许开发人员将回调分配给 IO 阻止的事件。这样可提高性能,因为回调可异步运行,从而使主应用程序不会被 IO 阻止。但是,如果回调外部的某些内容依赖于先运行的回调内的代码,这反过来会造成争用条件。

示例 1:以下代码可基于数据库对用户进行身份验证。

 
...
var authenticated = true;
...
database_connect.query('SELECT * FROM users WHERE name == ? AND password = ? LIMIT 1', userNameFromUser, passwordFromUser, function(err, results){
if (!err && results.length > 0){
authenticated = true;
}else{
authenticated = false;
}
});

if (authenticated){
//do something privileged stuff
authenticatedActions();
}else{
sendUnathenticatedMessage();
}


在此示例中,我们应当调用到后端数据库,以确定用户用于登录的凭据,确认有效后,将变量设置为 true,否则设置为 false。令人遗憾的是,由于回调被 IO 阻止,它将异步运行且可能在检查 if (authenticated) 之后运行,由于默认值为 true,它将进入 if-statement,确认用户实际上是否已经过身份验证。
References
[1] Kristopher Kowal Documentation for q
[2] Piotr Pelczar Asynchronous programming done right.
[3] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[4] Standards Mapping - CIS Microsoft Azure Foundations Benchmark complete
[5] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2.0
[6] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[7] Standards Mapping - CIS Google Kubernetes Engine Benchmark integrity
[8] Standards Mapping - CIS Kubernetes Benchmark partial
[9] Standards Mapping - Common Weakness Enumeration CWE ID 362, CWE ID 367
[10] Standards Mapping - Common Weakness Enumeration Top 25 2022 [22] CWE ID 362
[11] Standards Mapping - Common Weakness Enumeration Top 25 2023 [21] CWE ID 362
[12] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-000366, CCI-003178
[13] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[14] Standards Mapping - NIST Special Publication 800-53 Revision 4 CM-6 Configuration Settings (P1)
[15] Standards Mapping - NIST Special Publication 800-53 Revision 5 CM-6 Configuration Settings
[16] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[17] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.11.2 Business Logic Architectural Requirements (L2 L3), 1.11.3 Business Logic Architectural Requirements (L3), 1.11.2 Business Logic Architectural Requirements (L2 L3), 1.11.3 Business Logic Architectural Requirements (L3), 11.1.6 Business Logic Security Requirements (L2 L3)
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.6
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.6
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.6
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.6
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[23] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[24] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[26] Standards Mapping - SANS Top 25 2009 Insecure Interaction - CWE ID 362
[27] Standards Mapping - SANS Top 25 2010 Insecure Interaction - CWE ID 362
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3630.1 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3630.1 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3630.1 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3630.1 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3630.1 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3630.1 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3630.1 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001995 CAT II
[36] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001995 CAT II
[37] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001995 CAT II
[38] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001995 CAT II
[39] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001995 CAT II
[40] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001995 CAT II
[41] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001995 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001995 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001995 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001995 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001995 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001995 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001995 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001995 CAT II
desc.structural.javascript.race_condition
Abstract
应用程序通过共享存储安装应用程序,使恶意应用程序可替换要安装的程序包。
Explanation
应用程序通过共享存储安装应用程序,任何具有外部存储读/写权限的应用程序都可写入到该存储。 由于存在争用情况,监控文件夹的恶意应用程序可将下载的 APK 文件交换为 APK 替换文件,安装进程会使用该替换文件取代合法更新。

示例 1: 以下代码可通过共享存储安装应用程序:


Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "app.apk")), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
References
[1] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[2] Standards Mapping - CIS Microsoft Azure Foundations Benchmark complete
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2.0
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark integrity
[6] Standards Mapping - CIS Kubernetes Benchmark partial
[7] Standards Mapping - Common Weakness Enumeration CWE ID 362, CWE ID 367
[8] Standards Mapping - Common Weakness Enumeration Top 25 2022 [22] CWE ID 362
[9] Standards Mapping - Common Weakness Enumeration Top 25 2023 [21] CWE ID 362
[10] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-000366, CCI-003178
[11] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[12] Standards Mapping - Motor Industry Software Reliability Association (MISRA) C Guidelines 2012 Rule 1.3
[13] Standards Mapping - NIST Special Publication 800-53 Revision 4 CM-6 Configuration Settings (P1)
[14] Standards Mapping - NIST Special Publication 800-53 Revision 5 CM-6 Configuration Settings
[15] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[16] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.11.2 Business Logic Architectural Requirements (L2 L3), 1.11.3 Business Logic Architectural Requirements (L3), 11.1.6 Business Logic Security Requirements (L2 L3)
[17] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-RESILIENCE-2
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.6
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.6
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.6
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.6
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[23] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[24] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[26] Standards Mapping - SANS Top 25 2009 Insecure Interaction - CWE ID 362
[27] Standards Mapping - SANS Top 25 2010 Insecure Interaction - CWE ID 362
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3630.1 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3630.1 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3630.1 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3630.1 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3630.1 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3630.1 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3630.1 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001995 CAT II
[36] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001995 CAT II
[37] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001995 CAT II
[38] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001995 CAT II
[39] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001995 CAT II
[40] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001995 CAT II
[41] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001995 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001995 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001995 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001995 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001995 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001995 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001995 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001995 CAT II
desc.dataflow.java.race_condition_app_download
Abstract
从检查到文件资源到使用文件的这段时间间隙,可以用来发动一次扩大权限的攻击。
Explanation
文件访问的 race condition(如已知的 time-of-check、time-of-use (TOCTOU) race condition)在以下情况中出现:

1. 程序检查某个文件的属性时,根据名称来引用文件。

2.程序稍后使用相同的文件名执行文件系统操作,并假定先前检查的属性没有改变。
示例 1:以下代码来自已安装 setuid root 的程序。该程序代表非特权用户执行某些文件操作,并使用访问检查来确保它不会使用其 root 权限执行当前用户不应该执行的操作。该程序使用 access() 系统调用来检查运行该程序的人员是否有权访问指定的文件,然后再打开该文件并执行必要的操作。


if (!access(file,W_OK)) {
f = fopen(file,"w+");
operate(f);
...
}
else {
fprintf(stderr,"Unable to open file %s.\n",file);
}


access() 的调用按照预期计划的那样执行,而且如果运行程序的用户具有编辑文件的必要权限,则会返回 0,反之则会返回 -1。然而,因为 access()fopen() 都是对文件名进行操作,而不是文件句柄,所以当 file 变量传递到 fopen() 时,就无法保证该变量仍能像传递到 access() 时那样引用磁盘上相同的文件。如果攻击者在调用 access() 之后,用指向其他文件的象征性链接来取代 file,程序就会使用根权限对文件进行操作,即便这个文件是攻击者在其他情况下无法进行更改的。通过欺骗程序去运行其他情况下不允许执行的操作,从而使攻击者获得更高的权限。

这种形式的漏洞不限于具有 root 权限的程序。如果应用程序能够执行本不允许攻击者执行的操作,那么有可能就会成为攻击目标。

此类攻击的漏洞窗口是测试属性和使用文件之间的时间段。即使在检查后立即使用,现代操作系统也不能保证进程挂起 CPU 之前执行的代码量。攻击者有多种技术来延长机会窗口的长度,以便更容易地利用漏洞。然而,即使窗口很小,漏洞利用尝试也可以简单地重复一遍又一遍,直到成功。

示例 2:以下代码将生成一个文件,然后更改该文件的所有者。


fd = creat(FILE, 0644); /* Create file */
if (fd == -1)
return;
if (chown(FILE, UID, -1) < 0) { /* Change file owner */
...
}


该代码假定通过调用 chown() 操作的文件与通过调用 creat() 创建的文件是一样的,但事实未必如此。因为 chown() 根据文件名而不是文件句柄操作,攻击者可以将该文件替换为指向不归他所有的文件的链接。调用 chown() 将给予攻击者链接文件的所有权。
References
[1] J. Viega, G. McGraw Building Secure Software Addison-Wesley
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark complete
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2.0
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark integrity
[7] Standards Mapping - CIS Kubernetes Benchmark partial
[8] Standards Mapping - Common Weakness Enumeration CWE ID 362, CWE ID 367
[9] Standards Mapping - Common Weakness Enumeration Top 25 2022 [22] CWE ID 362
[10] Standards Mapping - Common Weakness Enumeration Top 25 2023 [21] CWE ID 362
[11] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-000366, CCI-003178
[12] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[13] Standards Mapping - Motor Industry Software Reliability Association (MISRA) C Guidelines 2012 Rule 1.3
[14] Standards Mapping - NIST Special Publication 800-53 Revision 4 CM-5 Access Restrictions for Change (P1), CM-6 Configuration Settings (P1)
[15] Standards Mapping - NIST Special Publication 800-53 Revision 5 CM-5 Access Restrictions for Change, CM-6 Configuration Settings
[16] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[17] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.11.2 Business Logic Architectural Requirements (L2 L3), 1.11.3 Business Logic Architectural Requirements (L3), 11.1.6 Business Logic Security Requirements (L2 L3)
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.6
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.6
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.6
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.6
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[23] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[24] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[26] Standards Mapping - SANS Top 25 2009 Insecure Interaction - CWE ID 362
[27] Standards Mapping - SANS Top 25 2010 Insecure Interaction - CWE ID 362
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3630.1 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3630.1 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3630.1 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3630.1 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3630.1 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3630.1 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3630.1 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001995 CAT II
[36] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001995 CAT II
[37] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001995 CAT II
[38] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001995 CAT II
[39] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001995 CAT II
[40] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001995 CAT II
[41] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001995 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001995 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001995 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001995 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001995 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001995 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001995 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001410 CAT II, APSC-DV-001995 CAT II
desc.controlflow.cpp.file_access_race_condition
Abstract
可以利用检查文件属性和使用文件之间的时间窗口发起权限提升攻击。
Explanation
在以下情况下,将发生文件访问争用情况(称为检查时间、使用时间 (TOCTOU) 争用情况):

1.程序检查文件的属性,按名称引用文件。

2.程序稍后使用相同的文件名执行文件系统操作,并假定先前检查的属性没有改变。
示例:以下程序调用 CBL_CHECK_FILE_EXIST 例程在创建文件之前检查该文件是否存在,并执行所需的操作。


CALL "CBL_CHECK_FILE_EXIST" USING
filename
file-details
RETURNING status-code
END-CALL

IF status-code NOT = 0
MOVE 3 to access-mode
MOVE 0 to deny-mode
MOVE 0 to device

CALL "CBL_CREATE_FILE" USING
filename
access-mode
deny-mode
device
file-handle
RETURNING status-code
END-CALL
END-IF


CBL_CHECK_FILE_EXIST 的调用按预期正常运行并返回非零值,表明文件不存在。然而,由于 CBL_CHECK_FILE_EXISTCBL_CREATE_FILE 均作用于文件名而非文件句柄,因此无法保证 filename 变量仍然引用传递到 CBL_CREATE_FILE(当该变量传递到 CBL_CHECK_FILE_EXIST 时其引用的文件)时磁盘上的同一文件。如果攻击者在调用 CBL_CHECK_FILE_EXIST 后创建 filename,则对 CBL_CREATE_FILE 的调用将会失败,致使程序相信文件为空,而事实上该文件包含攻击者控制的数据。

此类攻击的漏洞窗口是测试属性和使用文件之间的时间段。即使在检查后立即使用,现代操作系统也不能保证进程挂起 CPU 之前执行的代码量。攻击者有多种技术来延长机会窗口的长度,以便更容易地利用漏洞。然而,即使窗口很小,漏洞利用尝试也可以简单地重复一遍又一遍,直到成功。

此外,这种类型的漏洞可能适用于具有 root 权限的程序,该程序可代表非特权用户执行某些文件操作,并使用访问检查来确保它不会使用其 root 权限执行不应被当前用户访问的操作。通过欺骗程序执行原本不允许的操作,攻击者可能会获得提升的权限。
References
[1] J. Viega, G. McGraw Building Secure Software Addison-Wesley
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[3] Standards Mapping - CIS Microsoft Azure Foundations Benchmark complete
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2.0
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark integrity
[7] Standards Mapping - CIS Kubernetes Benchmark partial
[8] Standards Mapping - Common Weakness Enumeration CWE ID 362, CWE ID 367
[9] Standards Mapping - Common Weakness Enumeration Top 25 2022 [22] CWE ID 362
[10] Standards Mapping - Common Weakness Enumeration Top 25 2023 [21] CWE ID 362
[11] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-000366, CCI-003178
[12] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[13] Standards Mapping - Motor Industry Software Reliability Association (MISRA) C Guidelines 2012 Rule 1.3
[14] Standards Mapping - NIST Special Publication 800-53 Revision 4 CM-5 Access Restrictions for Change (P1), CM-6 Configuration Settings (P1)
[15] Standards Mapping - NIST Special Publication 800-53 Revision 5 CM-5 Access Restrictions for Change, CM-6 Configuration Settings
[16] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[17] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.11.2 Business Logic Architectural Requirements (L2 L3), 1.11.3 Business Logic Architectural Requirements (L3), 11.1.6 Business Logic Security Requirements (L2 L3)
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.6
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.6
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.6
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.6
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[23] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[24] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[26] Standards Mapping - SANS Top 25 2009 Insecure Interaction - CWE ID 362
[27] Standards Mapping - SANS Top 25 2010 Insecure Interaction - CWE ID 362
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3630.1 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3630.1 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3630.1 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3630.1 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3630.1 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3630.1 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3630.1 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001995 CAT II
[36] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001995 CAT II
[37] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001995 CAT II
[38] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001995 CAT II
[39] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001995 CAT II
[40] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001995 CAT II
[41] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001995 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001995 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001995 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001995 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001995 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001995 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001995 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001410 CAT II, APSC-DV-001995 CAT II
desc.controlflow.cobol.file_access_race_condition
Abstract
java.text.Format 中的 parse()format() 方法包含一个可导致用户看到其他用户数据的设计缺陷。
Explanation
java.text.Format 中的 parse()format() 方法包含一个可导致用户看到其他用户数据的 race condition。

示例 1:以下代码显示了此设计缺陷是如何显现出来的。


public class Common {

private static SimpleDateFormat dateFormat;
...

public String format(Date date) {
return dateFormat.format(date);
}
...

final OtherClass dateFormatAccess=new OtherClass();
...

public void function_running_in_thread1(){
System.out.println("Time in thread 1 should be 12/31/69 4:00 PM, found: "+ dateFormatAccess.format(new Date(0)));
}

public void function_running_in_thread2(){
System.out.println("Time in thread 2 should be around 12/29/09 6:26 AM, found: "+ dateFormatAccess.format(new Date(System.currentTimeMillis())));
}
}


尽管此代码可在单一用户环境中正常运行,但如果两个线程同时运行此代码,则会生成以下输出内容:

Time in thread 1 should be 12/31/69 4:00 PM, found: 12/31/69 4:00 PM
Time in thread 2 should be around 12/29/09 6:26 AM, found: 12/31/69 4:00 PM

在这种情况下,第一个线程中的数据显示在了第二个线程的输出中,原因是实施的 format() 中存在 race condition。
References
[1] Bug 4228335 : SimpleDateFormat is not threadsafe Sun Microsystems
[2] The Java Servlet Specification Sun Microsystems
[3] Standards Mapping - CIS Azure Kubernetes Service Benchmark 2.0
[4] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5.0
[5] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 5
[6] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[7] Standards Mapping - CIS Kubernetes Benchmark partial
[8] Standards Mapping - Common Weakness Enumeration CWE ID 362, CWE ID 488
[9] Standards Mapping - Common Weakness Enumeration Top 25 2022 [22] CWE ID 362
[10] Standards Mapping - Common Weakness Enumeration Top 25 2023 [21] CWE ID 362
[11] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001090, CCI-003178
[12] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[13] Standards Mapping - NIST Special Publication 800-53 Revision 4 CM-6 Configuration Settings (P1), SC-4 Information in Shared Resources (P1)
[14] Standards Mapping - NIST Special Publication 800-53 Revision 5 CM-6 Configuration Settings, SC-4 Information in Shared System Resources
[15] Standards Mapping - OWASP Top 10 2007 A6 Information Leakage and Improper Error Handling
[16] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[17] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.11.2 Business Logic Architectural Requirements (L2 L3)
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.5.6
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.5
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4, Requirement 7.3.2
[21] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective B.3.3 - Terminal Software Attack Mitigation
[22] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective B.3.3 - Terminal Software Attack Mitigation
[23] Standards Mapping - SANS Top 25 2009 Insecure Interaction - CWE ID 362
[24] Standards Mapping - SANS Top 25 2010 Insecure Interaction - CWE ID 362
[25] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3630.1 CAT II
[26] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3630.1 CAT II
[27] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3630.1 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3630.1 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3630.1 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3630.1 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3630.1 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[36] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[37] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[38] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[39] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[40] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[41] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
desc.structural.java.race_condition_format_flaw
Abstract
开发人员正在使用 Windows.Storage.ApplicationData 类的 RoamingFolderRoamingSettings 属性。
Explanation
RoamingFolderRoamingSettings 属性可从漫游应用程序数据存储器中获取一个容器,然后可以使用此容器在两台以上的设备之间共享数据。如果写入和读取漫游应用程序数据存储器中存储的对象,开发人员会增加遭受危害的风险。通过此漫游应用程序数据存储器共享这些对象的数据、应用程序和系统的机密性、完整性和可用性都将受到影响。

如果预先没有实施必要的技术控制,开发人员应避免使用此功能。
References
[1] ApplicationData.RoamingFolder | roamingFolder property
[2] ApplicationData.RoamingSettings | roamingSettings property
[3] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[4] Standards Mapping - CIS Microsoft Azure Foundations Benchmark complete
[5] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 5.0
[6] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 5
[7] Standards Mapping - CIS Google Kubernetes Engine Benchmark integrity
[8] Standards Mapping - CIS Kubernetes Benchmark partial
[9] Standards Mapping - Common Weakness Enumeration CWE ID 362, CWE ID 367
[10] Standards Mapping - Common Weakness Enumeration Top 25 2022 [22] CWE ID 362
[11] Standards Mapping - Common Weakness Enumeration Top 25 2023 [21] CWE ID 362
[12] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-000366, CCI-003178
[13] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[14] Standards Mapping - NIST Special Publication 800-53 Revision 4 CM-6 Configuration Settings (P1)
[15] Standards Mapping - NIST Special Publication 800-53 Revision 5 CM-6 Configuration Settings
[16] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[17] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.11.2 Business Logic Architectural Requirements (L2 L3), 1.11.3 Business Logic Architectural Requirements (L3), 11.1.6 Business Logic Security Requirements (L2 L3)
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.6
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.6
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.6
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.6
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[23] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[24] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[26] Standards Mapping - SANS Top 25 2009 Insecure Interaction - CWE ID 362
[27] Standards Mapping - SANS Top 25 2010 Insecure Interaction - CWE ID 362
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3630.1 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3630.1 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3630.1 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3630.1 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3630.1 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3630.1 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3630.1 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001995 CAT II
[36] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001995 CAT II
[37] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001995 CAT II
[38] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001995 CAT II
[39] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001995 CAT II
[40] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001995 CAT II
[41] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001995 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001995 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001995 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001995 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001995 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001995 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001995 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001995 CAT II
desc.structural.dotnet.race_condition_roaming_data_access
Abstract
为多重信号安装相同的信号处理函数的话,当在短时间内连续收到不同的信号时,会导致 race condition。
Explanation
当安装作为信号处理函数的函数属于非可重入函数时,信号处理就会发生 race condition。非可重入函数会保留一些内部状态,或调用其他同样如此的函数。当安装同一函数去处理多重信号时,很有可能发生这种 race condition。

信号处理 race condition 很有可能在以下情况中出现:

1. 程序为多重信号仅安装一个信号处理函数。

2. 在短时间内,信号处理函数收到两种不同的信号,导致该信号处理函数中出现 race condition。

示例:以下代码为两个不同的信号仅安装了一个简单的、非折返信号处理函数。如果攻击者使信号在适当的时间内一起发送,信号处理函数就会遭受 double free 漏洞威胁。针对同一个值两次调用 free(),会导致 buffer overflow。当程序使用同一参数两次调用 free() 时,程序中的内存管理数据结构会遭到破坏。这种破坏会导致程序崩溃。有时在某些情况下,还会导致两次调用 malloc() 延迟,而返回相同的指针。如果 malloc() 两次都返回同一个值,稍候程序便会允许攻击者控制整个已经写入双倍分配内存的数据,从而使程序更加容易受到 buffer overflow 的攻击。


void sh(int dummy) {
...
free(global2);
free(global1);
...
}

int main(int argc,char* argv[]) {
...
signal(SIGHUP,sh);
signal(SIGTERM,sh);
...
}
References
[1] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[2] Standards Mapping - CIS Microsoft Azure Foundations Benchmark partial
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2.0
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 4
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark normal
[6] Standards Mapping - Common Weakness Enumeration CWE ID 362, CWE ID 364
[7] Standards Mapping - Common Weakness Enumeration Top 25 2022 [22] CWE ID 362
[8] Standards Mapping - Common Weakness Enumeration Top 25 2023 [21] CWE ID 362
[9] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-000366, CCI-003178
[10] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[11] Standards Mapping - Motor Industry Software Reliability Association (MISRA) C Guidelines 2012 Rule 21.5
[12] Standards Mapping - Motor Industry Software Reliability Association (MISRA) C++ Guidelines 2008 Rule 18-7-1
[13] Standards Mapping - NIST Special Publication 800-53 Revision 4 CM-6 Configuration Settings (P1)
[14] Standards Mapping - NIST Special Publication 800-53 Revision 5 CM-6 Configuration Settings
[15] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[16] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.11.2 Business Logic Architectural Requirements (L2 L3)
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.6
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.6
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.6
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.6
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[22] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[23] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[24] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[25] Standards Mapping - SANS Top 25 2009 Insecure Interaction - CWE ID 362
[26] Standards Mapping - SANS Top 25 2010 Insecure Interaction - CWE ID 362
[27] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3630.1 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3630.1 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3630.1 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3630.1 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3630.1 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3630.1 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3630.1 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001995 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001995 CAT II
[36] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001995 CAT II
[37] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001995 CAT II
[38] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001995 CAT II
[39] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001995 CAT II
[40] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001995 CAT II
[41] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001995 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001995 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001995 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001995 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001995 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001995 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001995 CAT II
desc.structural.cpp.race_condition_signal_handling
Abstract
Servlet 成员字段可能允许一个用户查看其他用户的数据。
Explanation
许多 Servlet 开发人员都不了解 Servlet 为单例模式。Servlet 只有一个实例,并通过使用和重复使用该单个实例来处理需要由不同线程同时处理的多个请求。

这种误解的共同后果是,开发者使用 Servlet 成员字段的这种方式会导致某个用户可能在无意中看到其他用户的数据。换言之,即把用户数据存储在 Servlet 成员字段中会引发数据访问的 race condition。

例 1:以下 Servlet 把请求参数值存储在成员字段中,然后将参数值返回给响应输出流。


public class GuestBook extends HttpServlet {

String name;

protected void doPost (HttpServletRequest req, HttpServletResponse res) {
name = req.getParameter("name");
...
out.println(name + ", thanks for visiting!");
}
}


当该代码在单一用户环境中正常运行时,如果有两个用户几乎同时访问 Servlet,可能会导致这两个请求以如下方式处理线程的插入:

线程 1: 将“Dick”分配给 name
线程 Jane”分配给 name
线程 1: print“Jane, thanks for visiting!
线程 2: print“Jane, thanks for visiting!

因此会向第一个用户显示第二个用户的用户名。
References
[1] The Java Servlet Specification Sun Microsystems
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 2.0
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 3.0
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 5
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[6] Standards Mapping - CIS Kubernetes Benchmark partial
[7] Standards Mapping - Common Weakness Enumeration CWE ID 362, CWE ID 488
[8] Standards Mapping - Common Weakness Enumeration Top 25 2022 [22] CWE ID 362
[9] Standards Mapping - Common Weakness Enumeration Top 25 2023 [21] CWE ID 362
[10] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001090, CCI-003178
[11] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[12] Standards Mapping - NIST Special Publication 800-53 Revision 4 CM-6 Configuration Settings (P1), SC-4 Information in Shared Resources (P1)
[13] Standards Mapping - NIST Special Publication 800-53 Revision 5 CM-6 Configuration Settings, SC-4 Information in Shared System Resources
[14] Standards Mapping - OWASP Top 10 2007 A6 Information Leakage and Improper Error Handling
[15] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[16] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.11.2 Business Logic Architectural Requirements (L2 L3)
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.5.6
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.5
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.6
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.6
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.6
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.6
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[24] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[26] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[27] Standards Mapping - SANS Top 25 2009 Insecure Interaction - CWE ID 362
[28] Standards Mapping - SANS Top 25 2010 Insecure Interaction - CWE ID 362
[29] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3630.1 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3630.1 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3630.1 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3630.1 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3630.1 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3630.1 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3630.1 CAT II
[36] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[37] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[38] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[39] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[40] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[41] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[50] Standards Mapping - Web Application Security Consortium Version 2.00 Information Leakage (WASC-13)
[51] Standards Mapping - Web Application Security Consortium 24 + 2 Information Leakage
desc.structural.java.singleton_member_field_race_condition
Abstract
存储在静态字段中的数据库连接会被不同的线程共享。
Explanation
对于与事务相关联的资源对象(比如数据库连接),一次只能与一个事务相关联。出于这个原因,一个连接不应该被多个线程共享,并且不应该存储在静态字段中。要获取更多详细信息,请参见 J2EE 规范中的第 4.2.3 节。

例 1:

public class ConnectionManager {

private static Connection conn = initDbConn();
...
}
References
[1] Java 2 Platform Enterprise Edition Specification, v1.4 Sun Microsystems
[2] Standards Mapping - CIS Azure Kubernetes Service Benchmark 1.0
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 3.1
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 1
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark confidentiality
[6] Standards Mapping - CIS Kubernetes Benchmark partial
[7] Standards Mapping - Common Weakness Enumeration CWE ID 362, CWE ID 567
[8] Standards Mapping - Common Weakness Enumeration Top 25 2022 [22] CWE ID 362
[9] Standards Mapping - Common Weakness Enumeration Top 25 2023 [21] CWE ID 362
[10] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001090, CCI-003178
[11] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[12] Standards Mapping - NIST Special Publication 800-53 Revision 4 CM-6 Configuration Settings (P1), SC-4 Information in Shared Resources (P1)
[13] Standards Mapping - NIST Special Publication 800-53 Revision 5 CM-6 Configuration Settings, SC-4 Information in Shared System Resources
[14] Standards Mapping - OWASP Top 10 2021 A04 Insecure Design
[15] Standards Mapping - OWASP Application Security Verification Standard 4.0 1.11.2 Business Logic Architectural Requirements (L2 L3)
[16] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.6
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.6
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.6
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.6
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[21] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[22] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[23] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.3 - Terminal Software Attack Mitigation
[24] Standards Mapping - SANS Top 25 2009 Insecure Interaction - CWE ID 362
[25] Standards Mapping - SANS Top 25 2010 Insecure Interaction - CWE ID 362
[26] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3630.1 CAT II
[27] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3630.1 CAT II
[28] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3630.1 CAT II
[29] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3630.1 CAT II
[30] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3630.1 CAT II
[31] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3630.1 CAT II
[32] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3630.1 CAT II
[33] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[34] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[35] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[36] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[37] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[38] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[39] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[40] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[41] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-001995 CAT II, APSC-DV-002380 CAT II
desc.structural.java.race.dbconn
Abstract
在未释放当前会话标识符的情况下验证用户会给攻击者窃取验证会话的机会。
Explanation
Session Fixation 漏洞会在以下情况中出现:

1.当 Web 应用程序验证某一用户时,没有首先释放当前会话,而是继续使用已经与该用户关联的会话。
2.攻击者能够夺取已知的用户会话标识符,因此,一旦该用户进行验证,攻击者便可以访问经过验证的会话。

在通常情况下,攻击者会利用 Session Fixation 漏洞在 Web 应用程序中创建一个新会话,并且记录与之关联的会话标识符。然后,攻击者会设法使受害者在服务器中的验证失败,从而通过当前会话来访问用户帐号。

Spring Security 等部分框架会在创建新会话时自动释放当前会话。若不采取此行为,应用程序将易遭受此类攻击。

示例 1:以下示例显示受 Spring Security 保护的应用程序的代码段,该应用程序中的会话固定保护已禁用。


<http auto-config="true">
...
<session-management session-fixation-protection="none"/>
</http>


即便是易受攻击的应用程序,此处描述的特定攻击是否成功仍取决于诸多对攻击者有利的因素:访问未受监控的公用终端;能够维持当前已遭受攻击的会话;受害者有兴趣通过公用终端登录易受攻击的应用程序。在多数情况下,只要肯花时间,前面两个因素是可以实现的。只要站点比较受欢迎,那么寻找一个既使用公用终端又有兴趣登录易受攻击的应用程序的受害者,也是可以实现的。站点越不受欢迎,感兴趣的受害者使用公用终端的几率就越低,上述攻击成功的可能性也就越小。

攻击者利用 Session Fixation 漏洞所面临的最大挑战是,诱导受害者使用攻击者已知的会话标识符向易受攻击的应用程序进行身份验证。在Example 1 中,攻击者使用直接明显的方法并不高明,对于攻击不太出名的网站并不适用。然而,千万不要麻痹大意,攻击者有许多手段可以帮助他们避免上述攻击的局限性。攻击者最常用的技术包括:利用目标站点中的 Cross-Site Scripting 或者 HTTP Response Splitting 漏洞 [1]。攻击者诱使受害者向易受攻击的应用程序提交恶意请求,应用程序将相应的 JavaScript 或者其他代码返回到受害者的浏览器,借助于这种方式,攻击者便可以创建一个 Cookie,使受害者重新使用已受攻击者控制的会话标识符。

值得注意的是,Cookie 常常会与某个已知 URL 所关联的顶级域绑定到一起。如果多个应用程序位于同一顶级域(如 bank.example.comrecipes.example.com),其中一个应用程序存在漏洞,则攻击者可以通过此漏洞设置一个 Cookie,并在其中包含一个已被修改的会话标识符,且该会话标识符可以在与 example.com [2] 域中所有应用程序的交互中使用。

其他攻击手段还包括 DNS Poisoning 和其他基于网络的攻击形式,攻击者通过重定向对有效站点的请求,诱使用户访问恶意站点。基于网络的攻击方式通常包括:现身于攻击对象的网络中或是控制网络中的目标主机。虽然通过远程的方式进行此种攻击要更难一些,但也不应当忽视。安全性较差的会话管理机制(例如在 Apache Tomcat 中默认实现),可以将通常存储在 Cookie 中的会话标识符也指定给 URL。这样,攻击者只要通过电子邮件发送一个恶意的 URL,就可以诱使受害者使用已被修改的会话标识符。
References
[1] Standards Mapping - CIS Azure Kubernetes Service Benchmark 2.0
[2] Standards Mapping - CIS Microsoft Azure Foundations Benchmark complete
[3] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2.0
[4] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 3
[5] Standards Mapping - CIS Google Kubernetes Engine Benchmark integrity
[6] Standards Mapping - CIS Kubernetes Benchmark partial
[7] Standards Mapping - Common Weakness Enumeration CWE ID 384
[8] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001664, CCI-001941, CCI-001942
[9] Standards Mapping - FIPS200 IA
[10] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[11] Standards Mapping - NIST Special Publication 800-53 Revision 4 AC-10 Concurrent Session Control (P3), IA-2 Identification and Authentication (Organizational Users) (P1), SC-23 Session Authenticity (P1)
[12] Standards Mapping - NIST Special Publication 800-53 Revision 5 AC-10 Concurrent Session Control, IA-2 Identification and Authentication (Organizational Users), SC-23 Session Authenticity
[13] Standards Mapping - OWASP Top 10 2004 A3 Broken Authentication and Session Management
[14] Standards Mapping - OWASP Top 10 2007 A7 Broken Authentication and Session Management
[15] Standards Mapping - OWASP Top 10 2010 A3 Broken Authentication and Session Management
[16] Standards Mapping - OWASP Top 10 2013 A2 Broken Authentication and Session Management
[17] Standards Mapping - OWASP Top 10 2017 A2 Broken Authentication
[18] Standards Mapping - OWASP Top 10 2021 A07 Identification and Authentication Failures
[19] Standards Mapping - OWASP API 2023 API2 Broken Authentication
[20] Standards Mapping - OWASP Application Security Verification Standard 4.0 3.2.1 Session Binding Requirements (L1 L2 L3), 3.2.3 Session Binding Requirements (L1 L2 L3), 3.3.1 Session Logout and Timeout Requirements (L1 L2 L3)
[21] Standards Mapping - OWASP Mobile 2014 M9 Improper Session Handling
[22] Standards Mapping - OWASP Mobile 2024 M3 Insecure Authentication/Authorization
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.3
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.5.7
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.8
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.10
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.10
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.10
[29] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.10
[30] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[31] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[32] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection
[33] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection
[34] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3405 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3405 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3405 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3405 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3405 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3405 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3405 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[42] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[43] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-000010 CAT II, APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[55] Standards Mapping - Web Application Security Consortium Version 2.00 Session Fixation (WASC-37)
[56] Standards Mapping - Web Application Security Consortium 24 + 2 Session Fixation
desc.config.java.session_fixation
Abstract
在未释放当前会话标识符的情况下验证用户会给攻击者窃取验证会话的机会。
Explanation
Session Fixation 漏洞会在以下情况中出现:

1.当 Web 应用程序验证某一用户时,没有首先释放当前会话,而是继续使用已经与该用户关联的会话。

2.攻击者能够夺取已知的用户会话标识符,因此,一旦该用户进行验证,攻击者便可以访问经过验证的会话。

在通常情况下,攻击者会利用 Session Fixation 漏洞在 Web 应用程序中创建一个新会话,并且记录与之关联的会话标识符。然后,攻击者会设法使受害者在服务器中的验证失败,从而通过当前会话来访问用户帐号。

示例 1:以下代码将对会话 Cookie 禁用 use_strict_mode 属性。

ini_set("session.use_strict_mode", "0");
References
[1] D. Whalen The Unofficial Cookie FAQ
[2] The PHP Group PHP Use Strict Mode Documentation
[3] Standards Mapping - CIS Azure Kubernetes Service Benchmark 2.0
[4] Standards Mapping - CIS Microsoft Azure Foundations Benchmark complete
[5] Standards Mapping - CIS Amazon Elastic Kubernetes Service Benchmark 2.0
[6] Standards Mapping - CIS Amazon Web Services Foundations Benchmark 3
[7] Standards Mapping - CIS Google Kubernetes Engine Benchmark integrity
[8] Standards Mapping - CIS Kubernetes Benchmark partial
[9] Standards Mapping - Common Weakness Enumeration CWE ID 384
[10] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-001664, CCI-001941, CCI-001942
[11] Standards Mapping - FIPS200 IA
[12] Standards Mapping - General Data Protection Regulation (GDPR) Access Violation
[13] Standards Mapping - NIST Special Publication 800-53 Revision 4 AC-10 Concurrent Session Control (P3), IA-2 Identification and Authentication (Organizational Users) (P1), SC-23 Session Authenticity (P1)
[14] Standards Mapping - NIST Special Publication 800-53 Revision 5 AC-10 Concurrent Session Control, IA-2 Identification and Authentication (Organizational Users), SC-23 Session Authenticity
[15] Standards Mapping - OWASP Top 10 2004 A3 Broken Authentication and Session Management
[16] Standards Mapping - OWASP Top 10 2007 A7 Broken Authentication and Session Management
[17] Standards Mapping - OWASP Top 10 2010 A3 Broken Authentication and Session Management
[18] Standards Mapping - OWASP Top 10 2013 A2 Broken Authentication and Session Management
[19] Standards Mapping - OWASP Top 10 2017 A2 Broken Authentication
[20] Standards Mapping - OWASP Top 10 2021 A07 Identification and Authentication Failures
[21] Standards Mapping - OWASP API 2023 API2 Broken Authentication
[22] Standards Mapping - OWASP Application Security Verification Standard 4.0 3.2.1 Session Binding Requirements (L1 L2 L3), 3.2.3 Session Binding Requirements (L1 L2 L3), 3.3.1 Session Logout and Timeout Requirements (L1 L2 L3)
[23] Standards Mapping - OWASP Mobile 2014 M9 Improper Session Handling
[24] Standards Mapping - OWASP Mobile 2024 M3 Insecure Authentication/Authorization
[25] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.3
[26] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.5.7
[27] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.8
[28] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.10
[29] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.10
[30] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.10
[31] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.10
[32] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[33] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[34] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection
[35] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection
[36] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3405 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3405 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3405 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3405 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3405 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3405 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3405 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[44] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[45] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[46] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[47] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[48] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[49] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[50] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[51] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[52] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[53] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[54] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[55] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[56] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-000010 CAT II, APSC-DV-001620 CAT II, APSC-DV-001630 CAT II, APSC-DV-002250 CAT II, APSC-DV-002260 CAT II, APSC-DV-002270 CAT II, APSC-DV-002280 CAT II
[57] Standards Mapping - Web Application Security Consortium Version 2.00 Session Fixation (WASC-37)
[58] Standards Mapping - Web Application Security Consortium 24 + 2 Session Fixation
desc.structural.php.session_fixation