ControlFlowIntegrity PDF
ControlFlowIntegrity PDF
Outline
❏ Stack Corruption Techniques
❏ Future Directions
Program Execution (Expected Behaviour)
❏ Each node represents function
in the program
3. Code injection
4. Buffer overflow
5. Return-to-libc
1. StackGuard: Canary
4. PointGuard
What is CFI?
❏ CFI is a mitigation technique, which enforces a program to follow pre-defined
path of execution
❏ Code injection
❏ Buffer overflow
❏ Return-to-libc
❏ Malicious user
Existing CFI Techniques
1. CFI (Control Flow Integrity) with Label Checking
❏ Call ID DST
❏ ret ID
1. CFI with Label Checking
❏ It uses labels (unique
number)
❏ Function calls and return calls are directed through the Springboard
2. CCFIR
2. Drawbacks
❏ Compatibility issue:
call from protected
to unprotected
module fails
❏ Rewriting every
module is not
possible all the time
3. CCFI
❏ Cryptographically-enforced Control Flow Integrity
❏ It protects function pointer and return address with the help of Message
Authentication Code (MAC)
❏ K is a secret key
❏ This technique is used to check correct control-flow between two nodes, i.e.,
between source (caller) and destination (callee)
4. CFCSS
4. CFCSS
❏ Signature difference (d) is XOR
signature of source and destination
nodes. It is calculated at compile time
❏ V5 is branch-in-fan node
Drawbacks of Existing CFI Techniques
❏ We propose our CFI technique which ensures control flow integrity for any
program for which the source code is available
Our CFI Implementation
Regular Expression:
main.(Division.Display | Addition)
1. main->Division->Display
2. main->Addition
Deriving Regular Expression of CFG
Regular Expression:
main.(Division.Display | Addition)
main->Addition->Display
Checking for CFI Violation
❏ Execution path which does not satisfy regular expression is invalid path of control-flow
2. Function instrumentation:
❏ Our CFI implementation ensures that with help of regular expressions and by
checking integrity of return address, control flow integrity of program can be
maintained
1. Mauro Conti, Stephen Crane, Lucas Davi, Michael Franz, Per Larsen, Marco Negro, Christopher
Liebchen, Mohaned Qunaibit, Ahmad-Reza Sadeghi. Losing Control: On the Effectiveness of Control-
Flow Integrity under Stack Attacks. In Proceedings of the 22nd ACM SIGSAC Conference on Computer
and Communications SecuRity, 2015.
1. Tyler Bletsch, Xuxian Jiang, Vince Freeh. Mitigating Code-Reuse Attacks with Control-Flow Locking. In
Proceedings of the 27th Annual Computer Security Applications Conference, 2011.
1. Mark M. Seege. Using Control-Flow Techniques in a Security Context: A Survey on Common Prototypes
and Their Common Weakness. In Proceedings of the 2011 International Conference on Network
Computing and Information Security, 2011.
References
1. Ali Jose Mashtizadeh, Andrea Bittau, David Mazieres, Dan Boneh. Cryptographically Enforced Control
Flow Integrity. In proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications
Security, CCS, 2015.
1. Chao Zhang, Tao Wei, Zhaofeng Chen, Lei Duan, Laszlo Szekeres, Stephen McCamant, Dawn Song,
Wei Zou. Practical Control Flow Integrity and Randomization for Binary Executables. In proceeding SP
13 Proceedings of the 2013 IEEE Symposium on Security and Privacy, 2013.
1. Sibel Toprak. Intraprocedural Control Flow Visualization based on Regular Expressions. Hamburg
University of Technology (TUHH), 17 Jan 2014.
References
1. Hardware is the new software https://www.microsoft.com/en-us/research/wp-
content/uploads/2017/05/baumann-hotos17.pdf
1. Function Instrumentation
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
1. egypt tool
https://www.gson.org/egypt/
1. Return-to-libc
https://en.wikipedia.org/wiki/Return-to-libc_attack