New issue
Advanced search Search tips

Issue 667142 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug-Security



Sign in to add a comment

AddressSanitizer: FPE v8/src/source-position-table.cc:37:9

Reported by r...@revskills.cz, Nov 20 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36

Steps to reproduce the problem:
Just in case you want to fix it, latest v8

What is the expected behavior?

What went wrong?
=================================================================
==3982==ERROR: AddressSanitizer: FPE on unknown address 0x03e800006ebb (pc 0x5568dd4102d6 bp 0x7fffee4a3c30 sp 0x7fffee4a3bf0 T0)
    #0 0x5568dd4102d5 in AddAndSetEntry v8/src/source-position-table.cc:37:9
    #1 0x5568dd4102d5 in v8::internal::SourcePositionTableIterator::Advance() v8/src/source-position-table.cc:178
    #2 0x5568dcacf1c5 in v8::internal::AbstractCode::SourcePosition(int) v8/src/objects.cc:14269:17
    #3 0x5568dc893717 in v8::internal::Isolate::ComputeLocation(v8::internal::MessageLocation*) v8/src/isolate.cc:1501:38
    #4 0x5568dc891066 in v8::internal::Isolate::Throw(v8::internal::Object*, v8::internal::MessageLocation*) v8/src/isolate.cc:1130:29
    #5 0x5568dc752132 in Throw<v8::internal::Object> v8/src/isolate.h:727:5
    #6 0x5568dc752132 in v8::internal::IC::TypeError(v8::internal::MessageTemplate::Template, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) v8/src/ic/ic.cc:359
    #7 0x5568dc755e97 in v8::internal::LoadIC::Load(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Name>) v8/src/ic/ic.cc:624:12
    #8 0x5568dc77e8a7 in __RT_impl_Runtime_LoadIC_Miss v8/src/ic/ic.cc:2537:5
    #9 0x5568dc77e8a7 in v8::internal::Runtime_LoadIC_Miss(int, v8::internal::Object**, v8::internal::Isolate*) v8/src/ic/ic.cc:2519
    #10 0x7fa712b043a6  (<unknown module>)
    #11 0x7fa712c04d43  (<unknown module>)
    #12 0x7fa712b5e4c2  (<unknown module>)
    #13 0x7fa712b27dc0  (<unknown module>)
    #14 0x5568dc468d84 in v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, bool, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*, v8::internal::Handle<v8::internal::Object>) v8/src/execution.cc:139:13
    #15 0x5568dc468563 in v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) v8/src/execution.cc:176:10
    #16 0x5568db60decf in v8::Script::Run(v8::Local<v8::Context>) v8/src/api.cc:1928:7
    #17 0x5568db5dbd3d in ExecuteString(v8::Isolate*, v8::Local<v8::String>, v8::Local<v8::Value>, bool, bool) v8/samples/shell.cc:353:18
    #18 0x5568db5d9f97 in RunMain(v8::Isolate*, v8::Platform*, int, char**) v8/samples/shell.cc:301:22
    #19 0x5568db5d9686 in main v8/samples/shell.cc:88:14
    #20 0x7fa8824a482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: FPE v8/src/source-position-table.cc:37:9 in AddAndSetEntry
==3982==ABORTING

Did this work before? No 

Chrome version: 54.0.2840.99  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 23.0 r0
 

Comment 1 by mea...@chromium.org, Nov 22 2016

Components: Blink>JavaScript
Labels: Needs-Feedback
Owner: rmcilroy@chromium.org
Status: Assigned (was: Unconfirmed)
Hello, do you have a reproduction case? Hard to tell what the bug is from the stack trace.

rmcilroy@: Adding you since bug 642111 is the only other bug that mentions SourcePositionTable, please reassign as necessary.
Cc: yangguo@chromium.org
Owner: vogelheim@chromium.org
Adding Vogelheim and Yang who know the source position table better than me.
Am mostly confused.

- The code in AddAndSetEntry looks harmless, so I suspect the data in the table was incorrect.
- asan reports a SIGFPE, and apparently ASAN can report signed integer overflows as FPE, and the designated line in source-position-table.cc:37 adds signed integers.
- If this addition overflows, that's indeed bad.
- Just from staring at the code, I can't find any reason why it would, though.

So without further data...  I guess I could turn the comparison (index_ == table_->length()) in SourcePositionTableIterator::Advance() into a >=. That's guessing, though, and I'd very much prefer to actually understand the problem. (Quite likely it's in how we build up the table in the first place, not when/how we read it.)


@revskills: Could you share the input with us? I notice you're running this from v8/samples/shell.cc, so presumably you already have the input as stand-along .js files.

Comment 4 by r...@revskills.cz, Nov 22 2016

I'm far away from my computer untill next week. So Unfortunately not. Browsing the source code It's what I thought. Fix seems valid to me in that case. Probably will be a good idea to apply it, I will mention it (just stacktrace) in a talk about fuzzing js engines.

Comment 5 by r...@revskills.cz, Nov 22 2016

++ this week.
A "fix" by adding a >= comparison is on its way, as discussed in #3/#4.

That fix is conservative (in that I'm sure it won't break anything) & rather speculative (in that I'm largely guessing, as I don't have enough evidence to determine the problem exactly.) I strongly suspect I'm merely fixing the symptom and that the actual bug is sometime earlier; maybe when we build up the table.


@revskills: Would be nice if you could submit a full repro case sometime later; there's certainly no hurry. Being able to reproduce this would help me fix it properly.
Project Member

Comment 7 by bugdroid1@chromium.org, Nov 23 2016

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

commit da72a3176fba32b39049d070fbd2d789bbbfe8b6
Author: vogelheim <vogelheim@chromium.org>
Date: Wed Nov 23 13:48:31 2016

Prevent read-after-buffer in SourcePositionTableIterator::Advance.

R=yangguo@chromium.org
BUG= chromium:667142 

Review-Url: https://codereview.chromium.org/2525663003
Cr-Commit-Position: refs/heads/master@{#41224}

[modify] https://crrev.com/da72a3176fba32b39049d070fbd2d789bbbfe8b6/src/source-position-table.cc

Comment 8 by r...@revskills.cz, Nov 23 2016

Thank you. Any CVE allocated? Just in case I can note 
#8: I wouldn't know; I'm just a lowly compiler writer.

meacer@, would you know?

Comment 10 by r...@revskills.cz, Nov 29 2016

Any update?, CVE,security impact and so on?. Thank you
Labels: Security_Impact-Stable Security_Severity-High
Cc: mmoroz@chromium.org mbarbe...@chromium.org infe...@chromium.org
Labels: -Security_Severity-High Security_Severity-Medium
FPE crashes are non-security bugs by default, unless there is a reason to suspect that this could cause something other than a crash. Could you elaborate on this?

Also would you mind sharing a testcase for reproducing the issue, as requested per comments #1, #3 and #6?


According to the guidelines (https://www.chromium.org/developers/severity-guidelines) it doesn't seem be high severity anyway, so I'm setting Medium for now. Please note that it is a subject to change once we get a reproducer and/or clarifications on possible exploitation.

Comment 13 by r...@revskills.cz, Nov 29 2016

I'm still out from my computer, so not so far. But based on stacktrace seems obvious there are security implications, however I'm not familiar with this code and hence not determined possible explotation ways. It is because I asked to figure out what's going on with help of a mantainer. Thank you
Project Member

Comment 14 by sheriffbot@chromium.org, Nov 29 2016

Labels: M-55
Project Member

Comment 15 by sheriffbot@chromium.org, Nov 29 2016

Labels: -Pri-2 Pri-1

Comment 16 by r...@revskills.cz, Dec 3 2016

55 is released, not mentioned this issue even with commit https://chromium.googlesource.com/v8/v8/+/da72a3176fba32b39049d070fbd2d789bbbfe8b6
Not surprising, given that this issue is not even confirmed to be one yet.

Comment 18 by r...@revskills.cz, Dec 3 2016

 Ok, feel free to close it.
Still very interested in your repro though!
Project Member

Comment 20 by sheriffbot@chromium.org, Dec 7 2016

vogelheim: Uh oh! This issue still open and hasn't been updated in the last 14 days. This is a serious vulnerability, and we want to ensure that there's progress. Could you please leave an update with the current status and any potential blockers?

If you're not the right owner for this issue, could you please remove yourself as soon as possible or help us find the right one?

If the issue is fixed or you can't reproduce it, please close the bug. If you've started working on a fix, please set the status to Started.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: vogelheim@chromium.org
Labels: -Pri-1 Pri-2
Owner: awhalley@chromium.org
Status: Fixed (was: Assigned)
Status as of today:

- Fix went into master branch on Nov 23rd.
- I did not back merge.
- As Nov 23rd was just a few days *after* the M56 branch cut, it will ship in M57 first.
- The information is still rather incomplete. From what I'm seeing I would guess security impact to be low; but I'm not particularly qualified to assess that.
- Since the fix is based on guesswork, it's quite conceivable the real bug is still out there, but I don't really have any leads.

Given the above, I'll close as 'fixed'.


@awhalley: Could you take a quick look on whether I mis-judged? If so, please re-open.
Project Member

Comment 22 by sheriffbot@chromium.org, Dec 19 2016

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Labels: reward-topanel
Project Member

Comment 24 by sheriffbot@chromium.org, Dec 21 2016

Labels: Merge-Request-56

Comment 25 by dimu@chromium.org, Dec 21 2016

Labels: -Merge-Request-56 Merge-Approved-56 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M56 (branch: 2924)
Project Member

Comment 26 by sheriffbot@chromium.org, Dec 26 2016

This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

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

Comment 27 by r...@revskills.cz, Dec 28 2016

To be fair this is a Medium security vulnerability. I am not interested in any reward, so you can remove 'reward-topanel' label.  
Project Member

Comment 28 by bugdroid1@chromium.org, Jan 2 2017

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

commit 31b99bba343bd71c24e1e70440800488ff57b679
Author: Daniel Vogelheim <vogelheim@chromium.org>
Date: Mon Jan 02 12:15:57 2017

Merged: Prevent read-after-buffer in SourcePositionTableIterator::Advance.

Revision: da72a3176fba32b39049d070fbd2d789bbbfe8b6

BUG= chromium:667142 
LOG=N
NOTRY=true
NOPRESUBMIT=true
NOTREECHECKS=true
R=marja@chromium.org, hablich@chromium.org

Review-Url: https://codereview.chromium.org/2608123002 .
Cr-Commit-Position: refs/branch-heads/5.6@{#62}
Cr-Branched-From: bdd3886218dfe76e8560eb8a18401942452ae859-refs/heads/5.6.326@{#1}
Cr-Branched-From: 879f6599eee6e1dfcbe9a24bf688b261c03e9558-refs/heads/master@{#41014}

[modify] https://crrev.com/31b99bba343bd71c24e1e70440800488ff57b679/src/source-position-table.cc

Labels: -Merge-Approved-56
Labels: -Hotlist-Merge-Approved
Labels: -reward-topanel reward-0
I'm afraid the panel declined to reward for this, but would reconsider if you're able to provide a reproduction that shows how the crash could be security relevant.  Thanks for the report!

Comment 32 by r...@revskills.cz, Jan 12 2017

as per comment #27 "I am not interested in any reward, so you can remove 'reward-topanel' label." 

Cheers
Ah, sorry, I didn't spot that!  For future reference, if you decline a reward we'll happily double it and donate it to a charity of your choosing :-)
Labels: Release-0-M56
Project Member

Comment 35 by sheriffbot@chromium.org, Mar 28 2017

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

Sign in to add a comment