exam questions

Exam PT0-002 All Questions

View all questions & answers for the PT0-002 exam

Exam PT0-002 topic 1 question 185 discussion

Actual exam question from CompTIA's PT0-002
Question #: 185
Topic #: 1
[All PT0-002 Questions]

A penetration tester is able to use a command injection vulnerability in a web application to get a reverse shell on a system After running a few commands, the tester runs the following:

python -c 'import pty; pty.spawn("/bin/bash")'

Which of the following actions Is the penetration tester performing?

  • A. Privilege escalation
  • B. Upgrading the shell
  • C. Writing a script for persistence
  • D. Building a bind shell
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
RRabbit_111
Highly Voted 2 years, 5 months ago
Selected Answer: B
B. Upgrading the shell. The command the penetration tester is running is used to upgrade the shell from a basic shell to a more advanced shell with better capabilities, such as running multiple commands and using command line arguments. This is known as upgrading the shell. Privilege escalation is the process of obtaining higher privileges on a system, while writing a script for persistence is writing code that will automatically run whenever the system is started or rebooted. Building a bind shell is creating a shell that can be accessed remotely over a network.
upvoted 6 times
...
Etc_Shadow28000
Most Recent 12 months ago
Selected Answer: B
B. Upgrading the shell Explanation: • The command python -c 'import pty; pty.spawn("/bin/bash")' is used to spawn an interactive TTY shell. When a reverse shell is obtained, it often operates in a non-interactive mode, which can limit the ability to use certain commands and interact with the system effectively. By running this Python command, the penetration tester is upgrading the reverse shell to a more fully functional, interactive shell.
upvoted 2 times
...
nickwen007
2 years, 3 months ago
This command is used to spawn a pseudo-terminal (known as a PTY) and execute the /bin/bash shell within it. This provides a more interactive environment than a standard terminal session and allows for more complex tasks to be executed. When this command is run, the bash prompt will appear and the user will have access to all of the features of this shell. It is commonly used in penetration testing, allowing the tester to gain access to a system and explore it freely.
upvoted 3 times
[Removed]
2 years, 3 months ago
B 100% correct
upvoted 1 times
...
...
cy_analyst
2 years, 3 months ago
Selected Answer: B
The code python -c 'import pty; pty.spawn("/bin/bash")' is a Python command that is being run in the command shell of the compromised system. The command is executing a Python script in-line (using the -c flag) that does two things: Imports the pty module: This module provides functionality for spawning a new pseudo-terminal (pty) on the current terminal session. This allows the tester to interact with the shell in a more efficient and interactive way. Spawns a new shell with elevated privileges: The pty.spawn("/bin/bash") method spawns a new bash shell (/bin/bash) with elevated privileges. This is because the current shell that the tester has access to may not have all the necessary permissions to perform certain actions, such as accessing sensitive files or executing certain system commands. By spawning a new shell with elevated privileges, the tester is able to bypass these restrictions and perform a wider range of actions.
upvoted 3 times
[Removed]
2 years, 3 months ago
Please share your answer about the Questions Q- 20 Q- 18 Q-163
upvoted 1 times
...
...
[Removed]
2 years, 4 months ago
B is correct
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...