CREST Practitioner Security Analyst (CPSA) Practice

Disable ads (and more) with a membership for a one time $2.99 payment

Master the CREST Practitioner Security Analyst Exam. Prepare with quizzes and comprehensive study guides that include tips and explanations. Excel in your certification journey!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which command can create a shell with elevated permissions in Linux?

  1. echo os.system('/bin/bash')

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

  3. /bin/sh -i

  4. all of the above

The correct answer is: all of the above

The command that correctly indicates the creation of a shell with elevated permissions is by using all listed options. Each command provided can indeed be employed in specific contexts to achieve a shell with elevated privileges in Linux. The option utilizing Python with the `pty` module can spawn an interactive bash shell. This method is particularly useful when trying to elevate to a shell that responds like an interactive terminal, which can be essential in some scenarios like privilege escalation. When executed, it allows full access to the capabilities of bash. The command `/bin/sh -i`, when executed, starts an interactive shell session. This effectively opens a shell that can run commands with the permissions of the user executing it, and if the user has elevated privileges, this can also lead to further actions requiring those permissions. The first option, while not an executable command on its own in the terminal, suggests a method of invoking a shell through the Python's `os` module. This can be used to execute a command as if it were being run directly in the shell, and depending on the context of its use, can also provide elevated access if executed with such permissions. Since all these commands can lead to a shell environment where elevated permissions are possible depending on the user's context and privileges, the correct