In computer security, a shadow stack is a mechanism for protecting a procedure's stored return address,[1] such as from a stack buffer overflow or a Call Stack Spoofing. The shadow stack itself is a second, separate stack that "shadows" the program call stack. In the function prologue, a function stores its return address to both the call stack and the shadow stack. In the function epilogue, a function loads the return address from both the call stack and the shadow stack, and then compares them. If the two records of the return address differ, then an attack is detected; the typical course of action is simply to terminate the program or alert system administrators about a possible intrusion attempt. A shadow stack is similar to stack canaries in that both mechanisms aim to maintain the control-flow integrity of the protected program by detecting attacks that tamper the stored return address by an attacker during an exploitation attempt.

Shadow stacks can be implemented by recompiling programs with modified prologues and epilogues,[2] by dynamic binary rewriting techniques to achieve the same effect,[3] or with hardware support.[4] Unlike the call stack, which also stores local program variables, passed arguments, spilled registers and other data, the shadow stack typically just stores a second copy of a function's return address.

Shadow stacks provide more protection for return addresses than stack canaries, which rely on the secrecy of the canary value and are vulnerable to non-contiguous write attacks.[5] Shadow stacks themselves can be protected with guard pages[6] or with information hiding, such that an attacker would also need to locate the shadow stack to overwrite a return address stored there.

Like stack canaries, shadow stacks do not protect stack data other than return addresses, and so offer incomplete protection against security vulnerabilities that result from memory safety errors.

In 2016, Intel announced upcoming hardware support for shadow stacks with their Control-flow Enforcement Technology.[7]

Shadow stacks face some compatibility problems. After a program throws an exception or a longjmp occurs, the return address at the top of the shadow stack will not match return address popped from the call stack. The typical solution for this problem is to pop entries from the shadow stack until a matching return address is found, and to only terminate the program when no match is found in the shadow stack.[3]

A multithreaded program, which would have a call stack for each executing thread, would then also have a shadow stack shadowing each of the call stacks.

See also

edit

References

edit
  1. ^ Delshadtehrani, Leila; Eldridge, Schuyler; Canakci, Sadullah; Egele, Manuel; Joshi, Ajay (2018-01-01). "Nile: A Programmable Monitoring Coprocessor". IEEE Computer Architecture Letters. 17 (1): 92–95. doi:10.1109/LCA.2017.2784416. ISSN 1556-6056.
  2. ^ "StackShield: A "stack smashing" technique protection tool for Linux". Vendicator.
  3. ^ a b Sinnadurai, Saravanan; Zhao, Qin; Wong, Weng Fai (2008). "Transparent runtime shadow stack: Protection against malicious return address modifications" (PDF).
  4. ^ Ozdoganoglu, H.; Brodley, C.; Vijaykumar, T.; Kuperman, B. (2006). "SmashGuard: A Hardware Solution To Prevent Attacks on the Function Return Address" (PDF). IEEE Transactions on Computers. 55 (10): 1271–1285. doi:10.1109/TC.2006.166.
  5. ^ Szekeres, Laszlo; Payer, Mathias; Wei, Tao; Song, Dawn (2003). "SoK: Eternal War in Memory" (PDF). IEEE Symposium on Security and Privacy: 48–63.
  6. ^ Chieuh, Tzi-cker; Hsu, Fu-Hau (2001). "RAD: A Compile-Time Solution To Buffer Overflow Attacks". Proceedings 21st International Conference on Distributed Computing Systems. pp. 409–417. doi:10.1109/ICDSC.2001.918971. ISBN 0-7695-1077-9. S2CID 32026510.
  7. ^ "Control-flow Enforcement Technology Preview" (PDF). Intel Corporation.

📚 Artikel Terkait di Wikipedia

List of x86 instructions

a shadow stack (CET_SS), and indirect branch tracking (CET_IBT). The RDSSPD and RDSSPQ instructions act as NOPs on processors where shadow stacks are

Task state segment

state I/O port permissions Inner-privilege level stack pointers Previous TSS link Debug state Shadow stack pointer All this information should be stored

Control-flow integrity

integrity with a shadow stack (SS) and indirect branch tracking (IBT). The kernel must map a region of memory for the shadow stack not writable to user

CPUID

table 25-14 on page 3958 and section 26.4.3 on page 3984. Intel, Complex Shadow-Stack Updates (Intel Control-Flow Enforcement Technology), order no. 356628-001

Sigreturn-oriented programming

relying on address space layout randomization, canaries and cookies, or shadow stacks. Address space layout randomization makes it harder to use suitable

IPv6

bypassing it. Shadow networks have occurred on business networks in which enterprises are replacing Windows XP systems that do not have an IPv6 stack enabled

Sapphire Rapids

software without kernel involvement. Indirect branch tracking and CET shadow stack. In-Field Scan (IFS), a technology that allows for testing the processor

Code sanitizer

uses Armv8.5-A features for very low overhead ShadowCallStack, an AArch64 tool that provides a shadow stack protection Scudo Hardened Allocator, an alternative