SlideShare a Scribd company logo
1 of 24
DharmalingamGanesan
(dganesan@fc-md.umd.edu)
Itzik Kotler
(xorninja@gmail.com)
1
int main(int argc, char **argv) {
char passwd[] = "foobar";
if (argc < 2) {
printf("usage: %s <given-password>n", argv[0]);
return 0;
}
if (!strcmp(passwd, argv[1])) {
printf("Green light!n");
return 1;
}
printf("Red light!n");
return 0;
}
2
๏ƒ˜ What if you do not know the passwd?
Reference: Reverse Engineering with LD_PRELOAD by Itzik Kotler
/*
* strcmp, Fixed strcmp function -- Always equal!
*/
int strcmp(const char *s1, const char *s2) {
printf("S1 eq %sn", s1);
printf("S2 eq %sn", s2);
// ALWAYS RETURN EQUAL STRINGS!
return 0;
}
3
๏‚ก gcc -fPIC -c strcmp-hijack.c -o strcmp-hijack.o
๏‚ก gcc -shared -o strcmp-hijack.so strcmp-hijack.o
๏‚ก ./strcmp-target redbull
๏‚ง Output: โ€œRed light!โ€
๏‚ก Attack using LD_PRELOAD
๏‚ง LD_PRELOAD="./strcmp-hijack.so" ./strcmp-target redbull
๏‚ก Output: โ€œGreen light!โ€
4
/*
* cerberus.c, Impossible statement
*/
#include <stdio.h>
int main(int argc, char **argv) {
int a = 13, b = 17;
if (a != b) {
printf("Sorry!n");
return 0;
}
printf("On a long enough timeline,"
" the survival rate for everyone drops to zeron");
exit(1);
}
5
Can we avoid โ€œSorryโ€ and print the โ€œOn a longโ€ฆโ€?
[~]$ ./cerberus
On a long enough timeline, the survival rate
for everyone drops to zero
080483d4 <main>:
80483d4: 55 push %ebp
80483d5: 89 e5 mov %esp,%ebp
80483d7: 83 e4 f0 and $0xfffffff0,%esp
80483da: 83 ec 20 sub $0x20,%esp
80483dd: c7 44 24 18 0d 00 00 movl $0xd,0x18(%esp)
80483e4: 00
80483e5: c7 44 24 1c 11 00 00 movl $0x11,0x1c(%esp)
80483ec: 00
80483ed: 8b 44 24 18 mov 0x18(%esp),%eax
80483f1: 3b 44 24 1c cmp 0x1c(%esp),%eax
80483f5: 74 13 je 804840a <main+0x36>
80483f7: c7 04 24 f0 84 04 08 movl $0x80484f0,(%esp)
80483fe: e8 ed fe ff ff call 80482f0 <puts@plt>
8048403: b8 00 00 00 00 mov $0x0,%eax
8048408: eb 11 jmp 804841b <main+0x47>
804840a: c7 04 24 f8 84 04 08 movl $0x80484f8,(%esp)
8048411: e8 da fe ff ff call 80482f0 <puts@plt>
8048416: b8 01 00 00 00 mov $0x1,%eax
804841b: c9 leave
804841c: c3 ret
6
Note: puts is used for printf
๏‚ก Create our own โ€œputsโ€ wrapper
๏‚ก Update the return address after the first puts
๏‚ก Transfer control to the second puts
๏‚ก Embed assembly code and adjust the ESP!
7
/* Pointer to the original puts call */
static int (*_puts)(const char *str) = NULL;
int puts(const char *str)
{
if (_puts == NULL) {
_puts = (int (*)(const char *str)) dlsym(RTLD_NEXT, "puts");
// Hijack the RET address and modify it to <main+xx>
__asm__ __volatile__ (
"movl 0x4(%ebp), %eax n"
"addl $7, %eax n"
"movl %eax, 0x4(%ebp)"
);
return 1;
}
__asm__ __volatile__ (
"addl $28, %%esp nโ€œ
โ€œ jmp *%0 n"
:
: "g" (_puts)
: "%esp"
);
return -1;
}
8
โ€ข Why add 7 to eax?
โ€ข 0x804840a โ€“ 0x8048403
โ€ข Why add 28 to esp?
โ€ข Answered in next slides
00000000 <printf>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
6: a1 00 00 00 00 mov 0x0,%eax
b: 85 c0 test %eax,%eax
d: 75 2a jne 39 <printf+0x39>
f: b8 00 00 00 00 mov $0x0,%eax
14: 89 44 24 04 mov %eax,0x4(%esp)
18: c7 04 24 ff ff ff ff movl $0xffffffff,(%esp)
1f: e8 fc ff ff ff call 20 <printf+0x20>
24: a3 00 00 00 00 mov %eax,0x0
29: 8b 45 04 mov 0x4(%ebp),%eax
2c: 83 c0 0f add $0xf,%eax
2f: 89 45 04 mov %eax,0x4(%ebp)
32: b8 01 00 00 00 mov $0x1,%eax
37: eb 00 jmp 39 <printf+0x39>
39: c9 leave
3a: c3 ret
9
Esp got adjusted:
4 bytes (push %ebp)
0x18 bytes (sub $0x18, %esp)
Total: 0x18 + 4 = 24 + 4 = 28
๏‚ก Create a shared lib of the wrapper:
๏‚ง gcc -c -m32 megatron.c -o megatron.o โ€“ldl
๏‚ง gcc -shared -o megatron.so megatron.o -m32 โ€“ldl
๏‚ก export LD_PRELOAD=./megatron.so
[~]$ ./cerberus
On a long enough timeline, the survival rate for
everyone drops to zero
10
๏‚ก The main function uses exit(1)
๏‚ก If we replace it by return(1) and run:
[~]$ gcc -o cerberus cerberus.c -m32
[~]$
[~]$ export LD_PRELOAD=./megatron.so
[~]$
[~]$ ./cerberus
On a long enough timeline, the survival rate for everyone drops to zero
^C
[~]$
11
๏ƒ˜Why the program is not terminating?
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP
ESP
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP
ESP
EBP (main)96
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP
ESP
EBP (main)96
(a). Just before the 2nd printf.
(b). In the wrapper puts. (c). After pointers rewinding.
12
100
96
92
88
84
80
76
52
80
76
100
96
92
88
84
80
100
96
92
88
84
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP of puts
(wrapper) 76
ESP
EBP
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP of puts
(wrapper) 76
ESP
EBP
EIP
(d). Inside the real puts. (e). After returning from real puts.
13
76 76
100
96
92
88
84
80
100
96
92
88
84
*80
๏‚ก Control comes back to main and will try to
run return 1:
๏‚ง mov %ebp, %esp
๏‚ง pop %ebp
๏‚ง Pop %eip (or ret)
14
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP of puts
(wrapper) 76
ESP
EBP
15
76
100
96
92
88
76
80
mov %ebp, %esp
84
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP of puts
(wrapper) 76EBP
ESP
16
76
100
96
92
88
80
pop %ebp
84
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP of puts
(wrapper) 76EBP
EIP
17
76
100
96
92
88
84
ret: pop %eip
ESP
โ€ข Now EIP points to leave-ret sequence!
โ€ข Never ending because EBP of mains is lost
*80
๏‚ก We lost mainโ€™s EBP along the way
๏‚ก There is an infinite loop when the control
comes to main
๏‚ง mov %ebp, %esp
๏‚ง pop %ebp
๏‚ง Ret (or pop %eip)
๏‚ก Program is not able to return to libc
๏‚ก Fix:Why not restore the EBP!
18
OLD
__asm__ __volatile__ (
"addl $28, %%esp nโ€œ
"jmp *%0 n"
:
: "g" (_puts)
: "%esp"
);
NEW
__asm__ __volatile__ (
"addl $24, %%esp n"
"popl %%ebp n"
"jmp *%0 n"
:
: "g" (_puts)
: "%esp"
);
19
[~]$ export LD_PRELOAD=./megatron.so
[~]$
[~]$ ./cerberus
On a long enough timeline, the survival rate for
everyone drops to zero
[~]$
[~]$ echo $?
1
20
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP
ESP
EBP (main)
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP, ESP EBP (main)
(a). In the wrapper puts. (b). After ESP rewinding.
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printfESP
EBP (main)
(c). After pop EBP.
EBP
21
76
100
96
92
88
84
80
52
76
100
96
92
88
84
80
52
76
100
96
92
88
84
80
52
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP of main
(96)
ESP
EBP
Ret2libc
EBP (libc)
17
13
Ptr to printf
input str
ret address
after printf
EBP of main
ESP
EBP
EIP
(d). Inside the real puts. (e). After returning from real puts.
22
76
100
96
92
88
84
80
52
76
76
100
96
92
88
84
*80
52
๏‚ก LD_PRELOAD is a powerful way to hack
๏‚ก Key idea:Wrapper to library functions
๏‚ง Collect data such as input arguments!
๏‚ก Modify control flow dynamically
๏‚ง ESP and EBP rewinding is the core concept
๏‚ก Try it out yourself
๏‚ก Things to keep in mind:
๏‚ง Number of byte adjustments in your wrapper
23
๏‚ก Itzik Kotler
๏‚ง Reverse Engineering with LD_PRELOAD
๏‚ง http://securityvulns.com/articles/reveng/
๏‚ก Dharma Ganesan and Itzik Kotler
๏‚ง Reverse Engineering with LD_PRELOAD (Part 11)
๏‚ง Article to be published
24

More Related Content

What's hot

Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?Adam Dudczak
ย 
A CTF Hackers Toolbox
A CTF Hackers ToolboxA CTF Hackers Toolbox
A CTF Hackers ToolboxStefan
ย 
Hello Swift 3/5 - Function
Hello Swift 3/5 - FunctionHello Swift 3/5 - Function
Hello Swift 3/5 - FunctionCody Yun
ย 
Protocol handler in Gecko
Protocol handler in GeckoProtocol handler in Gecko
Protocol handler in GeckoChih-Hsuan Kuo
ย 
Wap to implement bitwise operators
Wap to implement bitwise operatorsWap to implement bitwise operators
Wap to implement bitwise operatorsHarleen Sodhi
ย 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrencyjgrahamc
ย 
Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)
Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)
Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)Uri Laserson
ย 
Apache PIG - User Defined Functions
Apache PIG - User Defined FunctionsApache PIG - User Defined Functions
Apache PIG - User Defined FunctionsChristoph Bauer
ย 
Intro to Pig UDF
Intro to Pig UDFIntro to Pig UDF
Intro to Pig UDFChris Wilkes
ย 
Something about Golang
Something about GolangSomething about Golang
Something about GolangAnton Arhipov
ย 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone DevelopmentGiordano Scalzo
ย 
Introduction to Swift programming language.
Introduction to Swift programming language.Introduction to Swift programming language.
Introduction to Swift programming language.Icalia Labs
ย 
Python meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/OPython meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/OBuzzcapture
ย 
XpUg Coding Dojo: KataYahtzee in Ocp way
XpUg Coding Dojo: KataYahtzee in Ocp wayXpUg Coding Dojo: KataYahtzee in Ocp way
XpUg Coding Dojo: KataYahtzee in Ocp wayGiordano Scalzo
ย 
ESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. NowESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. NowKrzysztof Szafranek
ย 
EcmaScript 6 - The future is here
EcmaScript 6 - The future is hereEcmaScript 6 - The future is here
EcmaScript 6 - The future is hereSebastiano Armeli
ย 
Gevent what's the point
Gevent what's the pointGevent what's the point
Gevent what's the pointseanmcq
ย 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and GoEleanor McHugh
ย 

What's hot (20)

Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
ย 
A CTF Hackers Toolbox
A CTF Hackers ToolboxA CTF Hackers Toolbox
A CTF Hackers Toolbox
ย 
Hello Swift 3/5 - Function
Hello Swift 3/5 - FunctionHello Swift 3/5 - Function
Hello Swift 3/5 - Function
ย 
Protocol handler in Gecko
Protocol handler in GeckoProtocol handler in Gecko
Protocol handler in Gecko
ย 
Wap to implement bitwise operators
Wap to implement bitwise operatorsWap to implement bitwise operators
Wap to implement bitwise operators
ย 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrency
ย 
Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)
Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)
Numba-compiled Python UDFs for Impala (Impala Meetup 5/20/14)
ย 
dplyr
dplyrdplyr
dplyr
ย 
Apache PIG - User Defined Functions
Apache PIG - User Defined FunctionsApache PIG - User Defined Functions
Apache PIG - User Defined Functions
ย 
Intro to Pig UDF
Intro to Pig UDFIntro to Pig UDF
Intro to Pig UDF
ย 
Something about Golang
Something about GolangSomething about Golang
Something about Golang
ย 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone Development
ย 
Introduction to Swift programming language.
Introduction to Swift programming language.Introduction to Swift programming language.
Introduction to Swift programming language.
ย 
Python meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/OPython meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/O
ย 
XpUg Coding Dojo: KataYahtzee in Ocp way
XpUg Coding Dojo: KataYahtzee in Ocp wayXpUg Coding Dojo: KataYahtzee in Ocp way
XpUg Coding Dojo: KataYahtzee in Ocp way
ย 
ESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. NowESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. Now
ย 
EcmaScript 6 - The future is here
EcmaScript 6 - The future is hereEcmaScript 6 - The future is here
EcmaScript 6 - The future is here
ย 
Gevent what's the point
Gevent what's the pointGevent what's the point
Gevent what's the point
ย 
Php 5.6
Php 5.6Php 5.6
Php 5.6
ย 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and Go
ย 

Viewers also liked

Exploiting Cryptographic Misuse - An Example
Exploiting Cryptographic Misuse - An ExampleExploiting Cryptographic Misuse - An Example
Exploiting Cryptographic Misuse - An ExampleDharmalingam Ganesan
ย 
Model-based Testing of a Software Bus - Applied on Core Flight Executive
Model-based Testing of a Software Bus - Applied on Core Flight ExecutiveModel-based Testing of a Software Bus - Applied on Core Flight Executive
Model-based Testing of a Software Bus - Applied on Core Flight ExecutiveDharmalingam Ganesan
ย 
Model-based Testing using Microsoftโ€™s Spec Explorer Tool: A Case Study
Model-based Testing using Microsoftโ€™s Spec Explorer Tool: A Case StudyModel-based Testing using Microsoftโ€™s Spec Explorer Tool: A Case Study
Model-based Testing using Microsoftโ€™s Spec Explorer Tool: A Case StudyDharmalingam Ganesan
ย 
Linux binary analysis and exploitation
Linux binary analysis and exploitationLinux binary analysis and exploitation
Linux binary analysis and exploitationDharmalingam Ganesan
ย 
Explaining my Phd Thesis to layman
Explaining my Phd Thesis to laymanExplaining my Phd Thesis to layman
Explaining my Phd Thesis to laymanDharmalingam Ganesan
ย 
Interface-Implementation Contract Checking
Interface-Implementation Contract CheckingInterface-Implementation Contract Checking
Interface-Implementation Contract CheckingDharmalingam Ganesan
ย 
Testing of C software components using Models
Testing of C software components using ModelsTesting of C software components using Models
Testing of C software components using ModelsDharmalingam Ganesan
ย 
Verifying Architectural Design Rules of a Flight Software Product Line
Verifying Architectural Design Rules of a Flight Software Product LineVerifying Architectural Design Rules of a Flight Software Product Line
Verifying Architectural Design Rules of a Flight Software Product LineDharmalingam Ganesan
ย 
Reverse Engineering of Software Architecture
Reverse Engineering of Software ArchitectureReverse Engineering of Software Architecture
Reverse Engineering of Software ArchitectureDharmalingam Ganesan
ย 
Automated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from ModelsAutomated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from ModelsDharmalingam Ganesan
ย 
Threat Modeling: Applied on a Publish-Subscribe Architectural Style
Threat Modeling: Applied on a Publish-Subscribe Architectural StyleThreat Modeling: Applied on a Publish-Subscribe Architectural Style
Threat Modeling: Applied on a Publish-Subscribe Architectural StyleDharmalingam Ganesan
ย 
Ivv workshop model-based-testing-of-nasa-systems
Ivv workshop model-based-testing-of-nasa-systemsIvv workshop model-based-testing-of-nasa-systems
Ivv workshop model-based-testing-of-nasa-systemsDharmalingam Ganesan
ย 
Reverse Architecting of a Medical Device Software
Reverse Architecting of a Medical Device SoftwareReverse Architecting of a Medical Device Software
Reverse Architecting of a Medical Device SoftwareDharmalingam Ganesan
ย 
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in IndustryAssessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in IndustryDharmalingam Ganesan
ย 
Secure application programming in the presence of side channel attacks
Secure application programming in the presence of side channel attacksSecure application programming in the presence of side channel attacks
Secure application programming in the presence of side channel attacksDharmalingam Ganesan
ย 
Architecture Analysis of Systems based on Publish-Subscribe Systems
Architecture Analysis of Systems based on Publish-Subscribe SystemsArchitecture Analysis of Systems based on Publish-Subscribe Systems
Architecture Analysis of Systems based on Publish-Subscribe SystemsDharmalingam Ganesan
ย 
Automated testing of NASA Software - part 2
Automated testing of NASA Software - part 2Automated testing of NASA Software - part 2
Automated testing of NASA Software - part 2Dharmalingam Ganesan
ย 
Automated Testing of NASA Software
Automated Testing of NASA SoftwareAutomated Testing of NASA Software
Automated Testing of NASA SoftwareDharmalingam Ganesan
ย 
Carbon Finance
Carbon FinanceCarbon Finance
Carbon FinanceAjay Dhamija
ย 
How to Release Rock-solid RESTful APIs and Ice the Testing BackBlob
How to Release Rock-solid RESTful APIs and Ice the Testing BackBlobHow to Release Rock-solid RESTful APIs and Ice the Testing BackBlob
How to Release Rock-solid RESTful APIs and Ice the Testing BackBlobBob Binder
ย 

Viewers also liked (20)

Exploiting Cryptographic Misuse - An Example
Exploiting Cryptographic Misuse - An ExampleExploiting Cryptographic Misuse - An Example
Exploiting Cryptographic Misuse - An Example
ย 
Model-based Testing of a Software Bus - Applied on Core Flight Executive
Model-based Testing of a Software Bus - Applied on Core Flight ExecutiveModel-based Testing of a Software Bus - Applied on Core Flight Executive
Model-based Testing of a Software Bus - Applied on Core Flight Executive
ย 
Model-based Testing using Microsoftโ€™s Spec Explorer Tool: A Case Study
Model-based Testing using Microsoftโ€™s Spec Explorer Tool: A Case StudyModel-based Testing using Microsoftโ€™s Spec Explorer Tool: A Case Study
Model-based Testing using Microsoftโ€™s Spec Explorer Tool: A Case Study
ย 
Linux binary analysis and exploitation
Linux binary analysis and exploitationLinux binary analysis and exploitation
Linux binary analysis and exploitation
ย 
Explaining my Phd Thesis to layman
Explaining my Phd Thesis to laymanExplaining my Phd Thesis to layman
Explaining my Phd Thesis to layman
ย 
Interface-Implementation Contract Checking
Interface-Implementation Contract CheckingInterface-Implementation Contract Checking
Interface-Implementation Contract Checking
ย 
Testing of C software components using Models
Testing of C software components using ModelsTesting of C software components using Models
Testing of C software components using Models
ย 
Verifying Architectural Design Rules of a Flight Software Product Line
Verifying Architectural Design Rules of a Flight Software Product LineVerifying Architectural Design Rules of a Flight Software Product Line
Verifying Architectural Design Rules of a Flight Software Product Line
ย 
Reverse Engineering of Software Architecture
Reverse Engineering of Software ArchitectureReverse Engineering of Software Architecture
Reverse Engineering of Software Architecture
ย 
Automated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from ModelsAutomated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from Models
ย 
Threat Modeling: Applied on a Publish-Subscribe Architectural Style
Threat Modeling: Applied on a Publish-Subscribe Architectural StyleThreat Modeling: Applied on a Publish-Subscribe Architectural Style
Threat Modeling: Applied on a Publish-Subscribe Architectural Style
ย 
Ivv workshop model-based-testing-of-nasa-systems
Ivv workshop model-based-testing-of-nasa-systemsIvv workshop model-based-testing-of-nasa-systems
Ivv workshop model-based-testing-of-nasa-systems
ย 
Reverse Architecting of a Medical Device Software
Reverse Architecting of a Medical Device SoftwareReverse Architecting of a Medical Device Software
Reverse Architecting of a Medical Device Software
ย 
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in IndustryAssessing Model-Based Testing: An Empirical Study Conducted in Industry
Assessing Model-Based Testing: An Empirical Study Conducted in Industry
ย 
Secure application programming in the presence of side channel attacks
Secure application programming in the presence of side channel attacksSecure application programming in the presence of side channel attacks
Secure application programming in the presence of side channel attacks
ย 
Architecture Analysis of Systems based on Publish-Subscribe Systems
Architecture Analysis of Systems based on Publish-Subscribe SystemsArchitecture Analysis of Systems based on Publish-Subscribe Systems
Architecture Analysis of Systems based on Publish-Subscribe Systems
ย 
Automated testing of NASA Software - part 2
Automated testing of NASA Software - part 2Automated testing of NASA Software - part 2
Automated testing of NASA Software - part 2
ย 
Automated Testing of NASA Software
Automated Testing of NASA SoftwareAutomated Testing of NASA Software
Automated Testing of NASA Software
ย 
Carbon Finance
Carbon FinanceCarbon Finance
Carbon Finance
ย 
How to Release Rock-solid RESTful APIs and Ice the Testing BackBlob
How to Release Rock-solid RESTful APIs and Ice the Testing BackBlobHow to Release Rock-solid RESTful APIs and Ice the Testing BackBlob
How to Release Rock-solid RESTful APIs and Ice the Testing BackBlob
ย 

Similar to Load-time Hacking using LD_PRELOAD

Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughterQuinn Wilton
ย 
Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)ujihisa
ย 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisaujihisa
ย 
ะšะฐะบ ั€ะฐะฑะพั‚ะฐะตั‚ LLVM ะฑัะบะตะฝะด ะฒ C#. ะ•ะณะพั€ ะ‘ะพะณะฐั‚ะพะฒ โž  CoreHard Autumn 2019
ะšะฐะบ ั€ะฐะฑะพั‚ะฐะตั‚ LLVM ะฑัะบะตะฝะด ะฒ C#. ะ•ะณะพั€ ะ‘ะพะณะฐั‚ะพะฒ โž  CoreHard Autumn 2019ะšะฐะบ ั€ะฐะฑะพั‚ะฐะตั‚ LLVM ะฑัะบะตะฝะด ะฒ C#. ะ•ะณะพั€ ะ‘ะพะณะฐั‚ะพะฒ โž  CoreHard Autumn 2019
ะšะฐะบ ั€ะฐะฑะพั‚ะฐะตั‚ LLVM ะฑัะบะตะฝะด ะฒ C#. ะ•ะณะพั€ ะ‘ะพะณะฐั‚ะพะฒ โž  CoreHard Autumn 2019corehard_by
ย 
Call Return Exploration
Call Return ExplorationCall Return Exploration
Call Return ExplorationPat Hawks
ย 
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)Miguel Arroyo
ย 
Rust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineRust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineMatt Provost
ย 
Q1 Consider the below omp_trap1.c implantation, modify the code so t.pdf
Q1 Consider the below omp_trap1.c implantation, modify the code so t.pdfQ1 Consider the below omp_trap1.c implantation, modify the code so t.pdf
Q1 Consider the below omp_trap1.c implantation, modify the code so t.pdfabdulrahamanbags
ย 
Unit 4
Unit 4Unit 4
Unit 4siddr
ย 
please help me with this and explain in details also in the first qu.pdf
please help me with this and explain in details also in the first qu.pdfplease help me with this and explain in details also in the first qu.pdf
please help me with this and explain in details also in the first qu.pdfnewfaransportsfitnes
ย 
MuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for CMuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for CSusumu Tokumoto
ย 
Stop Monkeys Fall
Stop Monkeys FallStop Monkeys Fall
Stop Monkeys FallHajime Morrita
ย 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsAsuka Nakajima
ย 
ใƒ—ใƒญใ‚ฐใƒฉใƒ ๅฎŸ่กŒใฎ่ฉฑใจโ€จOSใจใƒกใƒขใƒชใฎๆŒ™ๅ‹•ใฎ่ฉฑ
ใƒ—ใƒญใ‚ฐใƒฉใƒ ๅฎŸ่กŒใฎ่ฉฑใจโ€จOSใจใƒกใƒขใƒชใฎๆŒ™ๅ‹•ใฎ่ฉฑใƒ—ใƒญใ‚ฐใƒฉใƒ ๅฎŸ่กŒใฎ่ฉฑใจโ€จOSใจใƒกใƒขใƒชใฎๆŒ™ๅ‹•ใฎ่ฉฑ
ใƒ—ใƒญใ‚ฐใƒฉใƒ ๅฎŸ่กŒใฎ่ฉฑใจโ€จOSใจใƒกใƒขใƒชใฎๆŒ™ๅ‹•ใฎ่ฉฑtatsunori ishikawa
ย 
Exploiting Memory Overflows
Exploiting Memory OverflowsExploiting Memory Overflows
Exploiting Memory OverflowsAnkur Tyagi
ย 
Compiled Python UDFs for Impala
Compiled Python UDFs for ImpalaCompiled Python UDFs for Impala
Compiled Python UDFs for ImpalaCloudera, Inc.
ย 
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321Teddy Hsiung
ย 

Similar to Load-time Hacking using LD_PRELOAD (20)

Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughter
ย 
Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)
ย 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
ย 
ะšะฐะบ ั€ะฐะฑะพั‚ะฐะตั‚ LLVM ะฑัะบะตะฝะด ะฒ C#. ะ•ะณะพั€ ะ‘ะพะณะฐั‚ะพะฒ โž  CoreHard Autumn 2019
ะšะฐะบ ั€ะฐะฑะพั‚ะฐะตั‚ LLVM ะฑัะบะตะฝะด ะฒ C#. ะ•ะณะพั€ ะ‘ะพะณะฐั‚ะพะฒ โž  CoreHard Autumn 2019ะšะฐะบ ั€ะฐะฑะพั‚ะฐะตั‚ LLVM ะฑัะบะตะฝะด ะฒ C#. ะ•ะณะพั€ ะ‘ะพะณะฐั‚ะพะฒ โž  CoreHard Autumn 2019
ะšะฐะบ ั€ะฐะฑะพั‚ะฐะตั‚ LLVM ะฑัะบะตะฝะด ะฒ C#. ะ•ะณะพั€ ะ‘ะพะณะฐั‚ะพะฒ โž  CoreHard Autumn 2019
ย 
Call Return Exploration
Call Return ExplorationCall Return Exploration
Call Return Exploration
ย 
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
ย 
Rust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineRust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command Line
ย 
Q1 Consider the below omp_trap1.c implantation, modify the code so t.pdf
Q1 Consider the below omp_trap1.c implantation, modify the code so t.pdfQ1 Consider the below omp_trap1.c implantation, modify the code so t.pdf
Q1 Consider the below omp_trap1.c implantation, modify the code so t.pdf
ย 
CompilersAndLibraries
CompilersAndLibrariesCompilersAndLibraries
CompilersAndLibraries
ย 
Unit 4
Unit 4Unit 4
Unit 4
ย 
please help me with this and explain in details also in the first qu.pdf
please help me with this and explain in details also in the first qu.pdfplease help me with this and explain in details also in the first qu.pdf
please help me with this and explain in details also in the first qu.pdf
ย 
MuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for CMuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for C
ย 
Stop Monkeys Fall
Stop Monkeys FallStop Monkeys Fall
Stop Monkeys Fall
ย 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
ย 
ใƒ—ใƒญใ‚ฐใƒฉใƒ ๅฎŸ่กŒใฎ่ฉฑใจโ€จOSใจใƒกใƒขใƒชใฎๆŒ™ๅ‹•ใฎ่ฉฑ
ใƒ—ใƒญใ‚ฐใƒฉใƒ ๅฎŸ่กŒใฎ่ฉฑใจโ€จOSใจใƒกใƒขใƒชใฎๆŒ™ๅ‹•ใฎ่ฉฑใƒ—ใƒญใ‚ฐใƒฉใƒ ๅฎŸ่กŒใฎ่ฉฑใจโ€จOSใจใƒกใƒขใƒชใฎๆŒ™ๅ‹•ใฎ่ฉฑ
ใƒ—ใƒญใ‚ฐใƒฉใƒ ๅฎŸ่กŒใฎ่ฉฑใจโ€จOSใจใƒกใƒขใƒชใฎๆŒ™ๅ‹•ใฎ่ฉฑ
ย 
Mona cheatsheet
Mona cheatsheetMona cheatsheet
Mona cheatsheet
ย 
Exploiting Memory Overflows
Exploiting Memory OverflowsExploiting Memory Overflows
Exploiting Memory Overflows
ย 
Compiled Python UDFs for Impala
Compiled Python UDFs for ImpalaCompiled Python UDFs for Impala
Compiled Python UDFs for Impala
ย 
Cpl
CplCpl
Cpl
ย 
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ย 

More from Dharmalingam Ganesan

.NET Deserialization Attacks
.NET Deserialization Attacks.NET Deserialization Attacks
.NET Deserialization AttacksDharmalingam Ganesan
ย 
Reverse Architecting using Relation Algebra.pdf
Reverse Architecting using Relation Algebra.pdfReverse Architecting using Relation Algebra.pdf
Reverse Architecting using Relation Algebra.pdfDharmalingam Ganesan
ย 
Cyclic Attacks on the RSA Trapdoor Function
Cyclic Attacks on the RSA Trapdoor FunctionCyclic Attacks on the RSA Trapdoor Function
Cyclic Attacks on the RSA Trapdoor FunctionDharmalingam Ganesan
ย 
An Analysis of RSA Public Exponent e
An Analysis of RSA Public Exponent eAn Analysis of RSA Public Exponent e
An Analysis of RSA Public Exponent eDharmalingam Ganesan
ย 
An Analysis of Secure Remote Password (SRP)
An Analysis of Secure Remote Password (SRP)An Analysis of Secure Remote Password (SRP)
An Analysis of Secure Remote Password (SRP)Dharmalingam Ganesan
ย 
Active Attacks on DH Key Exchange
Active Attacks on DH Key ExchangeActive Attacks on DH Key Exchange
Active Attacks on DH Key ExchangeDharmalingam Ganesan
ย 
Can I write to a read only file ?
Can I write to a read only file ?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?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 KeysOn the Secrecy of RSA Private Keys
On the Secrecy of RSA Private KeysDharmalingam Ganesan
ย 
Computing the Square Roots of Unity to break RSA using Quantum Algorithms
Computing the Square Roots of Unity to break RSA using Quantum AlgorithmsComputing the Square Roots of Unity to break RSA using Quantum Algorithms
Computing the Square Roots of Unity to break RSA using Quantum AlgorithmsDharmalingam Ganesan
ย 
Analysis of Short RSA Secret Exponent d
Analysis of Short RSA Secret Exponent dAnalysis of Short RSA Secret Exponent d
Analysis of Short RSA Secret Exponent dDharmalingam Ganesan
ย 
Dependency Analysis of RSA Private Variables
Dependency Analysis of RSA Private VariablesDependency Analysis of RSA Private Variables
Dependency Analysis of RSA Private VariablesDharmalingam Ganesan
ย 
Analysis of Shared RSA Modulus
Analysis of Shared RSA ModulusAnalysis of Shared RSA Modulus
Analysis of Shared RSA ModulusDharmalingam Ganesan
ย 
RSA without Integrity Checks
RSA without Integrity ChecksRSA without Integrity Checks
RSA without Integrity ChecksDharmalingam Ganesan
ย 
Solutions to online rsa factoring challenges
Solutions to online rsa factoring challengesSolutions to online rsa factoring challenges
Solutions to online rsa factoring challengesDharmalingam Ganesan
ย 

More from Dharmalingam Ganesan (20)

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

Recently uploaded

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
ย 
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธcall girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธDelhi Call girls
ย 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
ย 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
ย 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
ย 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
ย 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
ย 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
ย 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
ย 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...OnePlan Solutions
ย 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
ย 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
ย 
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...Steffen Staab
ย 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
ย 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
ย 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
ย 
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female service
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female serviceCALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female service
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
ย 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
ย 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
ย 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
ย 

Recently uploaded (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
ย 
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธcall girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
call girls in Vaishali (Ghaziabad) ๐Ÿ” >เผ’8448380779 ๐Ÿ” genuine Escort Service ๐Ÿ”โœ”๏ธโœ”๏ธ
ย 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
ย 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
ย 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
ย 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
ย 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
ย 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
ย 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
ย 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlanโ€™s ...
ย 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
ย 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
ย 
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spacesย - and Epistemic Querying of RDF-...
ย 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
ย 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
ย 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
ย 
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female service
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female serviceCALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female service
CALL ON โžฅ8923113531 ๐Ÿ”Call Girls Badshah Nagar Lucknow best Female service
ย 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
ย 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
ย 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
ย 

Load-time Hacking using LD_PRELOAD

  • 2. int main(int argc, char **argv) { char passwd[] = "foobar"; if (argc < 2) { printf("usage: %s <given-password>n", argv[0]); return 0; } if (!strcmp(passwd, argv[1])) { printf("Green light!n"); return 1; } printf("Red light!n"); return 0; } 2 ๏ƒ˜ What if you do not know the passwd? Reference: Reverse Engineering with LD_PRELOAD by Itzik Kotler
  • 3. /* * strcmp, Fixed strcmp function -- Always equal! */ int strcmp(const char *s1, const char *s2) { printf("S1 eq %sn", s1); printf("S2 eq %sn", s2); // ALWAYS RETURN EQUAL STRINGS! return 0; } 3
  • 4. ๏‚ก gcc -fPIC -c strcmp-hijack.c -o strcmp-hijack.o ๏‚ก gcc -shared -o strcmp-hijack.so strcmp-hijack.o ๏‚ก ./strcmp-target redbull ๏‚ง Output: โ€œRed light!โ€ ๏‚ก Attack using LD_PRELOAD ๏‚ง LD_PRELOAD="./strcmp-hijack.so" ./strcmp-target redbull ๏‚ก Output: โ€œGreen light!โ€ 4
  • 5. /* * cerberus.c, Impossible statement */ #include <stdio.h> int main(int argc, char **argv) { int a = 13, b = 17; if (a != b) { printf("Sorry!n"); return 0; } printf("On a long enough timeline," " the survival rate for everyone drops to zeron"); exit(1); } 5 Can we avoid โ€œSorryโ€ and print the โ€œOn a longโ€ฆโ€? [~]$ ./cerberus On a long enough timeline, the survival rate for everyone drops to zero
  • 6. 080483d4 <main>: 80483d4: 55 push %ebp 80483d5: 89 e5 mov %esp,%ebp 80483d7: 83 e4 f0 and $0xfffffff0,%esp 80483da: 83 ec 20 sub $0x20,%esp 80483dd: c7 44 24 18 0d 00 00 movl $0xd,0x18(%esp) 80483e4: 00 80483e5: c7 44 24 1c 11 00 00 movl $0x11,0x1c(%esp) 80483ec: 00 80483ed: 8b 44 24 18 mov 0x18(%esp),%eax 80483f1: 3b 44 24 1c cmp 0x1c(%esp),%eax 80483f5: 74 13 je 804840a <main+0x36> 80483f7: c7 04 24 f0 84 04 08 movl $0x80484f0,(%esp) 80483fe: e8 ed fe ff ff call 80482f0 <puts@plt> 8048403: b8 00 00 00 00 mov $0x0,%eax 8048408: eb 11 jmp 804841b <main+0x47> 804840a: c7 04 24 f8 84 04 08 movl $0x80484f8,(%esp) 8048411: e8 da fe ff ff call 80482f0 <puts@plt> 8048416: b8 01 00 00 00 mov $0x1,%eax 804841b: c9 leave 804841c: c3 ret 6 Note: puts is used for printf
  • 7. ๏‚ก Create our own โ€œputsโ€ wrapper ๏‚ก Update the return address after the first puts ๏‚ก Transfer control to the second puts ๏‚ก Embed assembly code and adjust the ESP! 7
  • 8. /* Pointer to the original puts call */ static int (*_puts)(const char *str) = NULL; int puts(const char *str) { if (_puts == NULL) { _puts = (int (*)(const char *str)) dlsym(RTLD_NEXT, "puts"); // Hijack the RET address and modify it to <main+xx> __asm__ __volatile__ ( "movl 0x4(%ebp), %eax n" "addl $7, %eax n" "movl %eax, 0x4(%ebp)" ); return 1; } __asm__ __volatile__ ( "addl $28, %%esp nโ€œ โ€œ jmp *%0 n" : : "g" (_puts) : "%esp" ); return -1; } 8 โ€ข Why add 7 to eax? โ€ข 0x804840a โ€“ 0x8048403 โ€ข Why add 28 to esp? โ€ข Answered in next slides
  • 9. 00000000 <printf>: 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 18 sub $0x18,%esp 6: a1 00 00 00 00 mov 0x0,%eax b: 85 c0 test %eax,%eax d: 75 2a jne 39 <printf+0x39> f: b8 00 00 00 00 mov $0x0,%eax 14: 89 44 24 04 mov %eax,0x4(%esp) 18: c7 04 24 ff ff ff ff movl $0xffffffff,(%esp) 1f: e8 fc ff ff ff call 20 <printf+0x20> 24: a3 00 00 00 00 mov %eax,0x0 29: 8b 45 04 mov 0x4(%ebp),%eax 2c: 83 c0 0f add $0xf,%eax 2f: 89 45 04 mov %eax,0x4(%ebp) 32: b8 01 00 00 00 mov $0x1,%eax 37: eb 00 jmp 39 <printf+0x39> 39: c9 leave 3a: c3 ret 9 Esp got adjusted: 4 bytes (push %ebp) 0x18 bytes (sub $0x18, %esp) Total: 0x18 + 4 = 24 + 4 = 28
  • 10. ๏‚ก Create a shared lib of the wrapper: ๏‚ง gcc -c -m32 megatron.c -o megatron.o โ€“ldl ๏‚ง gcc -shared -o megatron.so megatron.o -m32 โ€“ldl ๏‚ก export LD_PRELOAD=./megatron.so [~]$ ./cerberus On a long enough timeline, the survival rate for everyone drops to zero 10
  • 11. ๏‚ก The main function uses exit(1) ๏‚ก If we replace it by return(1) and run: [~]$ gcc -o cerberus cerberus.c -m32 [~]$ [~]$ export LD_PRELOAD=./megatron.so [~]$ [~]$ ./cerberus On a long enough timeline, the survival rate for everyone drops to zero ^C [~]$ 11 ๏ƒ˜Why the program is not terminating?
  • 12. Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP ESP Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP ESP EBP (main)96 Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP ESP EBP (main)96 (a). Just before the 2nd printf. (b). In the wrapper puts. (c). After pointers rewinding. 12 100 96 92 88 84 80 76 52 80 76 100 96 92 88 84 80 100 96 92 88 84
  • 13. Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP of puts (wrapper) 76 ESP EBP Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP of puts (wrapper) 76 ESP EBP EIP (d). Inside the real puts. (e). After returning from real puts. 13 76 76 100 96 92 88 84 80 100 96 92 88 84 *80
  • 14. ๏‚ก Control comes back to main and will try to run return 1: ๏‚ง mov %ebp, %esp ๏‚ง pop %ebp ๏‚ง Pop %eip (or ret) 14
  • 15. Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP of puts (wrapper) 76 ESP EBP 15 76 100 96 92 88 76 80 mov %ebp, %esp 84
  • 16. Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP of puts (wrapper) 76EBP ESP 16 76 100 96 92 88 80 pop %ebp 84
  • 17. Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP of puts (wrapper) 76EBP EIP 17 76 100 96 92 88 84 ret: pop %eip ESP โ€ข Now EIP points to leave-ret sequence! โ€ข Never ending because EBP of mains is lost *80
  • 18. ๏‚ก We lost mainโ€™s EBP along the way ๏‚ก There is an infinite loop when the control comes to main ๏‚ง mov %ebp, %esp ๏‚ง pop %ebp ๏‚ง Ret (or pop %eip) ๏‚ก Program is not able to return to libc ๏‚ก Fix:Why not restore the EBP! 18
  • 19. OLD __asm__ __volatile__ ( "addl $28, %%esp nโ€œ "jmp *%0 n" : : "g" (_puts) : "%esp" ); NEW __asm__ __volatile__ ( "addl $24, %%esp n" "popl %%ebp n" "jmp *%0 n" : : "g" (_puts) : "%esp" ); 19
  • 20. [~]$ export LD_PRELOAD=./megatron.so [~]$ [~]$ ./cerberus On a long enough timeline, the survival rate for everyone drops to zero [~]$ [~]$ echo $? 1 20
  • 21. Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP ESP EBP (main) Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP, ESP EBP (main) (a). In the wrapper puts. (b). After ESP rewinding. Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printfESP EBP (main) (c). After pop EBP. EBP 21 76 100 96 92 88 84 80 52 76 100 96 92 88 84 80 52 76 100 96 92 88 84 80 52
  • 22. Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP of main (96) ESP EBP Ret2libc EBP (libc) 17 13 Ptr to printf input str ret address after printf EBP of main ESP EBP EIP (d). Inside the real puts. (e). After returning from real puts. 22 76 100 96 92 88 84 80 52 76 76 100 96 92 88 84 *80 52
  • 23. ๏‚ก LD_PRELOAD is a powerful way to hack ๏‚ก Key idea:Wrapper to library functions ๏‚ง Collect data such as input arguments! ๏‚ก Modify control flow dynamically ๏‚ง ESP and EBP rewinding is the core concept ๏‚ก Try it out yourself ๏‚ก Things to keep in mind: ๏‚ง Number of byte adjustments in your wrapper 23
  • 24. ๏‚ก Itzik Kotler ๏‚ง Reverse Engineering with LD_PRELOAD ๏‚ง http://securityvulns.com/articles/reveng/ ๏‚ก Dharma Ganesan and Itzik Kotler ๏‚ง Reverse Engineering with LD_PRELOAD (Part 11) ๏‚ง Article to be published 24