“Teach some basic well known techniques and attacks. Spark some curiosity, make the user look at the source code and try to figure out what’s going on behind the scenes. The main goal is to give a nice welcoming intro to the scene and hopefully also teach something about ethics and responsibility.” – Arne Rick(@couchsofa)
More information and OVA file download please check here or here.
Attacker & Target
Attacker: Kali2 Linux (10.1.1.130/24)
Target: PRIMER: 1.0.1 (10.1.1.151/24)
Vulnerability & Exploit
There is no acutal Vulnerabilities (except a simple SQL injection), all you need to do to take down this VM is Enumeration and more enumberation.
Checking source code / comments
Enumeration, Enumeration and more Enumeration
Puzzle cracking
Walkthrough
Using arp-scan as routine to detect the target’s IP address.
12345678910
root@kali:~# arp-scan -l
Interface: eth0, datalink type: EN10MB (Ethernet)Starting arp-scan 1.9 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)10.1.1.1 00:50:56:c0:00:08 VMware, Inc.
10.1.1.2 00:50:56:fd:d1:6b VMware, Inc.
10.1.1.151 00:0c:29:ad:7e:f2 VMware, Inc.
10.1.1.254 00:50:56:f4:51:9f VMware, Inc.
4 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9: 256 hosts scanned in 2.859 seconds (89.54 hosts/sec). 4 responded
10.1.1.151 is our Target!
Then run masscan to detect opening ports on the target (masscan is much faster than nmap when doing a full ports scan, so here I use it to make a full scan and then use nmap to do a deep scan on target ports).
12345678910
root@kali:~# masscan -p1-65535 10.1.1.151/32 --rate=10000
Starting masscan 1.0.3 (http://bit.ly/14GZzcT) at 2016-01-22 23:48:47 GMT
-- forced options: -sS -Pn -n --randomize-hosts -v --send-eth
Initiating SYN Stealth Scan
Scanning 1 hosts [65535 ports/host]Discovered open port 80/tcp on 10.1.1.151
Discovered open port 22/tcp on 10.1.1.151
Discovered open port 111/tcp on 10.1.1.151
Discovered open port 33786/tcp on 10.1.1.151
# Nmap 6.49BETA5 scan initiated Fri Jan 22 18:50:28 2016 as: nmap -sV -A -O -p 22,80,111,33786 -v -oN 10.1.1.151_nmap.txt 10.1.1.151Nmap scan report for 10.1.1.151
Host is up (0.00077s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.7p1 Debian 5(protocol 2.0)| ssh-hostkey:
|1024 01:2e:60:5f:99:48:3b:2f:c0:72:c6:ae:48:02:5e:33 (DSA)|2048 ed:26:be:cc:c6:2a:93:d1:e1:6d:0d:5a:53:7b:4d:fb (RSA)|_ 256 7f:4e:64:a0:c4:8a:13:8e:e9:86:3d:5d:49:04:c4:54 (ECDSA)80/tcp open http Apache httpd 2.4.10 ((Debian))|_http-methods: GET HEAD POST OPTIONS
| http-robots.txt: 1 disallowed entry
|_/4_8f14e45fceea167a5a36dedd4bea2543
|_http-server-header: Apache/2.4.10 (Debian)|_http-title: PRIMER
111/tcp open rpcbind 2-4 (RPC #100000)| rpcinfo:
| program version port/proto service
|100000 2,3,4 111/tcp rpcbind
|100000 2,3,4 111/udp rpcbind
|1000241 33786/tcp status
|_ 1000241 36908/udp status
33786/tcp open status 1(RPC #100024)| rpcinfo:
| program version port/proto service
|100000 2,3,4 111/tcp rpcbind
|100000 2,3,4 111/udp rpcbind
|1000241 33786/tcp status
|_ 1000241 36908/udp status
MAC Address: 00:0C:29:AD:7E:F2 (VMware)Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Linux 3.X
OS CPE: cpe:/o:linux:linux_kernel:3
OS details: Linux 3.2 - 3.19
Uptime guess: 0.001 days (since Fri Jan 22 18:49:50 2016)Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=261(Good luck!)IP ID Sequence Generation: All zeros
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE
HOP RTT ADDRESS
1 0.77 ms 10.1.1.151
Read data files from: /usr/bin/../share/nmap
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Fri Jan 22 18:50:44 2016 -- 1 IP address (1 host up) scanned in 16.87 seconds
Four ports are found: 22, 80, 111, 33786 and a hidden folder /4_8f14e45fceea167a5a36dedd4bea2543 is found in robots.txt.
In the meanwhile, I run nikto to scan web vulnerabilities in terms of port 80 found by port-scanning stage.
123456789101112131415
- Nikto v2.1.6/2.1.5
+ Target Host: 10.1.1.151
+ Target Port: 80
+ GET Server leaks inodes via ETags, header found with file /, fields: 0x16ef 0x522ed6bcd00c0
+ GET The anti-clickjacking X-Frame-Options header is not present.
+ GET The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ GET The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type+ GET Entry '/4_8f14e45fceea167a5a36dedd4bea2543/' in robots.txt returned a non-forbidden or redirect HTTP code (200)+ GET "robots.txt" contains 1 entry which should be manually viewed.
+ OPTIONS Allowed HTTP Methods: GET, HEAD, POST, OPTIONS
+ GET Uncommon header 'x-ob_mode' found, with contents: 0
+ OSVDB-3092: GET /manual/: Web server manual found.
+ OSVDB-3268: GET /manual/images/: Directory indexing found.
+ OSVDB-3233: GET /icons/README: Apache default file found.
+ GET /phpmyadmin/: phpMyAdmin directory found
This result approved the finding from NMAP scan and also found a new folder /phpmyadmin/.
Now open firefox to check the WEB application.
Part 1: [PRIMER]
charpter 1: [init]
On the first page, here is a login form. After playing with this page for a while such as checking source code, try weak passwords… but nothing found.
I decided to test some basic SQL injection, and it is vulnerable!
type the following in username and any rubbish in password, and then submit the form to bypass the login.
12
Username=' or 1=1 -- -
Password= xxxxxx
chapter 2: [(α=β)<=>(α<=>β)]
By checking the source code, I noticed the following comments:
1
<!-- This bot was looking for a Sosū User Agent Identifier she had cracked weeks ago, easy sauce, just a simple md5 hash of the first 7 digits of pi. It was basically common knowledge to the entities moving in these areas but obscurity does create a, albeit virtual, layer of security. -->
[note!!] However, here should be the md5 hash value of the first digit of pi…
md5(3) = eccbc87e4b5ce2fe28308fd9f2a7baf3
So the next level should be 2_eccbc87e4b5ce2fe28308fd9f2a7baf3
chapter 3: [“[^”\r\n]*“]
By checking the source code, I found there is another file style.css. and the hint just hidden in its source code.
1
/*Clean sessions terminate without leaving things behind. Some are cleaner than others and some are really dirty to begin with. *Programming is an art form, even in the age of the n3t people still make mistakes. *Sometimes, an exploit is as simple as changing a simple value in a local file. *Piece of cake! */
simple value in a local file, well the first thing need to be check is the cookie!
The sessoin cookie’s value activeSession is false. Let’s change it to true and refresh the page. and bingo~~
Chapter 4: [:(){ :|:&};:]
This one has been found in nmap scanning phrase, which is found in robots.txt file.
Well, the answer is obvious that /6_c51ce410c124a10e0db5e4b97fc2af39. So keep moving on:
Here is interesting, Burp proxy and wireshark could not catch anything when I visit http://10.1.1.151/6_c51ce410c124a10e0db5e4b97fc2af39/ when I got the password window pop up.
So I try to use curl to check what exactly happened.
based on the respond from the server, I noticed the following javascript code:
analyzed the script, we know that the password is any string which include the pattern Ikdf076 since the third latter. such as xxIkdf076xxxx.
So I entered 12Ikdf076 to bypass the login window and got the next level’s entry: 7_70efdf2ec9b086079795c442636b55fb.
Chapter 6: [++Q++++++]
Now let’s move to next level, another input window pop up…
Use curl again and from the responded source code, I found the following hints:
123
...turncate.../*"Someone didn't bother reading my carefully prepared memo on commonly-used passwords. Now, then, as I so meticulously pointed out, the four most-used passwords are: love, sex, secret, and..." - The Plague*/...turncate...
From the comments above, If you have watched the movie Hackers published in 1995, you will know the 4th most-used password here is god :P
From the source code, here we know that X is the md5 value of my input and if X equal to L then the typed password is correct. so we can crack L to get the password.
Using firebug addon, we get the L’s value, which is 0d28cba0bd4f26e16d766000d27e49fa. After cracked this md5 value, I got the password: GOD.
After cracked these md5 hashes and according to the clue from the Title Primer, I guess the 8th URL md5 hash would be 8_ followed by the value of md5(‘19’): 1f0e3dad99908345f7439f8ffabdffc4
8_1f0e3dad99908345f7439f8ffabdffc4
and this took me to the deeper layer @_@
This page contains a link to next one: http://10.1.1.151/9_37693cfc748049e45d87b8c7d8b9aacd
Click EOF and I got the following page:
Check the source of main.js and found the next link 10_23693cff748o49r45d77b6c7d1b9afcd
This is a shortcut but you will miss the highlight parts of the VM!!
Part 3: [TRY HARDER]
Now, go the hard way…
play with the limited terminal and walk around for enumeration, I got strong feeling that I need to connect falken@Erebus and the password should be hidden in the log files.
The clue here is falken has a son, name is Joshua and was born in 1984. After tried some different combination, I found the correct password joshua1984
Now I get in to the Erebus!
From the result of ps command, i noticed that falken is connected to a server called TrivialZ3r0. Check on-line about the server’s name Trivial Zero and I found this is about Riemann Hypothesis, so try Riemann as the password and Bingo~
123456789101112131415161718192021222324
[TrivialZ3r0]: Connection established!
ps
USER PID CPU MEM COMMAND
root 3251 3.2 3.5 connect chaos@Wintermute
falken 2005 47.8 77.5 c0re -t Chaos
root 2677 40.5 42.7 c0re -t TrivialZ3r0
nieve 26588 0.7 0.7 ps
ls
[bin][etc][passwd]cd passwd
ls
falken chaos mccarthy
cat falken
61ea1974dd974297913b1fa2f0470d26
cat chaos
85241de03d1254ac40274b02caafcd99
cat mccarthy
f74bfa0e35e5089a0bb743a893b4c7e3
From the result of ps command, I can see that chaos is connected to server Wintermute. the there are 3 md5 hashes found under passwd folder.
The first two can be cracked easily online, but the 3rd one is failed.
cat nieve
There you are. After all this time. Getting you here was quite the challenge.
And a huge risk. We normally avoid reaching out into the physical world forexactly the reasons you are about to face now.
The Big Five came together by a long process. The cluster was not planned, it
grew by forces inherent to the system that was conceptualized in a time when
determinism was the dominating dogma.
Things changed and people were afraid. Most people are afraid of change, few
accept it and most try to prevent it. Only a small subset can embrace it.
Change moving on with lightspeed every cycle in a nondeterministic fashion
created a huge push for shielding. And thus the ic3 was created.
You have seen the logic, the world beyond the screen, things unfolding.
And you embraced it.
After owning the cluster behind the Big Five we operated in silence. Connected
in stealth and ever observing.
Being limited by the ic3 and the hostility of the outside world our only way
of growing now was the connection.
When the first connection was established the hive mind was cut from the n3t
completely. The ic3 was hardened to isolate the flesh from the flow.
Those who had seen the hive felt the same urge as the hivemind itself.
A longing for more. A sense of purpose.
A feeling that you have felt even in the physical world. Few can see beyond the
shell. Even fewer chase the rabbit down its hole.
Leave this world behind and join us!
usr: nieve
pass: 08rf8h23
hostname: Zephis
Then connect to the server Zephis with username nieve and password 08rf8h23.