Admins connected a debug interface to our Roflscale DB. They didn’t bother to secure it with a password, so we put in a proxy instead.
The main idea of this challenge is the misconfig between urlparse python and REQUEST_PATH of sinatra ruby, so if we input the payload which can bypass filter ‘dump’ python and pass to ruby web server, we got the flag.
The proxy.py takes the url, unquote and parse it, then checks if the path contains string ‘dump’ -> GTFO, else unparse to newurl and pass it to ruby web server
In ruby web server, if the REQUEST_PATH end with ‘/dump’ it will read the flag for us
After several hours testing, i figured that urlparse has param, but sinatra not!
params = bbb
path = /aaa;bbb
The only problem now is that REQUEST_PATH requires ‘/dump’ , not ‘dump’, if we put this to urlparse, it will treat ‘/dump’ as path, not params.
Double encode it solved the problem
Our final payload: