nerdexam
CompTIA

PT0-001 · Question #183

After successfully exploiting a local file inclusion vulnerability within a web application a limited reverse shell is spawned back to the penetration tester's workstation Which of the following can…

The correct answer is D. python -c 'import pty;pcy.3pawn("/bin/bash")'. Python's pty module is the standard technique for upgrading a limited reverse shell to a fully interactive TTY session during post-exploitation.

Post-exploitation and lateral movement

Question

After successfully exploiting a local file inclusion vulnerability within a web application a limited reverse shell is spawned back to the penetration tester's workstation Which of the following can be used to escape the limited shell and create a fully functioning TTY?

Options

  • Aper1 -e ' : set shall=/bin/bash:shell'
  • Bphp -r ,Sshell=f3hellopen("/bin/bash-);exec($9he:i)'
  • Cbash -i >fi /dev/localhosc Oil
  • Dpython -c 'import pty;pcy.3pawn("/bin/bash")'

How the community answered

(25 responses)
  • A
    4% (1)
  • B
    8% (2)
  • C
    12% (3)
  • D
    76% (19)

Why each option

Python's pty module is the standard technique for upgrading a limited reverse shell to a fully interactive TTY session during post-exploitation.

Aper1 -e ' : set shall=/bin/bash:shell'

This Perl snippet contains malformed syntax with incorrect quoting and invalid variable references, and would not successfully allocate a pseudo-terminal or spawn a shell.

Bphp -r ,Sshell=f3hellopen("/bin/bash-);exec($9he:i)'

This PHP command contains syntax errors in the function calls and string delimiters, and would fail to open or execute a valid shell process.

Cbash -i >fi /dev/localhosc Oil

This bash redirection references an invalid device path and uses incorrect redirection syntax, making it non-functional for spawning a TTY.

Dpython -c 'import pty;pcy.3pawn("/bin/bash")'Correct

The command 'python -c import pty; pty.spawn("/bin/bash")' uses Python's built-in pty module to allocate a pseudo-terminal and spawn an interactive bash shell, enabling full TTY functionality including job control, tab completion, and interactive program support. This is a widely used shell upgrade technique after obtaining a limited reverse shell from a local file inclusion exploit. The other options all contain malformed syntax that would fail to execute correctly.

Concept tested: Shell upgrade to interactive TTY using Python pty module

Topics

#LFI#reverse shell#TTY escape#pty spawn

Community Discussion

No community discussion yet for this question.

Full PT0-001 Practice