Basic missions

Posted by Marcus - October 27, 2015

Tutorial for all basic missions at hackthissite.org

Level 1

This time Sam hardcoded his password into the source code.
Check source code: "password is ac685267"

Level 2

Sam now makes a file to compare the password with but he forgets to upload the file. 
No password to compare with, simply clicking "Submit" will work.

Level 3

This time Sam has made a php file to check the password with. 
Check source code and search for "password.php" to see. 
Then go to the php to get the password: 43652d49

Level 4 

Sam now creates a script for sending the password to his email address. 
Simply copy the source code, change "sam@hackthissite.org" to own mail, save as .html and run page. Click "Send password to Sam" and you will get an email with b6686970

Level 5

Sam is a smart guy so he decides to make the script check the HTTP headers to see where you are viewing the page from. It will give an error if the referred url is not /missions/basic/5/ or /missions/basic/5/index.php
Use Ctrl+Shift+J to open chrome dev tools
Write in console:

javascript:alert(document.forms[0].to.value="your_email_address");

This changes Sam's email address to your own.
Send email and you will get: 2463ca33

Level 6

This time Sam encrypted his password. We will try to decrypt it.
Input "abcdefg" returns "acegikm" which is the same, but shifted to the right in the same pattern as the numbers below
Input "123" returns "135", so 1, 2+1, 3+2 and so forth

For reference: abcdefghijklmnopqrstuvxyzæøå

Thus ab736hh8 decrypts in the following way

a -> a (a-0)
b -> a (b-1)
7 -> 5 (7-2)
3 -> 0 (3-3)
6 -> 2 (6-4)
h -> c (h-5)
h -> b (h-6)
8 -> 1 (8-7)

Password is aa502cb1

Level 7

Sam keeps going and now he saves the unencrypted password somewhere in the site directory.
Quite conveniently he also made a script that returns the output from the UNIX cal (calendar) command. However, it is possible to send other commands than year, for example showing the contents of the folder.
In unix this is done by writing 2012;ls

Go to the bottom of the page where multiple php files are listed

  • cal.pl
  • index.php
  • k1kh31b1n55h.php
  • level7.php

Go to k1kh31b1n55h.php which returns 93ca2e97

Level 8

Sam's hot piece of ass daughter, Stephanie, wrote some php to save files. What to do?
The hint states: Requirements: Knowledge of SSI (dynamic html executed by the server, rather than the browser)

Look up SSI dynamic html and search for the command syntax.
Writing, for example,

#element attribute=value attribute=value ... 

will return a message saying we are on the right track.
What we really want, however, is to see the available php files on the server.

#exec cmd="ls ../" 

which, amongst others, return
au12ha39vc.php

Go to au12ha39vc.php
11941bf8

Level 9

Kinda the same. Go back to level 8 and write

#exec cmd="ls /var/www/hackthissite.org/html/missions/basic/9/"

to see what's in the level 9 folder.
This returns p91e283zc3.php

Go to p91e283zc3.php
6b149c41

Level 10

This time we get no hints, so what to do ?
Use Ctrl+Shift+J to open chrome dev tools. We then check for cookies ! 

Resources -> Cookies -> level10_authorized: no

This means that Sam uses cookies based authentication.
To change cookies on a website, the language I would use is javascript

To see the cookies for a website, we can also write the following in the (dev chrome) console

document.cookie;

which return

"level10_authorized=no; PHPSESSID=qcn26nackv028ne0pk0n11ig85; bm_monthly_unique=true; bm_daily_unique=true; bm_sample_frequency=1; style_cookie=null; __utma=198402870.885838646.1441145854.1441212962.1441224009.4; __utmc=198402870; __utmz=198402870.1441145854.1.1.utmcsr=duckduckgo.com|utmccn=(referral)|utmcmd=referral|utmcct=/; bm_last_load_status=BLOCKING"

We notice the "level10_authorized=no" line. We need to change this using JS.

document.cookie="level10_authorized=yes; PHPSESSID=qcn26nackv028ne0pk0n11ig85; bm_monthly_unique=true; bm_daily_unique=true; bm_sample_frequency=1; style_cookie=null; __utma=198402870.885838646.1441145854.1441212962.1441224009.4; __utmc=198402870; __utmz=198402870.1441145854.1.1.utmcsr=duckduckgo.com|utmccn=(referral)|utmcmd=referral|utmcct=/; bm_last_load_status=BLOCKING"

Now the cookie says "level10_authorized=yes" and we can click submit (with empty password field)

Level 11

"I love my music! "All the Girls Love Alice" is the best!", that's weird, right?
We check the source code for a hint

We even have our own collection - if you could find it!

Each time we refresh the page, a new song title is present.
I remembered from nibbleblog that you access stuff through php
trying index.php
results in a password input form.

and now.. when the night comes, randomness calls.

I cheated for this part

Googling the names I see that they are made by Elton John. "Guessing" that songs are probably indexed by artist names, like so /e/l/t/o/n/, we can access a seemingly empty page.

This apache server has it's htaccess file lying at this point (for some reason we are supposed to figure this out)

Which return

IndexIgnore DaAnswer.* .htaccess

order allow,deny
allow from all

This tells us that there is a file called DaAnswer which might contain the answer (see what I did there, lol).
We then try to access DaAnswer

which returns

"The answer is not here! Just look a little harder."

Go back to the password form

and enter "not here".

That's all folks!