New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
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
link

Issue 136881: 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

Comment 1 by infe...@chromium.org, Jul 11 2012

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 ?

Comment 2 by michaeln@chromium.org, Jul 11 2012

Is this a newly introduced bug or are you just now are noticing something that's been around for a while?

Comment 3 by infe...@chromium.org, Jul 11 2012

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 :|)

Comment 5 by infe...@chromium.org, Jul 12 2012

Labels: SecImpacts-Stable SecImpacts-Beta Mstone-20
Thanks miaubiz.

Comment 6 by infe...@chromium.org, Aug 1 2012

Labels: -Mstone-20 Mstone-21

Comment 7 by michaeln@chromium.org, Aug 1 2012

gah... i had lost track of this one!

Comment 8 by infe...@chromium.org, Aug 2 2012

Labels: Security-CodeYellow
Please do read Mark's email titled "Code Yellow: Security Bug Backlog" on chrome-team mailing list.

Comment 9 by michaeln@chromium.org, Aug 2 2012

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

Comment 10 by michaeln@chromium.org, Aug 2 2012

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

Comment 11 by michaeln@chromium.org, Aug 3 2012

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.

Comment 12 by michaeln@chromium.org, Aug 3 2012

Patch out for review in webkit-land...
https://bugs.webkit.org/show_bug.cgi?id=93158

Comment 13 by michaeln@chromium.org, Aug 3 2012

I guess we'll want to patch that in to the release branch after its committed.

Comment 14 by infe...@chromium.org, Aug 4 2012

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify Merge-Approved
Status: FixUnreleased
http://trac.webkit.org/changeset/124682

Comment 15 by michaeln@chromium.org, Aug 7 2012

per a chat with inferno, leaving any merging to be done to others

Comment 16 by scarybea...@gmail.com, Aug 16 2012

Labels: reward-topanel

Comment 17 by scarybea...@gmail.com, Aug 20 2012

Labels: -reward-topanel reward-500 reward-unpaid
Thanks miaubiz. Race condition => $500

Comment 18 by scarybea...@gmail.com, Aug 24 2012

Labels: -Merge-Approved Merge-Merged
M21: http://trac.webkit.org/changeset/126646

Comment 19 by scarybea...@gmail.com, Aug 29 2012

Labels: CVE-2012-2868

Comment 20 by scarybea...@gmail.com, Sep 12 2012

Labels: -reward-unpaid

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

Project Member
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.

Comment 22 by jsc...@chromium.org, Dec 20 2012

Status: Fixed

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

Project Member
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.

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

Project Member
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

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

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

Comment 26 by scarybea...@gmail.com, Mar 21 2013

Labels: -Restrict-View-SecurityNotify -Restrict-View-EditIssue

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

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

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

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

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

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

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

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

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

Project Member
Labels: -Cr-Content Cr-Blink

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

Project Member
Labels: -security_impact-beta

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

Project Member
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

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

Project Member
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

Comment 35 by mbarbe...@chromium.org, Oct 2 2016

Labels: allpublic

Comment 36 by awhalley@chromium.org, Apr 25 2018

Labels: CVE_description-submitted

Sign in to add a comment