Towards Practical Security Optimizations for Binaries
Summary: A Trail of Bits post describes a Georgia Tech study that analyzed over 1,000 variants of 20 programs compiled with GCC and clang and found that compiler optimizations increased gadget set size, utility, or composability in approximately 85% of cases. The most impactful behaviors were duplicating indirect branch instructions, as with GCC's omit frame pointer optimization, and code layout changes that encode indirect branch bytes into jump displacements, producing unintended gadgets.
Bottom line: Attackers using return- and jump-oriented programming reuse a vulnerable program's own code, so defenses against injected code will not stop the exploit; the study's authors built five Egalito binary recompiler passes to remove compiler-introduced gadgets without sacrificing performance.
Read the original at Trail of Bits Blog ↗