nerdexam
CompTIA

PT0-001 · Question #100

A penetration tester runs the following from a compromised box 'python -c -import pty;Pty.sPawn( "/bin/bash").' Which of the following actions is the tester taking?

The correct answer is B. Upgrading the shell. The command python -c 'import pty; pty.spawn("/bin/bash")' uses Python's built-in pty (pseudo-terminal) module to spawn a fully interactive TTY-attached Bash shell. When a tester gains a reverse or bind shell, it is often a limited 'dumb' shell lacking full terminal…

Post-exploitation and lateral movement

Question

A penetration tester runs the following from a compromised box 'python -c -import pty;Pty.sPawn( "/bin/bash").' Which of the following actions is the tester taking?

Options

  • ARemoving the Bash history
  • BUpgrading the shell
  • CCreating a sandbox
  • DCapturing credentials

How the community answered

(36 responses)
  • A
    6% (2)
  • B
    86% (31)
  • C
    3% (1)
  • D
    6% (2)

Explanation

The command python -c 'import pty; pty.spawn("/bin/bash")' uses Python's built-in pty (pseudo-terminal) module to spawn a fully interactive TTY-attached Bash shell. When a tester gains a reverse or bind shell, it is often a limited 'dumb' shell lacking full terminal capabilities - no tab completion, broken interactive programs (like sudo, vi, passwd), and no proper signal handling. Running this one-liner upgrades that limited shell into a proper interactive terminal session, making post-exploitation tasks significantly easier. This is a standard shell stabilization technique in penetration testing.

Topics

#shell upgrade#PTY spawn#Python#interactive shell

Community Discussion

No community discussion yet for this question.

Full PT0-001 Practice