New issue
Advanced search Search tips

Issue 782145 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , iOS , Chrome , Mac , Fuchsia
Pri: 1
Type: Bug-Security



Sign in to add a comment

Security:V8:Type Confusion Leads To OOB Read Write

Reported by soulchen...@gmail.com, Nov 7 2017

Issue description

VULNERABILITY DETAILS
There is a type confusion problem in the String.prototype.replace runtime call.If we change the RegExp type(from fast regexp to slow regexp),we will also go to the fast regexp code path.At last,this will cause OOB Read Write of the lastIndex.

VERSION
Chrome Version: 62.0.3202.89 Stable 64 bit
Operating System:  Windows 10 1703 64bit

REPRODUCTION CASE
In the zip file |poc_11_7.zip|,pass is :dabaodabao222
In the debug build,it will crash in CSA_ASSERT(this, IsFastRegExp(context, regexp)) of the function TF_BUILTIN(RegExpReplace, RegExpBuiltinsAssembler);
In the release build,it will crash in the address 0x300000008,and please note that,this addresss we can control it through control the lastIndex value.

 
poc_11_7.zip
434 bytes Download
The patch is very simple,we must generate the code with |BranchIfFastRegExp| after the callback.
Cc: jgruber@chromium.org
Components: Blink>JavaScript
This sounds somewhat similar to  Issue 708247  which was fixed in July.
Labels: ReleaseBlock-Stable Security_Severity-High
Owner: hablich@chromium.org
To V8 triage sheriff.
Cc: -jgruber@chromium.org bmeu...@chromium.org yangguo@chromium.org hablich@chromium.org
Labels: Pri-1
Owner: jgruber@chromium.org
Status: Started (was: Unconfirmed)
Thanks for the report. #2 is correct, this has the same root cause.

We do the fast path check, then the ToString operation which can end up in user-controlled JS and perform arbitrary changes on the regexp instance.

This affects String.p.{match,replace,search,split}. I'm working on a fix. 
Project Member

Comment 5 by bugdroid1@chromium.org, Nov 8 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/55a98076827edac8eba775f8025df3749bcd8367

commit 55a98076827edac8eba775f8025df3749bcd8367
Author: jgruber <jgruber@chromium.org>
Date: Wed Nov 08 09:49:33 2017

[string] Fix regexp fast path in MaybeCallFunctionAtSymbol

The regexp fast path in MaybeCallFunctionAtSymbol had an issue in which
we'd call ToString after checking that the given {object} was a fast
regexp and deciding to take the fast path. This is invalid since
ToString() can call into user-controlled JS and may mutate {object}.

There's no way to place the ToString call correctly in this instance:
1 before BranchIfFastRegExp, it's a spec violation if we end up on the
  slow regexp path;
2 the problem with the current location is already described above;
3 and we can't place it into the fast-path regexp builtin (e.g.
  RegExpReplace) either due to the same reasons as 1.

The solution in this CL is to restrict the fast path to string
arguments only, i.e. cases where ToString would be a nop and can safely
be skipped.

Bug:  chromium:782145 
Change-Id: Ifd35b3a9a6cf2e77c96cb860a8ec98eaec35aa85
Reviewed-on: https://chromium-review.googlesource.com/758257
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49213}
[modify] https://crrev.com/55a98076827edac8eba775f8025df3749bcd8367/src/builtins/builtins-string-gen.cc
[modify] https://crrev.com/55a98076827edac8eba775f8025df3749bcd8367/src/builtins/builtins-string-gen.h
[add] https://crrev.com/55a98076827edac8eba775f8025df3749bcd8367/test/mjsunit/regress/regress-782145.js

Labels: Merge-Request-64 Merge-Request-63
Project Member

Comment 7 by sheriffbot@chromium.org, Nov 8 2017

Labels: -Merge-Request-64 Hotlist-Merge-Review Merge-Review-64
This bug requires manual review: We don't branch M64 until 2017-11-30.
Please contact the milestone owner if you have questions.
Owners: cmasso@(Android), cmasso@(iOS), kbleicher@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Hotlist-Merge-Review -Merge-Review-64 Merge-Request-62
Sorry, Merge-Request-64 should've been for 62, fixing labels. Canary coverage should be coming tonight.
Project Member

Comment 9 by sheriffbot@chromium.org, Nov 8 2017

Status: Fixed (was: Started)
Please mark security bugs as fixed as soon as the fix lands, and before requesting merges. This update is based on the merge- labels applied to this issue. Please reopen if this update was incorrect.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Please mark this with appropriate OS labels.

M62 is already being ramped-up. If this is not an absolutely critical P0 bug, then fix should be targeted for M63. 
Labels: OS-Android OS-Chrome OS-Fuchsia OS-iOS OS-Linux OS-Mac OS-Windows
Project Member

Comment 12 by sheriffbot@chromium.org, Nov 8 2017

Labels: -Merge-Request-63 Merge-Review-63 Hotlist-Merge-Review
This bug requires manual review: Less than 23 days to go before AppStore submit on M63
Please contact the milestone owner if you have questions.
Owners: cmasso@(Android), cmasso@(iOS), gkihumba@(ChromeOS), govind@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: awhalley@chromium.org
+awhalley@ for merge review
Project Member

Comment 14 by sheriffbot@chromium.org, Nov 9 2017

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
govind@ - good for 63
Labels: -Merge-Review-63 Merge-Approved-63
Approving merge to M63 branch 3239 based on comment #15. Please merge ASAP. Thank you.
Labels: -Merge-Request-62 Merge-Approved-62
This has a high security impact and thus should be merged to 62 too.
Labels: M-62
awhalley@ do you have any clue why there is no milestone label applied by security triage anymore?
Project Member

Comment 20 by bugdroid1@chromium.org, Nov 10 2017

Labels: merge-merged-6.2
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/cfc3404fa89957994efd8d1f614dd06f8e075ccf

commit cfc3404fa89957994efd8d1f614dd06f8e075ccf
Author: jgruber <jgruber@chromium.org>
Date: Fri Nov 10 08:33:08 2017

Merged: [string] Fix regexp fast path in MaybeCallFunctionAtSymbol

The regexp fast path in MaybeCallFunctionAtSymbol had an issue in which
we'd call ToString after checking that the given {object} was a fast
regexp and deciding to take the fast path. This is invalid since
ToString() can call into user-controlled JS and may mutate {object}.

There's no way to place the ToString call correctly in this instance:
1 before BranchIfFastRegExp, it's a spec violation if we end up on the
  slow regexp path;
2 the problem with the current location is already described above;
3 and we can't place it into the fast-path regexp builtin (e.g.
  RegExpReplace) either due to the same reasons as 1.

The solution in this CL is to restrict the fast path to string
arguments only, i.e. cases where ToString would be a nop and can safely
be skipped.

NOTRY=true
NOPRESUBMIT=true
NOTREECHECKS=true
TBR=yangguo@chromium.org

Bug:  chromium:782145 
Change-Id: Ifd35b3a9a6cf2e77c96cb860a8ec98eaec35aa85
Reviewed-on: https://chromium-review.googlesource.com/763207
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/branch-heads/6.2@{#88}
Cr-Branched-From: efa2ac4129d30c7c72e84c16af3d20b44829f990-refs/heads/6.2.414@{#1}
Cr-Branched-From: a861ebb762a60bf5cc2a274faee3620abfb06311-refs/heads/master@{#47693}
[modify] https://crrev.com/cfc3404fa89957994efd8d1f614dd06f8e075ccf/src/builtins/builtins-string-gen.cc
[modify] https://crrev.com/cfc3404fa89957994efd8d1f614dd06f8e075ccf/src/builtins/builtins-string-gen.h
[add] https://crrev.com/cfc3404fa89957994efd8d1f614dd06f8e075ccf/test/mjsunit/regress/regress-782145.js

Project Member

Comment 21 by bugdroid1@chromium.org, Nov 10 2017

Labels: merge-merged-6.3
The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/a3b2981a1fde72df6594a790dfb76475492f5da1

commit a3b2981a1fde72df6594a790dfb76475492f5da1
Author: jgruber <jgruber@chromium.org>
Date: Fri Nov 10 08:46:58 2017

Merged: [string] Fix regexp fast path in MaybeCallFunctionAtSymbol

The regexp fast path in MaybeCallFunctionAtSymbol had an issue in which
we'd call ToString after checking that the given {object} was a fast
regexp and deciding to take the fast path. This is invalid since
ToString() can call into user-controlled JS and may mutate {object}.

There's no way to place the ToString call correctly in this instance:
1 before BranchIfFastRegExp, it's a spec violation if we end up on the
  slow regexp path;
2 the problem with the current location is already described above;
3 and we can't place it into the fast-path regexp builtin (e.g.
  RegExpReplace) either due to the same reasons as 1.

The solution in this CL is to restrict the fast path to string
arguments only, i.e. cases where ToString would be a nop and can safely
be skipped.

NOTRY=true
NOPRESUBMIT=true
NOTREECHECKS=true
TBR=yangguo@chromium.org

Bug:  chromium:782145 
Change-Id: Id61611a767f3dc871b47403147818707686c46d1
Reviewed-on: https://chromium-review.googlesource.com/763208
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/branch-heads/6.3@{#59}
Cr-Branched-From: 094a7c93dcdcd921de3883ba4674b7e1a0feffbe-refs/heads/6.3.292@{#1}
Cr-Branched-From: 18b8fbb528a8021e04a029e06eafee50b918bce0-refs/heads/master@{#48432}
[modify] https://crrev.com/a3b2981a1fde72df6594a790dfb76475492f5da1/src/builtins/builtins-string-gen.cc
[modify] https://crrev.com/a3b2981a1fde72df6594a790dfb76475492f5da1/src/builtins/builtins-string-gen.h
[add] https://crrev.com/a3b2981a1fde72df6594a790dfb76475492f5da1/test/mjsunit/regress/regress-782145.js

Labels: -ReleaseBlock-Stable -Merge-Approved-62 -Merge-Approved-63
Merged to 62 and 63, removing RBS. Thanks all!
hablich@ - re comment 19, no idea - they should be - will follow up!
Labels: reward-topanel

Comment 25 Deleted

Labels: -reward-topanel reward-unpaid reward-3000
*** Boilerplate reminders! ***
Please do NOT publicly disclose details until a fix has been released to all our users. Early public disclosure may cancel the provisional reward. Also, please be considerate about disclosure when the bug affects a core library that may be used by other products. Please do NOT share this information with third parties who are not directly involved in fixing the bug. Doing so may cancel the provisional reward. Please be honest if you have already disclosed anything publicly or to third parties. Lastly, we understand that some of you are not interested in money. We offer the option to donate your reward to an eligible charity. If you prefer this option, let us know and we will also match your donation - subject to our discretion. Any rewards that are unclaimed after 12 months will be donated to a charity of our choosing.
*********************************
Nice one soulchen8650@! The VRP panel decided to award $3,000 for this report!
Labels: -reward-unpaid reward-inprocess
Labels: NodeJS-Backport-Done
Node 8 (V8 6.1) backport: https://github.com/nodejs/node/pull/17354
#27:

Hello,awhalley

It seems this issue has been fixed in the stable release 63.0.3239.84:
https://chromereleases.googleblog.com/2017/12/stable-channel-update-for-desktop.html

But I can't see my acknowledgement information on it.Is that something wrong?I want to see my name on it.

Hello,

Could someone answer my question?
Re #30/#31: Andrew works in Pacific Time Zone and can respond to your question when he gets in.

My guess is that this was inadvertently overlooked for the initial M63 notes because the fix got merged all the way back to M62.
I see.

But when can this issue assign a CVE and see my acknowledgement information on the chrome release website?

Thanks
Labels: CVE-2017-15428 Security_Impact-Stable
Hi soulchen8650@ - very sorry this one fell through the cracks. This is CVE-2017-15428, and I'll update the release blog by the end of play today.
Project Member

Comment 36 by sheriffbot@chromium.org, Feb 14 2018

Labels: -Restrict-View-SecurityNotify allpublic
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 37 by sheriffbot@chromium.org, Mar 27 2018

Labels: -M-62 M-65
Labels: CVE_description-missing
Labels: -CVE_description-missing CVE_description-submitted

Sign in to add a comment