SlideShare a Scribd company logo
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
Linux Binary Analysis and Exploitation
Dharma Ganesan, Mikael Lindvall
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
2
Context of the slides
 Gave a presentation: NASA Coding Summit
 Held at NASA’s IV&V Center
 NASA systems & context are removed in these slides
 Too sensitive for public release
 Increases the risk of attacks on those systems
 Slides meant to be a teaser on this topic
 Many low-level nitty-gritty details are left-out
 Time-restriction (only 30 min. original talk)
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
3
Keywords (used in our exploit)
 Return-Oriented Programming
 Address Space Randomization (ASLR)
 Non-Executable Stack (NX)
 Attacking a Global Offset Table (GOT)
 Stealing Remote Libc
 Stealing Stack Canary
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
4
Attack Scenarios and Our Scope
 Scenario 1: Open-source software
 E.g. Linux, Apache Web-server, etc.
 Scenario 2: Open-binary but closed source
 E.g. Most commercial products
 Scenario 3: Closed-binary and closed source
 E.g. Remote services
 Scope of this talk: Scenario 2 (remote exploit)
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
5
Questions
 Many modern operating systems (OS) have
built-in security features
 more on this later
 Is it possible to circumvent these security
features and take over a remote machine?
 Do we still have to do secure coding even
though OS has security features?
 Let’s investigate these questions for Linux
 Although highly relevant for other Oses!
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
6
Modern OS security features
(samples)
 Address Space Layout Randomization
(ASLR)
 Non-Executable Stack (NX)
 Stack Canary
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
7
ASLR feature for security
 Historically, memory addresses of variables and functions
did not change between runs
 Allows hackers to perform remote code execution easily
 Address space layout randomization (ASLR) randomizes
many items:
 Address of variables differ between runs
 (e.g. buffer addresses are difficult to predict for hackers)
 Address of shared-libraries/dlls differ between runs
 (e.g. address of library functions difficult for hackers to predict)
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
8
Non-Executable stack (NX) for
security
 Historically, hackers send exploits using the
user input buffer
 Modify the control the flow by redirecting the
control to the buffer
 Non-executable stack (NX) will not allow
code execution on stack
 If a hacker stores his exploit (e.g. virus) on a
stack, OS will not run that code
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
9
Stack Canary for security
 Historically, when hackers overflow a buffer and
modify the control flow, the OS was not aware of
this hacking event
 Stack canary (a random key) can detect this issue
 The random key generated by the runtime linker is
inserted into the stack to maintain control flow
integrity
 One cannot override the return addresses, stored on
the stack, without guessing the canary!
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
10
Questions
 Many modern operating systems (OS) have
built-in security features
 more on this later
 Is it possible to circumvent these security
features and take over a remote machine?
 Do we still have to do secure coding even
though OS has security features?
 Let’s investigate these questions for Linux
 Although highly relevant for other Oses!
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
11
High-level procedure for
analysis of binary
 Assumption: Remote service binary is available to the hacker
 but the environment is not
 Step 1: Data gathering about the target binary
 Step 2: Analyze binary for vulnerable library functions, signatures
 Step 3: Reachability analysis of vulnerable library functions
 Step 4: Memory layout analysis of the binary and remote machine
 Step 5: Stealing the remote’s Libc, the Stack Canary
 Step 6: Construct evil input that will take over the remote machine
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
12
Applying the procedure:
An example
 Context: This service is part of a capture-the-flag online
challenge (ringzero.com)
 About the remote service (base 64 decoder service):
 The remote service listens for input on a particular port
 It outputs base 64 decoding for the given input
 The binary of the remote service is available for
download
 But not the running environment such as libc libraries nor OS
 600 assembly instructions (x86-64)
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
13
Applying the procedure:
An example
 Challenge:
 Break into this remote service
 Perform remote code execution by exploiting
vulnerabilities in the binary
 Steal secrets (i.e. flag file) from the server by
reading the file system of the server
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
14
Step 1: Data gathering of the
remote service
 Tools: readelf and grep
 What is the OS, machine, and processor type of the remote service?
 dharma@ubuntu:~$ readelf -hn <binary>
 Data: 2's complement, little endian
 OS/ABI: UNIX - System V
 Machine: Advanced Micro Devices X86-64
 OS: Linux, ABI: 2.6.24
 Unfortunately, my OS version is different from the remote service
 But we will overcome this problem (discussed later)
 Is the stack executable?
 dharma@ubuntu:~/Downloads$ readelf -lW <binary>| grep GNU_STACK
 Output: GNU_STACK ... RW 0x10
 RW means the stack is read and write only but not executable
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
15
Step 1: Data gathering of the
remote service
 Is there a stack canary that will kick me out if I overflow any buffers?
 Tools used: objdump, grep
Dump of assembler code for function doprocessing:
0x0000000000400eaa <+318>: mov -0x8(%rbp),%rax
0x0000000000400eae <+322>: xor %fs:0x28,%rax
0x0000000000400eb7 <+331>: je 0x400ebe <doprocessing+338>
0x0000000000400eb9 <+333>: callq 0x400930 <__stack_chk_fail@plt>
 Stack canary is generated at runtime and stored in the fs register
 Unfortunately, there is a built-in stack integrity check
 stack_chk_fail will be called if I corrupt the stack
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
16
Step 2: Analyze the binary for
vulnerable library functions?
 Tools used: objdump and grep
 Which external functions are used?
 dharma@ubuntu:~$ objdump –R <binary>
 Output: List of library functions used by the binary
 Hunt for vulnerable functions pointed me to “fork”
 This function is not used properly (more on this later)
 No strcpy or gets usage (unlucky for the hacker)
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
17
Step 2: Analyze the binary for
vulnerable signatures?
 Is there a function in the given binary which takes two buffers as
inputs but without the length of each buffer as arguments?
 If yes, then the service may have memory safety issues
 It may be possible to overflow the buffer, modify control flow
 Searching for vulnerable signature often requires disassembly of
the binary in order to reconstruct signatures for each function
 Takes a lot of time and effort
 Found vulnerable signature: base64_decode(char*, char*);
 Disassembled function found no bounds checking of buffer sizes
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
18
Step 3: Reachability analysis
 How do reach the vulnerable signature?
 Answering this question requires
reconstructing the call graph from the binary
 For example, in the remote service
vulnerable function base64_decode is called
without bounds checking
 Great news for the hacker – stack-based
buffer overflow
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
19
Step 3: Reachability analysis:
Manually reversed C function from
binary (sample)
void doprocessing()
{
char base64Out[0x200];
char userInput[0x400];
bzero(base64Out, 0x200);
bzero(userInput, 0x400);
write(1, "Please enter your base 64 string: n", 0x23);
read(0, userInput, 0x400);
write(1, "Your message is:n", 0x11);
write(1, base64Out, base64_decode(userInput, base64Out));
/* base64_decode is not checking the decoded buffer size */
write(1, "nThank you for using ringzer0 base64 decoder!n", 0x2e);
}
• Base64_decode can corrupt the return address of doprocessing
• Remote code execution: If the base 64 decoded string exceeds the buffer size
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
20
Step 4: Memory layout analysis
 Finding the vulnerability is a small part of the puzzle
 Exploiting the vulnerability is the tricky part
 We need to understand the memory layout of the
remote service from its binary in order to do remote
code execution
 Is the address space layout randomization (ASLR)
turned on in the remote machine?
 Do answer this question: We need to find a way to
leak memory addresses from the remote machine
to our machine
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
21
Step 4: Leaking memory addresses
of the remote service
 Every Linux binary has a table called Global Offset Table (GOT)
 GOT contains pointers that will point to runtime addresses of library
functions
 Goal: Print the GOT entries of the remote service!
 We can modify the control flow of doProcessing function due to buffer
overflow
 We will overwrite the return address of doProcessing by the write
function address
 and pass a GOT entry address to appropriate registers (rsi register)
 This step is performed using Return-oriented programming (ROP)
 Running the remote service two times showed different addresses –
ASLR is ON – not easy to hack the remote server
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
22
Step 5: Stealing the remote’s Libc
 Libc is turning-complete – meaning we can construct
any algorithm from the fragments of libc
 Since the remote service is vulnerable to memory
errors, we are able to read arbitrary memory of the
remote service!
 This vulnerability allowed us to write a program that
secretly transfers the remote service’s libc binary
 This solved the problem that the remote server has a
different runtime versions of libc and GCC
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
23
Step 5: Stealing the stack canary
 The stack canary prevents remote code execution!
 Goal: Steal the stack canary by guessing 1 byte at a time
 Approach: A stack canary is 8 byte, require 8x256 guesses
 The binary has a fork-based vulnerability – a design flaw
 The parent remote service spawns a child task using the
fork syscall
 But, all child tasks inherit the same stack canary
 Thus, we wrote a program that will correctly guess the
stack canary in 8x256 attempts.
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
24
Step 6 – Constructing the evil input
that spawns a remote shell
 In our case, we want to spawn a remote shell
using the vulnerable remote service
 Using return-oriented programming (ROP) – a
hacking technique
 We wrote a program that constructs ROP
gadgets using the stolen libc
 We get a backdoor into the remote system!
 Please talk to me for more details!
 only 30 min talk
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
25
Conclusion
 Memory errors are very dangerous even if a remote
machine is running on a custom-built environment!
 Hackers can steal, reconstruct, exploit our environment
 Secure OS features are necessary but not sufficient
 We were able to defeat ASLR, NX, and Stack Canaries
 Secure coding is mandatory; OS cannot always protect us
if our coding is not secure
 One main security requirement: input validation
 Extensive off-nominal testing/verification is required!
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
26
Future work
 Our binary analysis is semi-manual
 More automation/research is needed for
binary reverse engineering
 Reachability analysis is effort intensive
 Generating a remote shell spawning evil input is the most
challenging part of exploit generation
 We have some ideas for how to do this!
© 2016 Fraunhofer USA, Inc.
Center for Experimental Software Engineering
Linux Binary Analysis and
Exploitation
Dharma Ganesan, Mikael Lindvall
Fraunhofer Center for Experimental Software Engineering
College Park, Maryland, USA
{dganesan, mlindvall}@fc-md.umd.edu
Ad

Recommended

Automated testing of NASA Software - part 2
Automated testing of NASA Software - part 2
Dharmalingam Ganesan
 
Secure application programming in the presence of side channel attacks
Secure application programming in the presence of side channel attacks
Dharmalingam Ganesan
 
Reverse Engineering of Software Architecture
Reverse Engineering of Software Architecture
Dharmalingam Ganesan
 
How to Connect SystemVerilog with Octave
How to Connect SystemVerilog with Octave
Amiq Consulting
 
System verilog important
System verilog important
elumalai7
 
Unit testing on embedded target with C++Test
Unit testing on embedded target with C++Test
Engineering Software Lab
 
Buffer overflow attacks
Buffer overflow attacks
Japneet Singh
 
System verilog control flow
System verilog control flow
Pushpa Yakkala
 
system verilog
system verilog
Vinchipsytm Vlsitraining
 
Return oriented programming
Return oriented programming
hybr1s
 
Jonathan bromley doulos
Jonathan bromley doulos
Obsidian Software
 
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
FPGA Central
 
Stack-Based Buffer Overflows
Stack-Based Buffer Overflows
Daniel Tumser
 
Dissertation Defense
Dissertation Defense
Sung Kim
 
Session 8 assertion_based_verification_and_interfaces
Session 8 assertion_based_verification_and_interfaces
Nirav Desai
 
KARMA: Adaptive Android Kernel Live Patching
KARMA: Adaptive Android Kernel Live Patching
Yue Chen
 
SANER 2015 ERA track: Differential Flame Graphs
SANER 2015 ERA track: Differential Flame Graphs
corpaulbezemer
 
Session 9 advance_verification_features
Session 9 advance_verification_features
Nirav Desai
 
Uvm presentation dac2011_final
Uvm presentation dac2011_final
sean chen
 
Buffer overflow explained
Buffer overflow explained
Teja Babu
 
System Verilog 2009 & 2012 enhancements
System Verilog 2009 & 2012 enhancements
Subash John
 
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
Amiq Consulting
 
Automated Traceability for Software Engineering Tasks
Automated Traceability for Software Engineering Tasks
Dharmalingam Ganesan
 
bh-europe-01-clowes
bh-europe-01-clowes
guest3e5046
 
Introduction to System verilog
Introduction to System verilog
Pushpa Yakkala
 
Requirements driven Model-based Testing
Requirements driven Model-based Testing
Dharmalingam Ganesan
 
Pinpointing Vulnerabilities (Ravel)
Pinpointing Vulnerabilities (Ravel)
Yue Chen
 
Finding Bugs Faster with Assertion Based Verification (ABV)
Finding Bugs Faster with Assertion Based Verification (ABV)
DVClub
 
Exploiting Cryptographic Misuse - An Example
Exploiting Cryptographic Misuse - An Example
Dharmalingam Ganesan
 
Model-based Testing of a Software Bus - Applied on Core Flight Executive
Model-based Testing of a Software Bus - Applied on Core Flight Executive
Dharmalingam Ganesan
 

More Related Content

What's hot (20)

system verilog
system verilog
Vinchipsytm Vlsitraining
 
Return oriented programming
Return oriented programming
hybr1s
 
Jonathan bromley doulos
Jonathan bromley doulos
Obsidian Software
 
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
FPGA Central
 
Stack-Based Buffer Overflows
Stack-Based Buffer Overflows
Daniel Tumser
 
Dissertation Defense
Dissertation Defense
Sung Kim
 
Session 8 assertion_based_verification_and_interfaces
Session 8 assertion_based_verification_and_interfaces
Nirav Desai
 
KARMA: Adaptive Android Kernel Live Patching
KARMA: Adaptive Android Kernel Live Patching
Yue Chen
 
SANER 2015 ERA track: Differential Flame Graphs
SANER 2015 ERA track: Differential Flame Graphs
corpaulbezemer
 
Session 9 advance_verification_features
Session 9 advance_verification_features
Nirav Desai
 
Uvm presentation dac2011_final
Uvm presentation dac2011_final
sean chen
 
Buffer overflow explained
Buffer overflow explained
Teja Babu
 
System Verilog 2009 & 2012 enhancements
System Verilog 2009 & 2012 enhancements
Subash John
 
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
Amiq Consulting
 
Automated Traceability for Software Engineering Tasks
Automated Traceability for Software Engineering Tasks
Dharmalingam Ganesan
 
bh-europe-01-clowes
bh-europe-01-clowes
guest3e5046
 
Introduction to System verilog
Introduction to System verilog
Pushpa Yakkala
 
Requirements driven Model-based Testing
Requirements driven Model-based Testing
Dharmalingam Ganesan
 
Pinpointing Vulnerabilities (Ravel)
Pinpointing Vulnerabilities (Ravel)
Yue Chen
 
Finding Bugs Faster with Assertion Based Verification (ABV)
Finding Bugs Faster with Assertion Based Verification (ABV)
DVClub
 
Return oriented programming
Return oriented programming
hybr1s
 
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
Upgrading to System Verilog for FPGA Designs, Srinivasan Venkataramanan, CVC
FPGA Central
 
Stack-Based Buffer Overflows
Stack-Based Buffer Overflows
Daniel Tumser
 
Dissertation Defense
Dissertation Defense
Sung Kim
 
Session 8 assertion_based_verification_and_interfaces
Session 8 assertion_based_verification_and_interfaces
Nirav Desai
 
KARMA: Adaptive Android Kernel Live Patching
KARMA: Adaptive Android Kernel Live Patching
Yue Chen
 
SANER 2015 ERA track: Differential Flame Graphs
SANER 2015 ERA track: Differential Flame Graphs
corpaulbezemer
 
Session 9 advance_verification_features
Session 9 advance_verification_features
Nirav Desai
 
Uvm presentation dac2011_final
Uvm presentation dac2011_final
sean chen
 
Buffer overflow explained
Buffer overflow explained
Teja Babu
 
System Verilog 2009 & 2012 enhancements
System Verilog 2009 & 2012 enhancements
Subash John
 
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
Amiq Consulting
 
Automated Traceability for Software Engineering Tasks
Automated Traceability for Software Engineering Tasks
Dharmalingam Ganesan
 
bh-europe-01-clowes
bh-europe-01-clowes
guest3e5046
 
Introduction to System verilog
Introduction to System verilog
Pushpa Yakkala
 
Requirements driven Model-based Testing
Requirements driven Model-based Testing
Dharmalingam Ganesan
 
Pinpointing Vulnerabilities (Ravel)
Pinpointing Vulnerabilities (Ravel)
Yue Chen
 
Finding Bugs Faster with Assertion Based Verification (ABV)
Finding Bugs Faster with Assertion Based Verification (ABV)
DVClub
 

Viewers also liked (20)

Exploiting Cryptographic Misuse - An Example
Exploiting Cryptographic Misuse - An Example
Dharmalingam Ganesan
 
Model-based Testing of a Software Bus - Applied on Core Flight Executive
Model-based Testing of a Software Bus - Applied on Core Flight Executive
Dharmalingam Ganesan
 
Threat Modeling: Applied on a Publish-Subscribe Architectural Style
Threat Modeling: Applied on a Publish-Subscribe Architectural Style
Dharmalingam Ganesan
 
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOAD
Dharmalingam Ganesan
 
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study
Dharmalingam Ganesan
 
Explaining my Phd Thesis to layman
Explaining my Phd Thesis to layman
Dharmalingam Ganesan
 
Interface-Implementation Contract Checking
Interface-Implementation Contract Checking
Dharmalingam Ganesan
 
Verifying Architectural Design Rules of a Flight Software Product Line
Verifying Architectural Design Rules of a Flight Software Product Line
Dharmalingam Ganesan
 
Testing of C software components using Models
Testing of C software components using Models
Dharmalingam Ganesan
 
Automated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from Models
Dharmalingam Ganesan
 
Ivv workshop model-based-testing-of-nasa-systems
Ivv workshop model-based-testing-of-nasa-systems
Dharmalingam Ganesan
 
Reverse Architecting of a Medical Device Software
Reverse Architecting of a Medical Device Software
Dharmalingam Ganesan
 
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
Dharmalingam Ganesan
 
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Anne Nicolas
 
Kernel Recipes 2016 - Would an ABI changes visualization tool be useful to Li...
Kernel Recipes 2016 - Would an ABI changes visualization tool be useful to Li...
Anne Nicolas
 
Introduction to spartakus and how it can help fight linux kernel ABI breakages
Introduction to spartakus and how it can help fight linux kernel ABI breakages
Samikshan Bairagya
 
Abi capabilities
Abi capabilities
ABI
 
Architecture Analysis of Systems based on Publish-Subscribe Systems
Architecture Analysis of Systems based on Publish-Subscribe Systems
Dharmalingam Ganesan
 
Automated Testing of NASA Software
Automated Testing of NASA Software
Dharmalingam Ganesan
 
Carbon Finance
Carbon Finance
Ajay Dhamija
 
Exploiting Cryptographic Misuse - An Example
Exploiting Cryptographic Misuse - An Example
Dharmalingam Ganesan
 
Model-based Testing of a Software Bus - Applied on Core Flight Executive
Model-based Testing of a Software Bus - Applied on Core Flight Executive
Dharmalingam Ganesan
 
Threat Modeling: Applied on a Publish-Subscribe Architectural Style
Threat Modeling: Applied on a Publish-Subscribe Architectural Style
Dharmalingam Ganesan
 
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOAD
Dharmalingam Ganesan
 
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study
Dharmalingam Ganesan
 
Explaining my Phd Thesis to layman
Explaining my Phd Thesis to layman
Dharmalingam Ganesan
 
Interface-Implementation Contract Checking
Interface-Implementation Contract Checking
Dharmalingam Ganesan
 
Verifying Architectural Design Rules of a Flight Software Product Line
Verifying Architectural Design Rules of a Flight Software Product Line
Dharmalingam Ganesan
 
Testing of C software components using Models
Testing of C software components using Models
Dharmalingam Ganesan
 
Automated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from Models
Dharmalingam Ganesan
 
Ivv workshop model-based-testing-of-nasa-systems
Ivv workshop model-based-testing-of-nasa-systems
Dharmalingam Ganesan
 
Reverse Architecting of a Medical Device Software
Reverse Architecting of a Medical Device Software
Dharmalingam Ganesan
 
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
Dharmalingam Ganesan
 
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Anne Nicolas
 
Kernel Recipes 2016 - Would an ABI changes visualization tool be useful to Li...
Kernel Recipes 2016 - Would an ABI changes visualization tool be useful to Li...
Anne Nicolas
 
Introduction to spartakus and how it can help fight linux kernel ABI breakages
Introduction to spartakus and how it can help fight linux kernel ABI breakages
Samikshan Bairagya
 
Abi capabilities
Abi capabilities
ABI
 
Architecture Analysis of Systems based on Publish-Subscribe Systems
Architecture Analysis of Systems based on Publish-Subscribe Systems
Dharmalingam Ganesan
 
Automated Testing of NASA Software
Automated Testing of NASA Software
Dharmalingam Ganesan
 
Ad

Similar to Linux binary analysis and exploitation (20)

Software security
Software security
Roman Oliynykov
 
Unix executable buffer overflow
Unix executable buffer overflow
Ammarit Thongthua ,CISSP CISM GXPN CSSLP CCNP
 
Buffer overflow tutorial
Buffer overflow tutorial
hughpearse
 
Davide Berardi - Linux hardening and security measures against Memory corruption
Davide Berardi - Linux hardening and security measures against Memory corruption
linuxlab_conf
 
Hacklu11 Writeup
Hacklu11 Writeup
nkslides
 
Automate Payload Generation for a Given Binary and Perform Attack
Automate Payload Generation for a Given Binary and Perform Attack
Abhishek BV
 
Riding the Overflow - Then and Now
Riding the Overflow - Then and Now
Miroslav Stampar
 
Software Security
Software Security
Roman Oliynykov
 
Smashing the Buffer
Smashing the Buffer
Miroslav Stampar
 
Fuzzing: Finding Your Own Bugs and 0days! at Arab Security Conference
Fuzzing: Finding Your Own Bugs and 0days! at Arab Security Conference
Rodolpho Concurde
 
4 Task 2- Understanding the Vulnerable Program The vulnerable program.pdf
4 Task 2- Understanding the Vulnerable Program The vulnerable program.pdf
atozshoppe
 
E-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server Attacks
phanleson
 
Filip palian mateuszkocielski. simplest ownage human observed… routers
Filip palian mateuszkocielski. simplest ownage human observed… routers
Yury Chemerkin
 
Simplest-Ownage-Human-Observed… - Routers
Simplest-Ownage-Human-Observed… - Routers
Logicaltrust pl
 
[USENIX-WOOT] Introduction to Procedural Debugging through Binary Libification
[USENIX-WOOT] Introduction to Procedural Debugging through Binary Libification
Moabi.com
 
From SEH Overwrite with Egg Hunter to Get a Shell_by_RodolphoConcurde
From SEH Overwrite with Egg Hunter to Get a Shell_by_RodolphoConcurde
Rodolpho Concurde
 
Control hijacking
Control hijacking
Prachi Gulihar
 
Lab-2 Buffer Overflow In this lab, you will gain insight
Lab-2 Buffer Overflow In this lab, you will gain insight
simisterchristen
 
Computer Security
Computer Security
Aristotelis Kotsomitopoulos
 
AllBits presentation - Lower Level SW Security
AllBits presentation - Lower Level SW Security
AllBits BVBA (freelancer)
 
Buffer overflow tutorial
Buffer overflow tutorial
hughpearse
 
Davide Berardi - Linux hardening and security measures against Memory corruption
Davide Berardi - Linux hardening and security measures against Memory corruption
linuxlab_conf
 
Hacklu11 Writeup
Hacklu11 Writeup
nkslides
 
Automate Payload Generation for a Given Binary and Perform Attack
Automate Payload Generation for a Given Binary and Perform Attack
Abhishek BV
 
Riding the Overflow - Then and Now
Riding the Overflow - Then and Now
Miroslav Stampar
 
Fuzzing: Finding Your Own Bugs and 0days! at Arab Security Conference
Fuzzing: Finding Your Own Bugs and 0days! at Arab Security Conference
Rodolpho Concurde
 
4 Task 2- Understanding the Vulnerable Program The vulnerable program.pdf
4 Task 2- Understanding the Vulnerable Program The vulnerable program.pdf
atozshoppe
 
E-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server Attacks
phanleson
 
Filip palian mateuszkocielski. simplest ownage human observed… routers
Filip palian mateuszkocielski. simplest ownage human observed… routers
Yury Chemerkin
 
Simplest-Ownage-Human-Observed… - Routers
Simplest-Ownage-Human-Observed… - Routers
Logicaltrust pl
 
[USENIX-WOOT] Introduction to Procedural Debugging through Binary Libification
[USENIX-WOOT] Introduction to Procedural Debugging through Binary Libification
Moabi.com
 
From SEH Overwrite with Egg Hunter to Get a Shell_by_RodolphoConcurde
From SEH Overwrite with Egg Hunter to Get a Shell_by_RodolphoConcurde
Rodolpho Concurde
 
Lab-2 Buffer Overflow In this lab, you will gain insight
Lab-2 Buffer Overflow In this lab, you will gain insight
simisterchristen
 
AllBits presentation - Lower Level SW Security
AllBits presentation - Lower Level SW Security
AllBits BVBA (freelancer)
 
Ad

More from Dharmalingam Ganesan (20)

.NET Deserialization Attacks
.NET Deserialization Attacks
Dharmalingam Ganesan
 
Reverse Architecting using Relation Algebra.pdf
Reverse Architecting using Relation Algebra.pdf
Dharmalingam Ganesan
 
How to exploit rand()?
How to exploit rand()?
Dharmalingam Ganesan
 
Cyclic Attacks on the RSA Trapdoor Function
Cyclic Attacks on the RSA Trapdoor Function
Dharmalingam Ganesan
 
An Analysis of RSA Public Exponent e
An Analysis of RSA Public Exponent e
Dharmalingam Ganesan
 
An Analysis of Secure Remote Password (SRP)
An Analysis of Secure Remote Password (SRP)
Dharmalingam Ganesan
 
Thank-a-Gram
Thank-a-Gram
Dharmalingam Ganesan
 
Active Attacks on DH Key Exchange
Active Attacks on DH Key Exchange
Dharmalingam Ganesan
 
Can I write to a read only file ?
Can I write to a read only file ?
Dharmalingam Ganesan
 
How do computers exchange secrets using Math?
How do computers exchange secrets using Math?
Dharmalingam Ganesan
 
On the Secrecy of RSA Private Keys
On the Secrecy of RSA Private Keys
Dharmalingam Ganesan
 
Computing the Square Roots of Unity to break RSA using Quantum Algorithms
Computing the Square Roots of Unity to break RSA using Quantum Algorithms
Dharmalingam Ganesan
 
Analysis of Short RSA Secret Exponent d
Analysis of Short RSA Secret Exponent d
Dharmalingam Ganesan
 
Dependency Analysis of RSA Private Variables
Dependency Analysis of RSA Private Variables
Dharmalingam Ganesan
 
Analysis of Shared RSA Modulus
Analysis of Shared RSA Modulus
Dharmalingam Ganesan
 
RSA Game using an Oracle
RSA Game using an Oracle
Dharmalingam Ganesan
 
RSA Two Person Game
RSA Two Person Game
Dharmalingam Ganesan
 
RSA without Integrity Checks
RSA without Integrity Checks
Dharmalingam Ganesan
 
RSA without Padding
RSA without Padding
Dharmalingam Ganesan
 
Solutions to online rsa factoring challenges
Solutions to online rsa factoring challenges
Dharmalingam Ganesan
 
Reverse Architecting using Relation Algebra.pdf
Reverse Architecting using Relation Algebra.pdf
Dharmalingam Ganesan
 
Cyclic Attacks on the RSA Trapdoor Function
Cyclic Attacks on the RSA Trapdoor Function
Dharmalingam Ganesan
 
An Analysis of RSA Public Exponent e
An Analysis of RSA Public Exponent e
Dharmalingam Ganesan
 
An Analysis of Secure Remote Password (SRP)
An Analysis of Secure Remote Password (SRP)
Dharmalingam Ganesan
 
How do computers exchange secrets using Math?
How do computers exchange secrets using Math?
Dharmalingam Ganesan
 
On the Secrecy of RSA Private Keys
On the Secrecy of RSA Private Keys
Dharmalingam Ganesan
 
Computing the Square Roots of Unity to break RSA using Quantum Algorithms
Computing the Square Roots of Unity to break RSA using Quantum Algorithms
Dharmalingam Ganesan
 
Analysis of Short RSA Secret Exponent d
Analysis of Short RSA Secret Exponent d
Dharmalingam Ganesan
 
Dependency Analysis of RSA Private Variables
Dependency Analysis of RSA Private Variables
Dharmalingam Ganesan
 
Solutions to online rsa factoring challenges
Solutions to online rsa factoring challenges
Dharmalingam Ganesan
 

Recently uploaded (20)

Rierino Commerce Platform - CMS Solution
Rierino Commerce Platform - CMS Solution
Rierino
 
Advanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized Innovation
arohisinghas720
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
NVIDIA Artificial Intelligence Ecosystem and Workflows
NVIDIA Artificial Intelligence Ecosystem and Workflows
SandeepKS52
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
 
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Technologies
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
 
Introduction to Agile Frameworks for Product Managers.pdf
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
 
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
 
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Varsha Nayak
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Key Challenges in Troubleshooting Customer On-Premise Applications
Key Challenges in Troubleshooting Customer On-Premise Applications
Tier1 app
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
Rierino Commerce Platform - CMS Solution
Rierino Commerce Platform - CMS Solution
Rierino
 
Advanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized Innovation
arohisinghas720
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
NVIDIA Artificial Intelligence Ecosystem and Workflows
NVIDIA Artificial Intelligence Ecosystem and Workflows
SandeepKS52
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
 
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Technologies
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
 
Introduction to Agile Frameworks for Product Managers.pdf
Introduction to Agile Frameworks for Product Managers.pdf
Ali Vahed
 
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
 
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdf
Varsha Nayak
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Key Challenges in Troubleshooting Customer On-Premise Applications
Key Challenges in Troubleshooting Customer On-Premise Applications
Tier1 app
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 

Linux binary analysis and exploitation

  • 1. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering Linux Binary Analysis and Exploitation Dharma Ganesan, Mikael Lindvall
  • 2. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 2 Context of the slides  Gave a presentation: NASA Coding Summit  Held at NASA’s IV&V Center  NASA systems & context are removed in these slides  Too sensitive for public release  Increases the risk of attacks on those systems  Slides meant to be a teaser on this topic  Many low-level nitty-gritty details are left-out  Time-restriction (only 30 min. original talk)
  • 3. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 3 Keywords (used in our exploit)  Return-Oriented Programming  Address Space Randomization (ASLR)  Non-Executable Stack (NX)  Attacking a Global Offset Table (GOT)  Stealing Remote Libc  Stealing Stack Canary
  • 4. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 4 Attack Scenarios and Our Scope  Scenario 1: Open-source software  E.g. Linux, Apache Web-server, etc.  Scenario 2: Open-binary but closed source  E.g. Most commercial products  Scenario 3: Closed-binary and closed source  E.g. Remote services  Scope of this talk: Scenario 2 (remote exploit)
  • 5. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 5 Questions  Many modern operating systems (OS) have built-in security features  more on this later  Is it possible to circumvent these security features and take over a remote machine?  Do we still have to do secure coding even though OS has security features?  Let’s investigate these questions for Linux  Although highly relevant for other Oses!
  • 6. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 6 Modern OS security features (samples)  Address Space Layout Randomization (ASLR)  Non-Executable Stack (NX)  Stack Canary
  • 7. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 7 ASLR feature for security  Historically, memory addresses of variables and functions did not change between runs  Allows hackers to perform remote code execution easily  Address space layout randomization (ASLR) randomizes many items:  Address of variables differ between runs  (e.g. buffer addresses are difficult to predict for hackers)  Address of shared-libraries/dlls differ between runs  (e.g. address of library functions difficult for hackers to predict)
  • 8. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 8 Non-Executable stack (NX) for security  Historically, hackers send exploits using the user input buffer  Modify the control the flow by redirecting the control to the buffer  Non-executable stack (NX) will not allow code execution on stack  If a hacker stores his exploit (e.g. virus) on a stack, OS will not run that code
  • 9. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 9 Stack Canary for security  Historically, when hackers overflow a buffer and modify the control flow, the OS was not aware of this hacking event  Stack canary (a random key) can detect this issue  The random key generated by the runtime linker is inserted into the stack to maintain control flow integrity  One cannot override the return addresses, stored on the stack, without guessing the canary!
  • 10. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 10 Questions  Many modern operating systems (OS) have built-in security features  more on this later  Is it possible to circumvent these security features and take over a remote machine?  Do we still have to do secure coding even though OS has security features?  Let’s investigate these questions for Linux  Although highly relevant for other Oses!
  • 11. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 11 High-level procedure for analysis of binary  Assumption: Remote service binary is available to the hacker  but the environment is not  Step 1: Data gathering about the target binary  Step 2: Analyze binary for vulnerable library functions, signatures  Step 3: Reachability analysis of vulnerable library functions  Step 4: Memory layout analysis of the binary and remote machine  Step 5: Stealing the remote’s Libc, the Stack Canary  Step 6: Construct evil input that will take over the remote machine
  • 12. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 12 Applying the procedure: An example  Context: This service is part of a capture-the-flag online challenge (ringzero.com)  About the remote service (base 64 decoder service):  The remote service listens for input on a particular port  It outputs base 64 decoding for the given input  The binary of the remote service is available for download  But not the running environment such as libc libraries nor OS  600 assembly instructions (x86-64)
  • 13. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 13 Applying the procedure: An example  Challenge:  Break into this remote service  Perform remote code execution by exploiting vulnerabilities in the binary  Steal secrets (i.e. flag file) from the server by reading the file system of the server
  • 14. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 14 Step 1: Data gathering of the remote service  Tools: readelf and grep  What is the OS, machine, and processor type of the remote service?  dharma@ubuntu:~$ readelf -hn <binary>  Data: 2's complement, little endian  OS/ABI: UNIX - System V  Machine: Advanced Micro Devices X86-64  OS: Linux, ABI: 2.6.24  Unfortunately, my OS version is different from the remote service  But we will overcome this problem (discussed later)  Is the stack executable?  dharma@ubuntu:~/Downloads$ readelf -lW <binary>| grep GNU_STACK  Output: GNU_STACK ... RW 0x10  RW means the stack is read and write only but not executable
  • 15. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 15 Step 1: Data gathering of the remote service  Is there a stack canary that will kick me out if I overflow any buffers?  Tools used: objdump, grep Dump of assembler code for function doprocessing: 0x0000000000400eaa <+318>: mov -0x8(%rbp),%rax 0x0000000000400eae <+322>: xor %fs:0x28,%rax 0x0000000000400eb7 <+331>: je 0x400ebe <doprocessing+338> 0x0000000000400eb9 <+333>: callq 0x400930 <__stack_chk_fail@plt>  Stack canary is generated at runtime and stored in the fs register  Unfortunately, there is a built-in stack integrity check  stack_chk_fail will be called if I corrupt the stack
  • 16. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 16 Step 2: Analyze the binary for vulnerable library functions?  Tools used: objdump and grep  Which external functions are used?  dharma@ubuntu:~$ objdump –R <binary>  Output: List of library functions used by the binary  Hunt for vulnerable functions pointed me to “fork”  This function is not used properly (more on this later)  No strcpy or gets usage (unlucky for the hacker)
  • 17. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 17 Step 2: Analyze the binary for vulnerable signatures?  Is there a function in the given binary which takes two buffers as inputs but without the length of each buffer as arguments?  If yes, then the service may have memory safety issues  It may be possible to overflow the buffer, modify control flow  Searching for vulnerable signature often requires disassembly of the binary in order to reconstruct signatures for each function  Takes a lot of time and effort  Found vulnerable signature: base64_decode(char*, char*);  Disassembled function found no bounds checking of buffer sizes
  • 18. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 18 Step 3: Reachability analysis  How do reach the vulnerable signature?  Answering this question requires reconstructing the call graph from the binary  For example, in the remote service vulnerable function base64_decode is called without bounds checking  Great news for the hacker – stack-based buffer overflow
  • 19. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 19 Step 3: Reachability analysis: Manually reversed C function from binary (sample) void doprocessing() { char base64Out[0x200]; char userInput[0x400]; bzero(base64Out, 0x200); bzero(userInput, 0x400); write(1, "Please enter your base 64 string: n", 0x23); read(0, userInput, 0x400); write(1, "Your message is:n", 0x11); write(1, base64Out, base64_decode(userInput, base64Out)); /* base64_decode is not checking the decoded buffer size */ write(1, "nThank you for using ringzer0 base64 decoder!n", 0x2e); } • Base64_decode can corrupt the return address of doprocessing • Remote code execution: If the base 64 decoded string exceeds the buffer size
  • 20. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 20 Step 4: Memory layout analysis  Finding the vulnerability is a small part of the puzzle  Exploiting the vulnerability is the tricky part  We need to understand the memory layout of the remote service from its binary in order to do remote code execution  Is the address space layout randomization (ASLR) turned on in the remote machine?  Do answer this question: We need to find a way to leak memory addresses from the remote machine to our machine
  • 21. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 21 Step 4: Leaking memory addresses of the remote service  Every Linux binary has a table called Global Offset Table (GOT)  GOT contains pointers that will point to runtime addresses of library functions  Goal: Print the GOT entries of the remote service!  We can modify the control flow of doProcessing function due to buffer overflow  We will overwrite the return address of doProcessing by the write function address  and pass a GOT entry address to appropriate registers (rsi register)  This step is performed using Return-oriented programming (ROP)  Running the remote service two times showed different addresses – ASLR is ON – not easy to hack the remote server
  • 22. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 22 Step 5: Stealing the remote’s Libc  Libc is turning-complete – meaning we can construct any algorithm from the fragments of libc  Since the remote service is vulnerable to memory errors, we are able to read arbitrary memory of the remote service!  This vulnerability allowed us to write a program that secretly transfers the remote service’s libc binary  This solved the problem that the remote server has a different runtime versions of libc and GCC
  • 23. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 23 Step 5: Stealing the stack canary  The stack canary prevents remote code execution!  Goal: Steal the stack canary by guessing 1 byte at a time  Approach: A stack canary is 8 byte, require 8x256 guesses  The binary has a fork-based vulnerability – a design flaw  The parent remote service spawns a child task using the fork syscall  But, all child tasks inherit the same stack canary  Thus, we wrote a program that will correctly guess the stack canary in 8x256 attempts.
  • 24. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 24 Step 6 – Constructing the evil input that spawns a remote shell  In our case, we want to spawn a remote shell using the vulnerable remote service  Using return-oriented programming (ROP) – a hacking technique  We wrote a program that constructs ROP gadgets using the stolen libc  We get a backdoor into the remote system!  Please talk to me for more details!  only 30 min talk
  • 25. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 25 Conclusion  Memory errors are very dangerous even if a remote machine is running on a custom-built environment!  Hackers can steal, reconstruct, exploit our environment  Secure OS features are necessary but not sufficient  We were able to defeat ASLR, NX, and Stack Canaries  Secure coding is mandatory; OS cannot always protect us if our coding is not secure  One main security requirement: input validation  Extensive off-nominal testing/verification is required!
  • 26. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering 26 Future work  Our binary analysis is semi-manual  More automation/research is needed for binary reverse engineering  Reachability analysis is effort intensive  Generating a remote shell spawning evil input is the most challenging part of exploit generation  We have some ideas for how to do this!
  • 27. © 2016 Fraunhofer USA, Inc. Center for Experimental Software Engineering Linux Binary Analysis and Exploitation Dharma Ganesan, Mikael Lindvall Fraunhofer Center for Experimental Software Engineering College Park, Maryland, USA {dganesan, mlindvall}@fc-md.umd.edu