Attacks and Exploits

An authorized tester has a restricted shell on a Linux host, and the account may run a text editor as root through sudo. What is the best way to gain a root shell?

Show the answer

Correct answerC. Spawn a shell from inside the editor, which runs as root

AWhy not this: Restricted shells block setting variables, and sudo normally resets the environment, so preloading fails.

BWhy not this: A low-privileged account cannot read root's hashes from memory, so this does not work.

CWhy this is right: The editor's built-in shell feature breaks out of the restriction, and the child shell inherits root.

DWhy not this: Hollowing a process needs code execution first, and the restricted shell does not allow it.

Many editors can launch a shell from within themselves. Because sudo runs the editor as root, the spawned shell is a root shell and also leaves the restricted shell behind. Library injection needs environment control that a restricted shell and sudo typically deny.