# Ninja Sec Challenge

![](https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FJbyJ3fbhLUy6sdAiUeUC%2Fninja.jpg?alt=media\&token=25b5ee24-0de0-458b-a252-93f02828cbcc)

This is a old, but funny puzzle that I've solved many years ago :smile:

### 1. Introduction

![ASCII Number Pairs](https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2Fdj7SbLvaxLyeMWQ4caar%2Fchallenge.jpg?alt=media\&token=10c15656-1d0d-4100-87f5-cd83067758d7)

My first thought was that those number pairs could be a hint to the ASCII Table. I did a short check with the first 4 Numbers and I get **http**. It looks like a URL!

![](https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2F4u2pQSqdNw7lfdgGoDic%2Fascii_check.jpg?alt=media\&token=1e441630-87ad-401e-9d3e-c180fe93a023)

I use a typical web based [ASCII to text converter](http://www.unit-conversion.info/texttools/ascii/) and I got this URL from the number pairs: ~~<http://dl.dropbox.com/u/10761700/{challenge.zip,challenge.bz2,admin.txt}>~~

The dropbox link contains the following files:

* **challenge.zip** - There is one txt file inside, but it’s protected with a password
* **challenge.bz2** – There is a binary file inside called challenge, but without file extension&#x20;
* **admin.txt** – It looks like a password list

Download files:

{% file src="<https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FPFmqPmgWrcwsf3JidXNl%2Fchallenge.zip?alt=media&token=8f04531c-6cbf-4635-b14a-b7418d65a7a7>" %}

{% file src="<https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FWErOjgnBPWTuekQG4Yj1%2Fchallenge.bz2?alt=media&token=c4a819ff-45d1-416f-9d6c-16a89f902b62>" %}

{% file src="<https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FBNMbdN4o8al1NlqbWZko%2Fadmin.txt?alt=media&token=341b4926-480e-456a-96d3-7e7cc6720d1c>" %}

### 2. Solving the puzzle

My next idea was that one of the words inside the admin.txt file could be the password for the protected zip file! I did try a dictionary attack with the wordlist file admin.txt against the file challenge.zip, but it didn't succeed.

`fcrackzip -v -D -p /pentest/passwords/wordlists/admin.txt /target/challenge.zip`

![](https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2F7OarLkfx84o6GDI4hwux%2Ffcrack.jpg?alt=media\&token=4eb549c2-feab-446a-b042-3aa46fd2756b)

I did open the file challenge with a hexeditor and in the end of the file there was a hint:

![](https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FPFXq87qNDAE8wxKxabgE%2Fhexedit.jpg?alt=media\&token=0b37777f-0865-4a8f-9a62-f576ba13a964)

**You have to look for the Disk-ID on freedb.org**

As we can read in the FAQ of [freedb.org](http://freedb.org), freedb is a database to look up CD information using the Internet. Because of that information I did try the file extension mp3 and wav. The file extension mp3 did not work, but with the file extension wav it was possible to play the file with an 11 Second sequence of a sound track. But who is the artist of that song and how can I find out that Disk-ID?

First I had to check if the file extension is correct, because it was a coincidence that wav work.&#x20;

A friend of me told me about a program called [TrID](http://mark0.net/soft-tridnet-e.html) which scans unknown binary files of their file extensions. I've tried it out and I got the file extension AIFF.

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FSqP8tTbeEC8a0f2gbKek%2Ftrid.jpg?alt=media&#x26;token=a5c1afce-462c-4dda-b154-7cd3392a8293" alt=""></div>

I tried out different tools to identify the soundtrack, but none them get me the song back! I also tried [shazam](https://www.shazam.com/de/home) which is a powerful tool to identify songs and I had success with it.

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2F9fczFNEcAEy2pn2T3JFm%2Fshazam_result.jpg?alt=media&#x26;token=c5e120e2-4c04-438a-ae6e-0235fc428efb" alt=""></div>

Let’s check the Database of freedb.org and let’s see what we get!

![](https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FdtV6naXfzUhHzmQ9dov3%2Fdisc_id.jpg?alt=media\&token=21e63e6e-65f7-4aee-b70d-1498d6814dc6)

Disc ID: **1603eb03**

The disc ID **1603eb03** was the password for the zip archive and i could successful extract the file challenge.txt!

And now let’s see what we have:

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FSjj3xxC4vBypEI8gJOBP%2Fhexcode.jpg?alt=media&#x26;token=1a8ae31d-2ba6-4013-af75-513430a81958" alt=""></div>

Ok, this looks like typical hexcode. To fnd it out i use a typical [hex to text converter](http://www.string-functions.com/hex-string.aspx) tool.

The decoded string is BASE64! A typical Sign for that are the **two ==** at the end of the string. For more information about BASE64 or other Crypto Codes visit the website [cryptool-online](http://www.cryptool-online.org/index.php?option=com_content\&view=article\&id=110\&Itemid=133\&lang=de).

![](https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2F2NZGl2kj0Zldqmqbmy8j%2Fbase64.jpg?alt=media\&token=a7722dc9-fcca-4d4b-95e7-8bb819a01da5)

Ok, and now let’s [decode](http://floern.com/tools/textencoder) the BASE64 String.

![](https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FrmHW5tYNbgRsXCYEpiia%2Fobfuscated_js.jpg?alt=media\&token=019af390-3827-4d21-8b1b-e0a506a9c47c)

What the heck is this?\
It could be encrypted Javascript Code, but I’m not sure. A quick research in google shows me that it is Javascript and this technique is often used in malicious Websites.

For the further analysis and Decryption I used a Tool called Revelo. I discovered that tool on a nice [Security Blog](https://www.kahusecurity.com/posts/another_revelo_update.html) and I run it in a virtual Windows XP Machine.

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FTV8cN7U1oYp80Up6FtNe%2Frevelo01.jpg?alt=media&#x26;token=493fb626-b611-47d9-ac76-1592fc7c744a" alt=""></div>

As we can see, our next Destination is ~~<http://www.ethical-intrusion.com/index.php>~~

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FTK1ckHtQMNvmYKbiVR2l%2Frevelo02.jpg?alt=media&#x26;token=df16acbb-1825-4121-8d29-66be01771eab" alt=""></div>

Now we have a Login Form where we have to enter a valid username/password combination. I start a **dictionary attack** with the passwords from the file admin.txt. Because of the filename I used for all passwords the username **admin**.

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FVZOUKdBBuzEnwzgOvcVk%2Fbrut01.jpg?alt=media&#x26;token=d8cf1a33-c8a3-41a9-9491-2778ea6e7c32" alt=""></div>

For the bruteforce attack I've used a Browser Plugin called [~~Fireforce~~](http://www.scrt.ch/en/attack/downloads/fireforce). It’s important that Fireforce need the textstring: “The username/password combination you have entered is invalid” to\
successful identify the correct password.

![](https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FLVNRKqclxFHh6q6HZ4YF%2Fbrut02.jpg?alt=media\&token=4b61c1ac-8690-4dc0-bb14-47d7cac34ddb)

![](https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FfgG9QoVKdktkEFKtN1Ms%2Fbrut03.jpg?alt=media\&token=e500fc99-3934-44e8-b38e-e250e6025ea6)

After a while I got a valid username / password combination

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FXBKehyVgFry6ZYKrM3qd%2Fbrut04.jpg?alt=media&#x26;token=fb131649-0f4e-4b51-9eb4-dd15470220ea" alt=""></div>

Password found: **m0use456g**

With the discovered username/password combination I could enter the website. I can see 2 Links and one of them shows me a youtube video. I did click on play but I couldn’t understand a word because the audio seems to be reverted!

![](https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FBiS3kNTonO9VfMQaZgsq%2Fyt01.jpg?alt=media\&token=6eb19b10-6ee1-42d2-9515-0e621d38b09a)

I did convert the youtube video to an mp3 file and with the software [audacity](http://audacity.sourceforge.net/?lang=de) I could edit the audiofile to a clear voice:

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FgHLeFe09dNLRsVyNDHyM%2Fauda.jpg?alt=media&#x26;token=1b6c1bbd-7451-4003-bb34-8be52b13e86c" alt=""></div>

Congratulations, you’ve discovered the website and now listen carefully you have to go to\
**directory a98dhkjd**.

Going to ~~<http://www.ethical-intrusion.com/a98dhkjd>~~ shows me a **htaccess protected** Director&#x79;**:**

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FZu7mOSXDpOqMpOhmgdfJ%2Fhtaccess.jpg?alt=media&#x26;token=9256d063-537e-41b6-ad66-248a84dd763c" alt=""></div>

Now let’s go back to the first Login page and let’s analyse the Links:\
News1 is linked with: <http://ethical-intrusion.com/index.php?news=news1.html\\>
News2 is linked with: <http://ethical-intrusion.com/index.php?news=news2.html>

What we can see is that in both links a separate html file is loaded and displayed into the file index.php! I don’t have much experience in web vulnerabilities, but a [technique](http://kaoticcreations.blogspot.ch/2011/08/automated-lfirfi-scanning-exploiting.html) called **local file inclusion** exists for Links like this to gain access to protected files and directories.

I have used more than one try, but it was possible to read out successful the htpasswd file with a valid username and password to solve this challenge!

~~**<http://ethical-intrusion.com/index.php?news=a98dhkjd/.htaccess>**~~

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FBryAMdOItWGF0VAVDyZZ%2Fhtaccess2.jpg?alt=media&#x26;token=7cf5dab9-99a3-44c9-9589-60fdbcde15ad" alt=""></div>

~~<http://ethical-intrusion.com/index.php?news=a98dhkjd/.htpasswd>~~

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FDZo98MZ6GGuRgibqDzcb%2Fhtaccess3.jpg?alt=media&#x26;token=9e31b918-216c-4251-96a6-9a6a275fac16" alt=""></div>

Username: pilou Password: there1s

<div align="left"><img src="https://3977837039-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfT0VPyK6X13Egd9pzy%2Fuploads%2FW5kzQnsNxn0gnU8aWCO0%2Fdone.jpg?alt=media&#x26;token=653d224f-1e3d-4c01-b0ca-ceb513631deb" alt=""></div>
