![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 12.02.2020 03:25 steph2478
The PATH environment variable.
The system (const char *cmd) library function can be used to execute a command within a program. The way system (cmd) works is to invoke the /bin/sh program, and then let the shell program to execute cmd. Because of the shell program invoked, calling system() within a
Set-UID program is extremely dangerous. This is because the actual behavior of the shell program can be affected by environment variables, such as PATH. These environment variables are under user’s control. By changing these variables, malicious users can control the behavior of the Set-UID program. In bash, you can change the PATH environment variable in the following way (this example adds the directory /home/sec-lab to the beginning of the PATH environment variable):
sudo su
export PATH=/home/sec-lab:$PATH
The Set-UID program below is supposed to execute the /bin/ls command; however, the programmer only uses the relative path for the ls command, rather than the absolute path:
Create a file: make sure you are still in the bin folder (if not cd /bin)
nano setUID. c
copy the code to the file
#include
int main()
{
system("ls -la");
return 0;
}
gcc –o setUID setUID. c //this is to compile the c code
./setUID //to execute the executable file
Notice the output of files
cd /usr/local/
ls –la
Notice the bin folder is root (normal users, process and program should not have direct access) and your program had access to as it used the setUID
Question 12 - Can you let this Set-UID program (owned by root) run your code instead of /bin/ls? If you can, is your code running with the root privilege? Describe and explain your observations.
![ansver](/tpl/images/cats/User.png)
Answers: 3
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 04:31
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 16:00
What is the biggest difference between section breaks and regular page breaks? section breaks are more difficult to add than page breaks. section breaks make it easier for you to view the document as an outline. section breaks allow you to have areas of the document with different formatting. section breaks are smaller than regular page breaks.
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 21:30
Enzo’s balance sheet for the month of july is shown. enzo’s balance sheet (july 2013) assets liabilities cash $600 credit card $4,000 investments $500 student loan $2,500 house $120,000 mortgage $80,000 car $6,000 car loan $2,000 total $127,100 total $88,500 which expression finds enzo’s net worth?
Answers: 1
You know the right answer?
The PATH environment variable.
The system (const char *cmd) library function can be used...
The system (const char *cmd) library function can be used...
Questions
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 05.03.2021 01:20
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/biologiya.png)
Biology, 05.03.2021 01:20
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 05.03.2021 01:20
![question](/tpl/images/cats/mat.png)
Mathematics, 05.03.2021 01:20
![question](/tpl/images/cats/geografiya.png)
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 05.03.2021 01:20
![question](/tpl/images/cats/mat.png)
Mathematics, 05.03.2021 01:20
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/himiya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 05.03.2021 01:20
![question](/tpl/images/cats/mat.png)
Mathematics, 05.03.2021 01:20
![question](/tpl/images/cats/mat.png)
Mathematics, 05.03.2021 01:20
![question](/tpl/images/cats/mat.png)
Mathematics, 05.03.2021 01:20
![question](/tpl/images/cats/istoriya.png)
History, 05.03.2021 01:20
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 05.03.2021 01:20
![question](/tpl/images/cats/en.png)
English, 05.03.2021 01:20