New issue
Advanced search Search tips

Issue 880173 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 20
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 1
Type: Bug-Security



Sign in to add a comment

heap use-after-free on AsyncCompileJob::CompileTask::Cancel

Reported by cdsrc2...@gmail.com, Sep 4

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

Steps to reproduce the problem:
1. download and unzip the release asan chromium :asan-linux-release-583299
2. Run ./chrome crash.html

What is the expected behavior?

What went wrong?
Can get UAF stably as long as the version number is greater than 70.0.3522.0.

In https://chromium.googlesource.com/v8/v8.git/+/07aafb76f60326f5750787cf0e48e859d0eaa194/src/wasm/module-compiler.cc:2179

AsyncCompileJob::~AsyncCompileJob() {
  background_task_manager_.CancelAndWait();
  if (native_module_) native_module_->compilation_state()->Abort();

  CancelPendingForegroundTask();     <-----was moved here from abort()

  for (auto d : deferred_handles_) delete d;
}

In order to fix missing cancellation of background compilation,the function CancelPendingForegroundTask() was moved from abort() to ~AsyncCompileJob().
Maybe it did not consider that job_ was freed in the progress of backing_thread shutdown.

And may the fix could be like this?
1.Check the AsyncCompileJob is deleted or not before CancelPendingForegroundTask? 
or
2.Try to make abort() not be missing and move CancelPendingForegroundTask() to abort() again?

Hope my work helps.

Did this work before? N/A 

Chrome version: 70.0.3524.0  Channel: n/a
OS Version: 
Flash Version:
 
res.zip
2.7 KB Download
crash.html
360 bytes View Download
UAF.log
25.9 KB View Download
Labels: -Pri-2 M-69 Security_Severity-High Security_Impact-Stable Pri-1
Owner: hablich@chromium.org
Status: Assigned (was: Unconfirmed)
Assigning for v8 triage.
Components: Blink>JavaScript>WebAssembly
Project Member

Comment 3 by sheriffbot@chromium.org, Sep 18

hablich: 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: hablich@chromium.org
Owner: ahaas@chromium.org
Sounds like something you might already have fixed recently?
Cc: ahaas@chromium.org
Owner: clemensh@chromium.org
Hi Clemens, has this been fixed by https://crrev.com/c/1209344? 
That CL was merged back to M-70 in https://crrev.com/c/1215622. Will have to investigate whether this is a separate issue.
Labels: Needs-Feedback
Cannot reproduce, looks like it's missing the "wasm_idb_worker.js" file.
Hi clemensh@  
Did you try in 70.0.3524.0?

Here is the "wasm_idb_worker.js" file.(You can find it in res.zip too)
wasm_idb_worker.js
769 bytes View Download
Note that the version you are using (asan-linux-release-583299, 70.0.3524.0) were before the fix mentioned in #6 was merged. So it should be fixed.

I tried reproducing on asan build 583299, but failed. These are my asan options:
handle_sigfpe=1:handle_sigbus=1:detect_stack_use_after_return=1:alloc_dealloc_mismatch=0:print_scariness=1:max_uar_stack_size_log=16:quarantine_size_mb=10:detect_odr_violation=0:handle_sigill=1:allocator_release_to_os_interval_ms=500:coverage=0:use_sigaltstack=1:fast_unwind_on_fatal=1:detect_leaks=1:print_summary=1:handle_abort=1:check_malloc_usable_size=0:detect_container_overflow=1:symbolize=1:handle_segv=1:abort_on_error=1:allow_user_segv_handler=1

What I did was:
1) download and unpack asan-linux-release-583299
2) download and unpack res.zip from #1
3) download crash.html from #1 and place it next to the extracted files from (2)
4) set (and export) ASAN_OPTIONS
5) start a webserver to serve the files from (2) and (3): python -m SimpleHTTPServer 8004
6) run: ./asan-linux-release-583299/chrome http://localhost:8004/crash.html

Comment 10 Deleted

Sorry for my mistake.
Seem like it lacks of a testharness.js file.
Here i upload a new "wasm_idb_worker.js" and get that crash again.
Please try this one.

wasm_idb_worker.js
737 bytes View Download
Labels: -Security_Impact-Stable -M-69 M-70 Security_Impact-None
Status: Fixed (was: Assigned)
Thanks, can reproduce on version 583299 now.
Also tried ToT, and it does not reproduce there.
Bisecting shows that is was fixed between 589344 and 589346. In-between (at 589345), we rolled v8 version 7.1.54, with these changes: https://chromium.googlesource.com/v8/v8/+log/41db1841..e1220339
This range contains the fix:
98bdaf9 [wasm] Fix worker termination while compiling

So everything is fine, this is fixed on the M-70 branch.

Thanks for filing this anyway!
Project Member

Comment 13 by sheriffbot@chromium.org, Sep 20

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Labels: reward-topanel
Labels: -reward-topanel reward-0
hi cdsrc2016@, I'm afraid the VRP panel declined to reward for this bug, as it did not cause us to fix the issue, per comment 5.  Cheers!
Project Member

Comment 16 by sheriffbot@chromium.org, Dec 27

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