Nafeez Software Security Engineer Defending & building secure stuff is more fun. Been talking about stuff that break the web @ BlackHat, HITB, Nullcon, C0c0n
How does a web based proxy work? 1. User requests site.com inside the Web Proxy page. 2. The Proxy downloads the web content and pushes its own HTML alongside the downloaded content. 3. User finally gets to see site.com under the Web Proxy page.
Proxy Hot-linking This feature is like the achilles-heel of any web proxy security. If any website can directly get themselves being IFRAMED + Proxied by a web proxy then attacks like the SOP bypass and other attacks are easily possible.
The bypass Just add the whitelisted name to the path of your referrer. Just do a location.reload() from, http://attacker.com/localhost/ http://attacker.com/whitelisted-domain/
Practical aspects What if the target website prevents IFraming using X-Frame-options and other such security headers? What if the target website has set httpOnly cookies?
Unsafe response rewrites Messing around with secure response headers like X- Frame-Options, X-XSS-Protection, Content- Security-Policy, HSTS Those headers won’t be re-written back to the user’s browser in the response.
Cookie Jars on Proxy Proxies under-estimate the complexity of Cookie management. Things like various cookie flags, handling of secure channels, limit of cookies with the same name, cookie folding, cookie SOP etc
How not to write JS filters var inputHTML = ""; function doTemplating(){ var input = document.getElementById('id_input').value; input = filterInput(input); var finalHTML = inputHTML.replace("PLACEHOLDER", input); console.log(finalHTML); document.write('Your input: ' + input); document.write(finalHTML); }
Little bit of the new ECMAScript features helps as well! Overriding and Freezing DOM properties using ES5 Object locking mechanisms to completely subvert any defences placed by the proxied website against Proxy based attacks.
Proxies should adopt CSP to enforce real anonymity. Content security policy helps extensively in locking down proxy based attacks, since its enforced by the browser.