Patent attributes
Present disclosure provides the system and method for protecting the control-flow of a computer program against manipulation and leak of code pointers during program execution. The system includes a memory that a computer program is loaded onto and a processor which executes the computer program for protecting the control-flow of a program against manipulation and leak of code pointers during program execution. The method includes providing a shadow stack for each process and thread of the computer program in a thread local storage (TLS). Each code pointer is encrypted with the corresponding encryption key, the pair with a global key is encrypted, and reencryption of the code pointer at runtime is performed. The performing the reencryption of the code pointer includes renewing the corresponding encryption key in the shadow stack, and renewing the encryption state of the code pointer with a renewed encryption key when the computer program enters a code region vulnerable to a memory corruption or leak attack, such that one or more renewed encryption keys govern one or more corresponding code pointers through encryption while changing before the control-flow proceeds into the vulnerable region.