New issue
Advanced search Search tips

Issue 914023 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Jan 15
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Chrome , Mac
Pri: 1
Type: Bug



Sign in to add a comment

Heap-buffer-overflow in rebuildPage

Project Member Reported by ClusterFuzz, Dec 11

Issue description

Detailed report: https://clusterfuzz.com/testcase?key=4786667992645632

Fuzzer: afl_sqlite3_dbfuzz2_fuzzer
Fuzz target binary: sqlite3_dbfuzz2_fuzzer
Job Type: afl_chrome_asan
Platform Id: linux

Crash Type: Heap-buffer-overflow READ {*}
Crash Address: 0x615000781680
Crash State:
  rebuildPage
  editPage
  balance_nonroot
  
Sanitizer: address (ASAN)

Recommended Security Severity: Medium

Reproducer Testcase: https://clusterfuzz.com/download?testcase_id=4786667992645632

Issue filed automatically.

See https://github.com/google/clusterfuzz-tools for more information.
 
Project Member

Comment 1 by ClusterFuzz, Dec 11

Components: Internals>Storage
Labels: Test-Predator-Auto-Components
Automatically applying components based on crash stacktrace and information from OWNERS files.

If this is incorrect, please apply the Test-Predator-Wrong-Components label.
Project Member

Comment 2 by ClusterFuzz, Dec 11

Cc: pwnall@chromium.org
Labels: ClusterFuzz-Auto-CC
Automatically adding ccs based on OWNERS file / target commit history.

If this is incorrect, please add ClusterFuzz-Wrong label.
Project Member

Comment 3 by sheriffbot@chromium.org, Dec 12

Labels: Target-72 M-72
Project Member

Comment 4 by sheriffbot@chromium.org, Dec 12

Labels: ReleaseBlock-Stable
This is a serious security regression. If you are not able to fix this quickly, please revert the change that introduced it.

If this doesn't affect a release branch, or has not been properly classified for severity, please update the Security_Impact or Security_Severity labels, and remove the ReleaseBlock label. To disable this altogether, apply ReleaseBlock-NA.

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

Comment 5 by sheriffbot@chromium.org, Dec 12

Labels: Pri-1
Cc: -pwnall@chromium.org cmumford@chromium.org
Owner: pwnall@chromium.org
Project Member

Comment 7 by sheriffbot@chromium.org, Dec 13

Labels: -Security_Impact-Head Security_Impact-Beta
Project Member

Comment 8 by sheriffbot@chromium.org, Dec 13

Status: Assigned (was: Untriaged)
Project Member

Comment 9 by ClusterFuzz, Dec 14

Labels: OS-Chrome
Project Member

Comment 10 by ClusterFuzz, Dec 20

Labels: OS-Mac
Project Member

Comment 11 by sheriffbot@chromium.org, Dec 26

pwnall: 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: mpdenton@chromium.org
Labels: -Type-Bug-Security -Restrict-View-SecurityTeam -Security_Severity-Medium -Security_Impact-Beta -ReleaseBlock-Stable -M-72 -Target-72 Type-Bug
Cc: drhsql...@gmail.com danielk1...@gmail.com
Richard and Dan, can you please take a look?

dbfuzz2 test case attached. Stack trace below.

==334716==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x615000000500 at pc 0x564723c96369 bp 0x7ffe90c01b50 sp 0x7ffe90c01300
READ of size 37 at 0x615000000500 thread T0
SCARINESS: 26 (multi-byte-read-heap-buffer-overflow)
    #0 0x564723c96368 in __asan_memcpy _asan_rtl_:3
    #1 0x564723e255bf in rebuildPage third_party/sqlite/amalgamation/sqlite3.c:69785:5
    #2 0x564723e26165 in editPage third_party/sqlite/amalgamation/sqlite3.c:70020:10
    #3 0x564723e23d48 in balance_nonroot third_party/sqlite/amalgamation/sqlite3.c:70943:12
    #4 0x564723e1b232 in balance third_party/sqlite/amalgamation/sqlite3.c:71192:16
    #5 0x564723e06b1f in sqlite3BtreeInsert third_party/sqlite/amalgamation/sqlite3.c:71567:10
    #6 0x564723df74a3 in sqlite3VdbeExec third_party/sqlite/amalgamation/sqlite3.c:88392:10
    #7 0x564723d91957 in sqlite3Step third_party/sqlite/amalgamation/sqlite3.c:81427:10
    #8 0x564723d89338 in sqlite3_step third_party/sqlite/amalgamation/sqlite3.c:81490:16
    #9 0x564723d99ce5 in sqlite3_exec third_party/sqlite/amalgamation/sqlite3.c:118075:12
    #10 0x564723cc69f4 in LLVMFuzzerTestOneInput third_party/sqlite/src/test/dbfuzz2.c:95:5
0x615000000500 is located 0 bytes to the right of 512-byte region [0x615000000300,0x615000000500)
allocated by thread T0 here:
    #0 0x564723c972b3 in __interceptor_malloc _asan_rtl_:3
    #1 0x564723f00efd in sqlite3MemMalloc third_party/sqlite/amalgamation/sqlite3.c:22762:7
    #2 0x564723da479a in mallocWithAlarm third_party/sqlite/amalgamation/sqlite3.c:26604:7
    #3 0x564723d7efa6 in sqlite3Malloc third_party/sqlite/amalgamation/sqlite3.c:26634:5
    #4 0x564723dcb67d in pcache1Alloc third_party/sqlite/amalgamation/sqlite3.c:48850:9
    #5 0x564723db2674 in sqlite3PagerSetPagesize third_party/sqlite/amalgamation/sqlite3.c:54219:22
    #6 0x564723dcf4c3 in lockBtree third_party/sqlite/amalgamation/sqlite3.c:66137:12
    #7 0x564723d8b8ef in sqlite3BtreeBeginTrans third_party/sqlite/amalgamation/sqlite3.c:66401:47
    #8 0x564723df77f4 in sqlite3VdbeExec third_party/sqlite/amalgamation/sqlite3.c:86316:10
    #9 0x564723d91957 in sqlite3Step third_party/sqlite/amalgamation/sqlite3.c:81427:10
    #10 0x564723d89338 in sqlite3_step third_party/sqlite/amalgamation/sqlite3.c:81490:16
    #11 0x564723d99ce5 in sqlite3_exec third_party/sqlite/amalgamation/sqlite3.c:118075:12
    #12 0x564723cc69f4 in LLVMFuzzerTestOneInput third_party/sqlite/src/test/dbfuzz2.c:95:5

clusterfuzz-testcase-minimized-sqlite3_dbfuzz2_fuzzer-4786667992645632
3.5 KB View Download
Fixed by SQLite check-in https://sqlite.org/src/info/32754ca6f86da816
Status: Started (was: Assigned)
Thank you very much for the quick fix! I am backporting this.
Project Member

Comment 16 by bugdroid1@chromium.org, Jan 14

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0abd626ef136c39711131a2ad9947cb61d6b4b7f

commit 0abd626ef136c39711131a2ad9947cb61d6b4b7f
Author: Victor Costan <pwnall@chromium.org>
Date: Mon Jan 14 22:15:54 2019

sqlite: Backport a few more bug fixes.

Bug:  913235 ,  914022 ,  914023 ,  914027 ,  914155 , 914507,  914648 ,  914970 ,  915499 , 921298, 921348, 921355
Change-Id: I8a03ded5cda06ac60adfc63cd71487f5161b21e6
Reviewed-on: https://chromium-review.googlesource.com/c/1408357
Reviewed-by: Chris Mumford <cmumford@google.com>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622627}
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/amalgamation/sqlite3.c
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0001-Modify-default-VFS-to-support-WebDatabase.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0002-Virtual-table-supporting-recovery-of-corrupted-datab.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0003-Custom-shell.c-helpers-to-load-Chromium-s-ICU-data.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0004-fts3-Disable-fts3_tokenizer-and-fts4.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0005-fuchsia-Use-dot-file-locking-for-sqlite.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0006-Fix-dbfuzz2-for-Clusterfuzz.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0007-Fix-the-Makefile-so-that-it-honors-CFLAGS-when-build.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0008-Adjustments-to-the-page-cache-to-try-to-avoid-harmle.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0009-Remove-an-ALWAYS-from-a-branch-that-is-not-always-ta.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0010-Fix-a-problem-with-nested-CTEs-with-the-same-table.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0011-Fix-detection-of-self-referencing-rows-in-foreign-ke.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0012-Fix-a-segfault-caused-by-using-the-RAISE-function-in.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0013-Fix-for-an-assert-that-could-be-false.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0014-Fix-another-problem-found-by-Matthew-Denton-s-new-fu.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0015-Report-a-new-corruption-case.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0016-Avoid-a-buffer-overread-in-ptrmapPutOvflPtr.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0017-Improved-detection-of-cell-corruption-in-sqlite3Vdbe.patch
[add] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0018-Fix-a-segfault-in-fts3-prompted-by-a-corrupted-datab.patch
[add] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0019-Prevent-integer-overflow-from-leading-to-buffer-over.patch
[add] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0020-Add-extra-tests-for-database-corruption-inside-defra.patch
[add] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0021-Fix-an-off-by-one-error-on-a-Goto-in-the-code-genera.patch
[add] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0022-Fix-overread-on-corrupted-btree-key.patch
[add] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0023-Avoid-buffer-overreads-on-corrupted-database-files.patch
[add] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0024-Fix-integer-overflow-while-running-PRAGMA-integrity_.patch
[add] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0025-Improved-corruption-handling-while-balancing-pages.patch
[add] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0026-Avoid-reading-off-the-front-of-a-page-buffer-when-ba.patch
[add] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/patches/0027-Fix-MSAN-error-in-sqlite3VdbeRecordUnpack-on-a-corru.patch
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/src/ext/fts3/fts3.c
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/src/src/btree.c
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/src/src/insert.c
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/src/src/pcache1.c
[modify] https://crrev.com/0abd626ef136c39711131a2ad9947cb61d6b4b7f/third_party/sqlite/src/src/vdbeaux.c

Project Member

Comment 17 by ClusterFuzz, Jan 15

ClusterFuzz has detected this issue as fixed in range 622595:622639.

Detailed report: https://clusterfuzz.com/testcase?key=4786667992645632

Fuzzer: afl_sqlite3_dbfuzz2_fuzzer
Fuzz target binary: sqlite3_dbfuzz2_fuzzer
Job Type: afl_chrome_asan
Platform Id: linux

Crash Type: Heap-buffer-overflow READ {*}
Crash Address: 0x615000000500
Crash State:
  rebuildPage
  editPage
  balance_nonroot
  
Sanitizer: address (ASAN)

Recommended Security Severity: Medium

Fixed: https://clusterfuzz.com/revisions?job=afl_chrome_asan&range=622595:622639

Reproducer Testcase: https://clusterfuzz.com/download?testcase_id=4786667992645632

See https://github.com/google/clusterfuzz-tools for instructions to reproduce this bug locally.

If you suspect that the result above is incorrect, try re-doing that job on the test case report page.
Project Member

Comment 18 by ClusterFuzz, Jan 15

Labels: ClusterFuzz-Verified
Status: Verified (was: Started)
ClusterFuzz testcase 4786667992645632 is verified as fixed, so closing issue as verified.

If this is incorrect, please add ClusterFuzz-Wrong label and re-open the issue.

Sign in to add a comment