Why can a site (a.com) having an iframe to another domain (b.com) have its cookie viewed and changed by that other domain document?
Just saw this happening in an Ad, and went to do a proof of concept, and it worked... here's what i did: first, pointed a.com and b.com to my test machine IP.
then i have: http://a.com/a.html (this would be the site where i saw the ad)
<html><body><script src="http://b.com/b.js"></script>
http://b.com/b.js (this would be the ad script inserted inline in the site, pointing to the advertiser company domain)
document.write('<iframe src="http://b.com/b.html"></iframe>');
<html><body><script>document.cookie = "test=1;domain=.a.com;path=/;expires=Tue, 30 Oct 2012 02:47:11 UTC";</script></body></html>
and after i run that, in firefox 14 stock, i have a cookie in a.com.
what governs that? where is this behavior defined?
b.js
could just set cookie itself without an iframe? Directly via justdocument.cookie = "test=1;domain=.a.com;path=/;expires=Tue, 11 Jan 2032 02:47:11 UTC";
– Vu