Stack Cookie Validation During Stack-Walk Overrun Detection
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current buffer overrun detection systems are inadequate in preventing stack corruption, particularly in multithreaded environments where race conditions can occur, and they fail to effectively check for stack corruption before critical operations like exception handling or garbage collection.
Innovation Solution
The solution involves dynamically accessing and comparing cookie location information to validate the integrity of stack data, ensuring that cookies are checked before use, and copying stack data to a separate memory location to prevent overwrite during validation, thereby reducing the likelihood of stack corruption.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a cookie is placed on the stack to detect buffer overrun, then stack corruption detection capability is improved, but the stack is vulnerable to corruption during multithreaded access and exception handling operations
Solution Approach 1:
The patent creates a duplicate copy of the cookie value and stores it in a separate location (such as a register or dedicated memory location) that is not part of the stack. This copy is then used for validation purposes, ensuring that even if the original stack cookie is corrupted during multithreaded operations, the system can still detect the corruption by comparing the stack cookie with its duplicate copy that resides in a protected location.
Solution Approach 2:
The patent introduces an intermediary validation mechanism that checks the integrity of stack data (including cookies) before allowing access during exception handling and garbage collection operations. This intermediary check acts as a mediator between the potentially corrupted stack data and the operations that need to access it, preventing propagation of corruption while maintaining system functionality.
2Device complexity
If cookie validation is performed only upon function return, then detection simplicity is maintained, but stack corruption can be exploited before the function returns
Solution Approach 1:
The patent performs preliminary validation of the cookie by creating and storing a duplicate copy of the cookie value before the function returns. This preliminary action ensures that the cookie's integrity is established and protected in advance, allowing the system to detect corruption even if exploitation attempts occur before the function returns and the traditional cookie check is performed.
3Measurement precision
If the first thread copies and validates the entire stack, then detection completeness is improved, but processing and memory resources are significantly consumed
Solution Approach 1:
The patent extracts only the critical element (the cookie value) from the stack and creates a duplicate copy of just this specific data element in a protected location. This selective extraction approach provides comprehensive protection for the integrity-checking mechanism without requiring copying and validation of the entire stack, thereby significantly reducing the processing and memory resources needed while maintaining detection completeness for buffer overrun vulnerabilities.
Data Source
AI summary
Example embodiments provide for effectively executing a stack-walk and other operations by dynamically accessing information about the expected location of cookies on a stack. For example, a first function is executed that causes a stack-walk operation to occur. While performing the stack-walk operation, cookie location information for a cookie placed on the stack by a second function different from the first function is accessed. The cookie, if uncorrupted, includes a known value that is used to determine if the stack has been corrupted. Based on the cookie location information, corrupt data representative of the cookie is accessed. A global cookie, which also includes the known value, is also accessed. The known value of the global cookie is then compared with the corrupt data to determine that the stack is corrupted at least up to the location of the corrupt data representative of the cookie.


