Question
Please provide the solutions for both tasks because they are linked together. Task 3: Passing Data to Bash via Environment Variable To exploit a Shellshock
Please provide the solutions for both tasks because they are linked together.
Task 3:
Passing Data to Bash via Environment Variable To exploit a Shellshock vulnerability in a Bash-based CGI program, attackers need to pass their data to the vulnerable Bash program, and the data need to be passed via an environment variable. In this task, we need to see how we can achieve this goal. You can use the following CGI program to demonstrate that you can send out an arbitrary string to the CGI program, and the string will show up in the content of one of the environment variables.
In the code above, Line 1 prints out the contents of all the environment variables in the current process. If your experiment is successful, you should be able to see your data string in the page that you get back from the server. In your report, please explain how the data from a remote user can get into those environment variables.
Task 4:
Launching the Shellshock Attack After the above CGI program is set up, we can now launch the Shellshock attack. The attack does not depend on what is in the CGI program, as it targets the Bash program, which is invoked first, before the CGI script is executed. Your goal is to launch the attack through the URLhttp://localhost/cgi-bin/myprog.cgi, such that you can achieve something that you cannot do as a remote user. In this task, you should demonstrate the following:
Using the Shellshock attack to steal the content of a secret file from the server
. Answer the following question: will you be able to steal the content of the shadow file /etc/shadow? Why or why not?
#!/bin/bash_shellshock echo "Content-type: text/plain" echo echo "****** Environment Variables ******" strings /proc/$$/environ #!/bin/bash_shellshock echo "Content-type: text/plain" echo echo "****** Environment Variables ******" strings /proc/$$/environStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started