Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1841574 (CVE-2020-13632)

Summary: CVE-2020-13632 sqlite: NULL pointer dereference in ext/fts3/fts3_snippet.c via a crafted matchinfo() query
Product: [Other] Security Response Reporter: Guilherme de Almeida Suckevicz <gsuckevi>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: alex, databases-maint, drizt72, erik-fedora, fedora, itamar, mschorm, odubaj, pkubat, praiskup, rh-spice-bugs, rjones, wilmer5
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sqlite 3.32.0 Doc Type: If docs needed, set a value
Doc Text:
A NULL pointer dereference flaw was found in the matchinfo auxiliary function of the SQLite FTS3 extension module. This flaw allows an attacker who can execute SQL statements to crash the application, resulting in a denial of service.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 02:25:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1841575, 1841576, 1841577, 1845572, 1845615    
Bug Blocks:    

Description Guilherme de Almeida Suckevicz 2020-05-29 13:39:06 UTC
ext/fts3/fts3_snippet.c in SQLite before 3.32.0 has a NULL pointer dereference via a crafted matchinfo() query.

Reference and upstream commit:
https://sqlite.org/src/info/a4dd148928ea65bd

Comment 1 Guilherme de Almeida Suckevicz 2020-05-29 13:39:35 UTC
Created mingw-sqlite tracking bugs for this issue:

Affects: fedora-all [bug 1841575]


Created sqlite tracking bugs for this issue:

Affects: fedora-all [bug 1841577]


Created sqlite2 tracking bugs for this issue:

Affects: fedora-all [bug 1841576]

Comment 4 Mauro Matteo Cascella 2020-06-09 15:56:08 UTC
According to the documentation, FTS3 is an extension module that allows users to create special virtual tables with a built-in full-text index to efficiently perform full-text searches on a set of documents (https://www.sqlite.org/fts3.html). Under some circumstances it is possible for a SQL SELECT statement to cause a NULL pointer dereference while performing a full-text query on FTS3 virtual tables using the matchinfo function (https://www.sqlite.org/fts3.html#matchinfo). This may occur in function fts3ColumnlistCount() in fts3_snippet.c, when the pEnd pointer ends up being set to 0 in a while loop. For this attack to be successful, an attacker would need to have a level of access that allows him to write particular SQL expressions that use the matchinfo function to perform full-text queries on FTS3 tables.

Comment 5 Mauro Matteo Cascella 2020-06-09 16:16:17 UTC
Function fts3ExprLHits() in fts3_snippet.c was responsible for calling fts3ColumnlistCount() with an invalid pointer. The former was introduced in SQLite upstream version 3.8.11 with the following commit:
  -> https://github.com/sqlite/sqlite/commit/e60aedc564c6f7291143b33a90869529b1676b35

It was fixed in upstream version 3.32.0 (see Comment 0).

Comment 6 Mauro Matteo Cascella 2020-06-09 16:18:13 UTC
Statement:

This flaw did not affect the versions of SQLite as shipped with Red Hat Enterprise Linux 7 as they did not include the vulnerable code, which was introduced in a later version of the package.

Comment 8 errata-xmlrpc 2020-11-04 01:00:16 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2020:4442 https://access.redhat.com/errata/RHSA-2020:4442

Comment 9 Product Security DevOps Team 2020-11-04 02:25:39 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2020-13632

Comment 10 errata-xmlrpc 2021-05-18 16:30:10 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:1968 https://access.redhat.com/errata/RHSA-2021:1968