New issue
Advanced search Search tips

Issue 914155 link

Starred by 1 user

Issue metadata

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



Sign in to add a comment

Heap-buffer-overflow in sqlite3VdbeSerialGet

Project Member Reported by ClusterFuzz, Dec 11

Issue description

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

Fuzzer: libFuzzer_sqlite3_dbfuzz2_fuzzer
Fuzz target binary: sqlite3_dbfuzz2_fuzzer
Job Type: libfuzzer_chrome_asan
Platform Id: linux

Crash Type: Heap-buffer-overflow READ 1
Crash Address: 0x603000003358
Crash State:
  sqlite3VdbeSerialGet
  sqlite3VdbeRecordUnpack
  btreeMoveto
  
Sanitizer: address (ASAN)

Recommended Security Severity: Medium

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

Issue filed automatically.

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

Comment 1 by ClusterFuzz, Dec 12

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 12

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

Comment 10 by ClusterFuzz, Dec 28

Labels: OS-Chrome
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, could you please take a look?

dbfuzz2 test case attached. Stack below.

==2596586==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000003358 at pc 0x7fc82e3daee7 bp 0x7ffd38ac15e0 sp 0x7ffd38ac15d8
READ of size 1 at 0x603000003358 thread T0
SCARINESS: 12 (1-byte-read-heap-buffer-overflow)
    #0 0x7fc82e3daee6 in sqlite3VdbeSerialGet third_party/sqlite/amalgamation/sqlite3.c:79555:19
    #1 0x7fc82e3deb99 in sqlite3VdbeRecordUnpack third_party/sqlite/amalgamation/sqlite3.c:79649:10
    #2 0x7fc82e3ec136 in btreeMoveto third_party/sqlite/amalgamation/sqlite3.c:63818:5
    #3 0x7fc82e3ebe76 in btreeRestoreCursorPosition third_party/sqlite/amalgamation/sqlite3.c:63850:8
    #4 0x7fc82e3f18e6 in btreeNext third_party/sqlite/amalgamation/sqlite3.c:68622:10
    #5 0x7fc82e3c237d in sqlite3VdbeExec third_party/sqlite/amalgamation/sqlite3.c:88315:8
    #6 0x7fc82e35e4dc in sqlite3Step third_party/sqlite/amalgamation/sqlite3.c:81427:10
    #7 0x7fc82e35464a in sqlite3_step third_party/sqlite/amalgamation/sqlite3.c:81490:16
    #8 0x7fc82e367dc9 in sqlite3_exec third_party/sqlite/amalgamation/sqlite3.c:118075:12
    #9 0x557f60d839bf in LLVMFuzzerTestOneInput third_party/sqlite/src/test/dbfuzz2.c:95:5
0x603000003358 is located 0 bytes to the right of 24-byte region [0x603000003340,0x603000003358)
allocated by thread T0 here:
    #0 0x557f60d542b3 in __interceptor_malloc third_party/llvm/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
    #1 0x7fc82e4e5a99 in sqlite3MemMalloc third_party/sqlite/amalgamation/sqlite3.c:22762:7
    #2 0x7fc82e378499 in mallocWithAlarm third_party/sqlite/amalgamation/sqlite3.c:26604:7
    #3 0x7fc82e348bcf in sqlite3Malloc third_party/sqlite/amalgamation/sqlite3.c:26634:5
    #4 0x7fc82e3ade80 in saveCursorKey third_party/sqlite/amalgamation/sqlite3.c:63680:12
    #5 0x7fc82e3e0c3e in sqlite3BtreeDelete third_party/sqlite/amalgamation/sqlite3.c:71655:12
    #6 0x7fc82e3cc686 in sqlite3VdbeExec third_party/sqlite/amalgamation/sqlite3.c:87825:8
    #7 0x7fc82e35e4dc in sqlite3Step third_party/sqlite/amalgamation/sqlite3.c:81427:10
    #8 0x7fc82e35464a in sqlite3_step third_party/sqlite/amalgamation/sqlite3.c:81490:16
    #9 0x7fc82e367dc9 in sqlite3_exec third_party/sqlite/amalgamation/sqlite3.c:118075:12
    #10 0x557f60d839bf in LLVMFuzzerTestOneInput third_party/sqlite/src/test/dbfuzz2.c:95:5

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

Comment 15 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 16 by ClusterFuzz, Jan 15

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

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

Fuzzer: libFuzzer_sqlite3_dbfuzz2_fuzzer
Fuzz target binary: sqlite3_dbfuzz2_fuzzer
Job Type: libfuzzer_chrome_asan
Platform Id: linux

Crash Type: Heap-buffer-overflow READ 1
Crash Address: 0x603000003358
Crash State:
  sqlite3VdbeSerialGet
  sqlite3VdbeRecordUnpack
  btreeMoveto
  
Sanitizer: address (ASAN)

Recommended Security Severity: Medium

Fixed: https://clusterfuzz.com/revisions?job=libfuzzer_chrome_asan&range=622610:622639

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

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 17 by ClusterFuzz, Jan 15

Labels: ClusterFuzz-Verified
Status: Verified (was: Started)
ClusterFuzz testcase 6398812857565184 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