Question: In the code sample below, a user enters the following input: ; sleep 5 ; cat / etc / passwd; echo . Wh
In the code sample below, a user enters the following input: ; sleep ; cat etcpasswd; echo Wh be the behavior of this command injection?
import subprocess
import time
def executecommanduserinput:
command fecho userinput
result subprocess.checkoutput command shellTrue
return result.decodeutfstrip
userinput input Enter a value:
output executecommand userinput
printfOutput: output
a An error will occur due to an invalid input.
b The entered value will be echoed back: ; steep ; cat etcpasswd; echo
c The content of the etcpassud file will be displayed after a second delay.
d The program will terminate without any output.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
