Binary Patching via Stack Frame Initialization
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Binaries with vulnerabilities, such as memory handling errors and buffer overflows, pose security risks and execution issues, particularly due to incomplete initialization of variables and buffer size issues, which existing methods struggle to address effectively.
Innovation Solution
A method that generates a patched binary by initializing the stack frame of vulnerable functions using a stack frame initialization function and verifying buffer sizes to prevent errors, involving the insertion of patch points and verification functions to ensure secure execution.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If existing patching methods are used on binaries with memory handling vulnerabilities, then the binary can be executed, but unexpected errors occur due to uninitialized variables and buffer overflows
Solution Approach 1:
The patent applies preliminary action by inserting a stack frame initialization function call before the vulnerable function executes. This initialization function sets all local variables to zero beforehand, preventing uninitialized variable errors. The patching process modifies the binary to include this preparatory initialization step, ensuring variables are properly initialized before use, thereby eliminating execution errors while maintaining reliable operation
2Reliability
If the binary is patched to initialize stack frames, then variable initialization errors are prevented, but the binary structure is modified requiring patch points insertion
Solution Approach 1:
The patent uses an intermediary approach by introducing a separate stack frame initialization function that acts as a mediator between the patching mechanism and the vulnerable function. This initialization function is inserted at specific patch points within the binary structure, serving as an intermediate layer that prepares the stack frame without fundamentally altering the original vulnerable function's logic. The intermediary function handles the complexity of stack frame management while keeping the original function intact
3Object-affected harmful factors
If buffer size verification is implemented, then buffer overflow errors are prevented, but additional verification functions must be called increasing execution overhead
Solution Approach 1:
The patent applies preliminary action by implementing buffer size verification before data copying operations occur. The verification function checks whether the input data size exceeds the buffer capacity beforehand, and only allows copying when the size is within acceptable limits. This preventive check is performed in advance of the actual data transfer, preventing buffer overflow errors while minimizing overhead by only executing verification when necessary
Data Source
AI summary
There is provided a method of patching a binary having vulnerability which is performed by a computing device. The method comprises loading a first binary to be patched, into a memory, generating a second binary by patching to call a stack frame initialization function from a vulnerable function of the first binary, executing the stack frame initialization function by calling the vulnerable function when the second binary is executed and initializing a stack frame area of the vulnerable function so as to automatically initialize a variable declared in the vulnerable function.


