Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please give description too SEED Labs - Environment Variable and Set-UID Program Lab 2.7 Task 7: The LD PRELOAD Environment Variable and Set-UID Programs In

image text in transcribed
image text in transcribed
image text in transcribed
please give description too
SEED Labs - Environment Variable and Set-UID Program Lab 2.7 Task 7: The LD PRELOAD Environment Variable and Set-UID Programs In this task, we study how Set-UID programs deal with some of the environment variables. Several en- vironment variables, including LD PRELOAD, LD LIBRARY PATH, and other LD influence the behavior of dynamic loader/linker. A dynamic loader/linker is the part of an operating system (OS) that loads (from persistent storage to RAM) and links the shared libraries needed by an executable at run time. In Linux, ld.so orld-linux.so, are the dynamic loader/linker (each for different types of binary). Among the environment variables that affect their behaviors, LD LIBRARY PATH and LD PRELOAD are the two that we are concerned in this lab. In Linux, LD LIBRARY PATH is a colon-separated set of di- rectories where libraries should be searched for first, before the standard set of directories. LD PRELOAD specifies a list of additional, user-specified, shared libraries to be loaded before all others. In this task, we will only study LD PRELOAD. Step 1. First, we will see how these environment variables influence the behavior of dynamic loader/linker when running a normal program. Please follow these steps: 1. Let us build a dynamic link library. Create the following program, and name it my 11b. c. It basically overrides the sleep() function in 1ibe: #include void sleep (ints) /. If this is invoked by a privileged program, you can do damages here! printf("I am not sleeping! "); 2. We can compile the above program using the following commands (in the-lc argument, the second character is 2): gce -EPIC -9 -c mylib.c gce-shared -o libmylib.so.1.0.1 mylib.o -10 3. Now, set the LD PRELOAD environment variable: export LD_PRELOAD-./libmylib.so.1.0.1 3. Now, set the LD PRELOAD environment variable: export LD_PRELOAD-./libmylib.30.1.0.1 4. Finally, compile the following program myprog, and in the same directory as the above dynamic link library libmylib.so.1.0.1: 1. myprog.c / int main() sleep (1); return 0; SEED Labs - Environment Variable and Set-UID Program Lab 7 Step 2. After you have done the above, please run myprog under the following conditions, and observe what happens. Make myprog a regular program, and run it as a normal user. - Make myprog a Set-UID root program, and run it as a normal user Mukim . Step 2. After you have done the above, please run myprog under the following conditions, and observe what happens Make myprog a regular program, and run it as a normal user. Make myprog a Set-UID root program, and run it as a normal user. Make myprog a Set-UID root program, export the LD PRELOAD environment variable again in the root account and run it. Make myprog a Set-UID userl program (1.e., the owner is userl, which is another user account) export the LD PRELOAD environment variable again in a different user's account (not-root user) and run it. Step 3. You should be able to observe different behaviors in the scenarios described above, even though you are running the same program. You need to figure out what causes the difference. Environment variables play a role here. Please design an experiment to figure out the main causes, and explain why the behaviors in Step 2 are different. (Hint: the child process may not inherit the LD environment variables)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions