Linux Function Hooking

TryhackMe — Linux Function Hooking

0xNehru
2 min readJul 15, 2021

Task 1 Introduction

#1 :- I am ready to learn!

Answer :- No Needed Answer

Task 2 What are Shared Libraries?

#2 :- What is the name of the dynamic linker/loader on linux?

Answer :- ld.so, ld-linux.so*

Task 3 Getting A Tad Bit Technical

#3.1:- What environment variable let's you load your own shared library before all others?

Answer :- LD_PRELOAD

#3.2:- Which file contains a whitespace-separated list of ELF shared objects to be loaded before running a program?

Answer :- /etc/ld.so.preload

#3.3:- If both the environment variable and the the file are employed, the libraries specified by which would be loaded first?

Answer :- environment variable

Task 4 Putting On Our Coding Hats

#4.1 :- How many arguments does write() take?

Answer :- 3

#4.2 :- Which feature test macro must be defined in order to obtain the definitions of RTLD_NEXT from <dlfcn.h>?

Answer :- _GNU_SOURCE

Task 5 Let’s Gooooooooo

#5.1 :- When compiling our code to produce a Shared Object, which flag is used to create position independent code?

Answer :- -fPIC

#5.2 :- Can hooking libc functions affect the behavior of Python3? (Yay/Nay)

Answer :- yay

Task 6 Hiding Files From ls

#6.1 :- There are two mandatory fields of a dirent structure. One is d_name, and the other one is?

Answer :- d_ino

#6.2 :- I have read and understood how I can hide files using shared objects!

Answer :- No Needed Answer

Task 7 Conclusion

#7 :- Hooray! You made it to the end!

Answer :- No Needed Answer

--

--

0xNehru
0xNehru

No responses yet