From what I understand document.cookie
only gets your cookies for the current site you are on. Would it be possible for a malicious site to get around this by using an iFrame, modifying my HTTP header, making a request to the target site or some other method?
DNS Rebinding can be used to bypass Same Origin Policy (SOP) used by browsers to prevent one web site reading other website data like cookies, dom etc
Here is a great video to learn how it works and how to prevent it.
One way to do this would be through cross-site scripting attacks. This is a short overview of how cookie-stealing works with XSS.
These techniques in general will not work. Iframes deny programmatic access to properties like page content and cookies for pages on a different domain. Likewise, Javascript HTTP requests are only allowed to the same domain as the requesting page.
-
Why do you say generally? Can this happen if I'm using an old browser or something? – Gilbo Jul 19 '10 at 3:57
-
JavaScript and HTML are standards; web browsers implement them differently and some may not pay attention to safety. However, one would be hard-pressed to find a recent release of a modern web browser without such checks in place. – Aardsquid Jul 19 '10 at 4:17