Skip to main content

SANS HOLIDAY HACK 2017 : PART 6

If you have not read the 1st Part then read it here.

http://oxhat.blogspot.in/2018/01/sans-holiday-hack-2017-part-1.html

So this part is all about exploiting machines.Each challenge will lead us to a page of the Great Book that will answer our questions to who was the actual culprit behind hurling those massive snowballs.

Challenge

8) Fetch the letter to Santa from the North Pole Elf Database at http://edb.northpolechristmastown.com. Who wrote the letter?

On doing an nmap scan on  internal network using the compromised Alabaster's system, we can find the edb server


We will connect to Alabaster's machine again and use SSH Port forwarding to port 80 to get access to the web application.


Also we will edit our hosts file to make sure we can point at edb.northpolechristmastown.com


Now we can access the application


Once we do this we can try logging with alabaster's credentials, but it doesn't work.

Looking at the intercepted requests , we see that there is a session value in the cookie. My target is to steal the session cookie of the victim and replace our session value with it.

There is a client side simulation of a victim and we need to do a phishing attack.

This is the password reset page



There is an XSS filter working , so we  need to write a XSS Filter Evasion Payload to steal the cookie


So our payload for the attack is

Now we will try to send the forged password request to the victim


On successful exploitation, we can find the cookie of the victim in our access.log

At this point I tried changing the session value with the stolen cookie value but it did not work.

The source code at the home page revealed about one more juicy information. It seems the victim is storing np-auth token in the localstorage and also it checks if it is there it sends for validation. If successful it logs into the application.

Let's modify the XSS payload to steal the np-auth token.

After successful exploitation, we find the np-auth token

Now decoding the JWT Token it reveals us some information we need to log in and also to rectify the auth to make it valid , for example the expiry date.


So let us first try cracking the np-auth token, for this we can use one jwt-cracker


The jwt-cracker reveals that the Secret used to encode JWT token is 3lv3s

Now that we have all the information we need to do the following things

1. Modify the expiry date
2. Create a new np-auth token using the secret key
3. Add the np-auth token to our local storage

We will write a small piece of code to do the 1st two task in one shot !


Executing the program gives us the jwt token for our np-auth



For the next one we will open developer console and add the javascript code to store the generated np-auth value in the localStorge


After this we refresh the page , and bingo ! We are in !


Through the proxy tool we find UI models is fetched over an XML call which is then populated in the UI of the page.

Few points to note here from the code

1. We can search "beyond" the available option of ELF and Reindeer
2. To perform operation of administrator, an administrator password will be required

Now from the debug code we can understand that there is an LDAP application running


I tried searching with a well known reindeer information , Rudolph and then using blind injection techniques tried to figure out the password fields from it , and we found there was one field called userPassword which revealed the password in hashed form



So our final target should be writing an LDAP injection query that would allow me to bypass the query and allow me to search any data whose 'ou' can be anything that is *. Also one more thing we can assume from the message box that whenever i am trying to access Santa Panel , i am getting a notification, "You must be Claus to enter the Panel"

So I am using the gn value as "Claus" and ou = * 

On doing this request with input claus*)(ou=*))(&(gn=  and  modifying the request little bit by adding the password field, I can dump all the users information with hashed passwords.
Response


Our next step is to get the original value of the hashed password of Claus which is  001cookielips001




Now if we try to login with santas email and password , it wont work. Guess why ? Because we are logged into alabaster account by setting an np-auth token, so we need to generate one more auth token with Santa's information

Once we generate a new token using the department as 'administrator' and 'ou' as * and set it, on refreshing the browser we get a prompt. We need to provide the plaintext password here which we obtained by decryption of the hashed password.


And finally we can retrieve the letter





Popular posts from this blog

KringleCon : Sans Holiday Hack 2018 Writeup

SANS HOLIDAY HACK 2018 Writeup , KRINGLECON The objectives  Orientation Challenge  Directory Browsing  de Bruijn Sequences  Data Repo Analysis  AD Privilege Discovery  Badge Manipulation  HR Incident Response  Network Traffic Forensics  Ransomware Recovery  Who Is Behind It All? First I go to Bushy Evergreen and try to solve the terminal challenge . Solving it is fairly easy , Escape_Key followed by  ":q" without quotes After this we move to the kiosk and solve the questions The question were based on the themes of previous Holiday Hack Challenges. Once we answer it correctly we get the flag. For this I visited Minty Candycane and I tried to solve the terminal challenge.  The application has command injection vulnerability , so injecting a system command with the server ip allows execution of the command. So first I perform an `ls` operation to list of the directory contents , followed by a cat of t

Linux Privilege Escalation : SUID Binaries

After my OSCP Lab days are over I decided to do a little research and learn more on Privilege Escalation as it is my weak area.So over some series of blog post I am going to share with you some information of what I have learnt so far. The methods mentioned over here are not my own. This is something what I have learnt by reading articles, blogs and solving CTFs SUID - Set User ID The binaries which has suid enabled, runs with elevated privileges. Suppose you are logged in as non root user, but this suid bit enabled binaries can run with root privileges. How does a SUID Bit enable binary looks like ? -r- s r-x---  1 hack-me-bak-cracked hack-me-bak         7160 Aug 11  2015 bak How to find all the SUID enabled binaries ? hack-me-bak2@challenge02:~$ find / -perm -u=s 2>/dev/null /bin/su /bin/fusermount /bin/umount /usr/lib/openssh/ssh-keysign /usr/lib/eject/dmcrypt-get-device /usr/lib/dbus-1.0/dbus-daemon-launch-helper /usr/bin/gpasswd /usr/bin/newgrp /usr/bin

Bluetooth Low Energy : Build, Recon,Enumerate and Attack !

Introduction In this post I will try to share some information on bluetooth low energy protocol. Bluetooth Low Energy ( BLE ) is Bluetooth 4.0.It has been widely used in creating "smart" devices like bulbs that can be controlled by mobile apps, or electrical switches that can be controlled by mobile apps. The terms Low Energy refers to multiple distinctive features that is operating on low power and lower data transfer. Code BLE Internals and Working The next thing what we need to know is a profile. Now every bluetooth device can be categorized based on certain specification which makes it easy. Here we will take a close look into two profiles of Bluetooth which is specifically designed for BLE. Generic Access Profile (GAP) - This profiles describes how two BLE devices defines discovery and establishment of connection with each other. There are two types of data payload that can be used. The Advertising Data Payload and Scan Response Payload . The GAP uses br