Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using ubuntu linux clone Q5. Environment variable and Set-UID Programs Set-UID is an important security mechanism in Unix operating systems. When a Set-UID program runs,

using ubuntu linux clone
image text in transcribed
Q5. Environment variable and Set-UID Programs Set-UID is an important security mechanism in Unix operating systems. When a Set-UID program runs, it assumes the owner's privileges. For example, if the program's owner is root, then when anyone runs this program, the program gains the root's privileges during its execution. Set-UID allows us to do many interesting things, but it escalates the user's privilege when executed, making it quite risky. Although the behaviors of Set-UID programs are decided by their program logic, not by users, users can indeed affect the behaviors via environment variables. To understand how Set-UID programs are affected, let us first figure out whether environment variables are inherited by the Set-UID program's process from the user's process. Step 1. We are going to write a program that can print out all the environment variables in the current process. #include #include extern char **environ; void main() {int i = 0; while (environ[i] != NULL) { printf("%s ", environ[1]); i++; 1 1 Step 2. Compile the above program, change its ownership to root, and make it a Set-UID program. Step 3. In your Bash shell (you need to be in a normal user account, not the root account), use the export command to set the following environment variables (they may have already exist): PATH LD LIBRARY PATH ANY NAME (this is an environment variable defined by you, so pick whatever name you want). These environment variables are set in the user's shell process. Now, run the Set-UID program from Step 2 in your shell. After you type the name of the program in your shell, the shell forks a child process, and uses the child process to run the program. Please check whether all the environment variables you set in the shell process (parent) get into the Set-UID child process. Describe your observation. If there are surprises to you, describe them

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

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

2+2!=?

Answered: 1 week ago