Indeed. Why didn't I even think of that ? I must have been tired when I asked...
After some tests, it seems that you can even access the cookie data from a file that does not exist or is forbidden. Ie. loading in the iframe with
- Code: Select all
src="/mypath/secret/noSuchFile.htm"
will allow to access the cookies with path "/mypath/secret", even if noSuchFile.htm does not exist (404), except in IE 8.
An iframe with
- Code: Select all
src="/mypath/secret"
even if directory listing is forbidden (403), will allow access to the "restricted" cookies, in IE8, FF3.5 and Opera 10.10...
I fear web developers may not be well aware of the issue, as the best link I could find for "cookie path safe" was this one
http://www.net-security.org/article.php?id=704, which recommends to always setting an explicit path on cookies as if it would make them safe, without mentioning the issue at all... Admittedly, the paper was written in 2004, but still...