130 likes | 258 Views
Bending Binary Programs to your Will Rajeev Barua. What is a Binary Rewriter. Traditionally. Recently. High-level language program (C, C++, Java, SQL,……). Binary executable program. Compiler. Binary Rewriter. Binary executable program. Improved Binary executable program.
E N D
What is a Binary Rewriter Traditionally Recently High-level language program (C, C++, Java, SQL,……) Binary executable program Compiler Binary Rewriter Binary executable program Improved Binary executable program
Advantages of Binary Rewriting • Allows optimizations missed by compiler • Including inter-procedural optimization • Portable across any language • No need for repeated compiler implementation • Applicable to legacy codes and assembly level programs • Enhanced security of binaries
Flow of Binary Rewriter Flow of Compiler Fortran C, C++ llvm-gfortran Binary Reader llvm-gcc LLVM IR LLVM IR Code Improvement LLVM IR Machine Code Generator Layout Modifications
Existing Binary Rewriters SecondWrite Commercial Binary Program Symbolic & Relocation Information + Existing Binary Rewriter SecondWrite √ Rewritten Commercial Binary Program SecondWrite
Applications of Binary Rewriting • Improvement in Execution Speed • Automatic Parallelization • Better memory management • Improvement of security and reliability • Protection against malicious attacks • Access control
Security Policy Enforcement in Binaries Binary Reader Security Policy Library System Call Detector Code Improvement Security check inserter Code Generator Layout Modifications
Security Policy Enforcement + Input Binary Program Security Policy SecondWrite Output Binary Security Policy
Enforcing a Policy on a Malicious Binary Malicious binary that deletes files under the /c/important directory. Run binary Deletes files! (Binary runs under your permissions)
Enforcing a Policy on a Malicious Binary Malicious binary that deletes files under the /c/important directory. • Security policy for downloaded applications: • Cannot delete files • which the application • did not itself create + SecondWrite Malicious Binary Security Policy
Enforcing a Policy on a Malicious Binary Malicious Binary Run binary Kill application! Security Policy
Examples of Other Policies • Prevent network send after reading sensitive files • Impose quota on resource usage (e.g. heap memory)
Advantages of this Approach • Customizable: Security checks customizable to application, source, user and site. • Wide Scope: Completely enforce Confidentiality, Integrity, andAvailability (CIA triad) in a binary • Preventative: Ability to stop attacks before they succeed • Portable: Approach is independent of operating system and programming language