Stack Frame Randomization for Code Injection Defense
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Stack-based code injection attacks, particularly buffer overflow attacks, pose a significant security risk in computer systems as attackers can exploit the predictable layout of local variables on the stack to gain control, with modern operating systems' address space layout randomization (ASLR) providing limited protection that can be deactivated.
Innovation Solution
Randomizing the order of local function variables on the stack by identifying and shuffling their locations, which can occur during the build process, at application load, or during execution, to create uncertainty for attackers attempting to craft an attack payload.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If the layout of local variables on the stack is kept predictable (controlled by compiler), then ease of operation is improved, but security deteriorates as attackers can easily determine buffer locations and craft attack payloads
Solution Approach 1:
The patent applies dynamics by making the stack layout changeable rather than fixed. It introduces runtime randomization that shuffles the order of local variables on the stack, so the layout is different each time the program executes. This dynamic transformation prevents attackers from predicting buffer locations while maintaining normal program functionality through frame pointer references
Solution Approach 2:
The patent changes the parameter of stack layout configuration from static (compiler-determined fixed order) to dynamic (runtime-randomized order). By modifying the arrangement parameter of variables on the stack at runtime, it creates unpredictability for attackers while preserving program correctness through proper frame pointer management
2Object-affected harmful factors
If Address Space Layout Randomization (ASLR) is enabled at the operating system level, then security is improved, but adaptability deteriorates as it can be deactivated via OS settings or compatibility requirements
Solution Approach 1:
The patent segments the security mechanism from the operating system level to the application level. Instead of relying on OS-wide ASLR that affects all processes, it implements stack layout randomization specifically within the application's own stack frames. This segmentation allows the security feature to be applied selectively without requiring OS changes or affecting system-wide compatibility
Solution Approach 2:
The patent makes the application self-protecting by implementing its own stack randomization mechanism independent of OS support. The application randomizes its own stack layout at runtime without needing OS assistance, making it self-sufficient and compatible with any OS configuration including legacy systems where ASLR cannot be enabled
3Ease of operation
If the distance between return address and attackable buffer is fixed, then ease of operation is improved for legitimate code, but security deteriorates as attackers can calculate precise offsets for payload injection
Solution Approach 1:
The patent makes the distance between return address and buffer dynamic by randomizing variable order on the stack. Each execution can have a different arrangement of local variables, making the offset unpredictable. The program maintains ease of operation by using frame pointer-relative addressing that automatically adapts to the randomized layout
Data Source
AI summary
A method of randomizing locations of variables in a stack includes: identifying a plurality of stack locations corresponding to a plurality of variables; shuffling the stack locations of the variables to produce shuffled stack locations; and updating the stack locations of the variables with the shuffled stack locations.


