Advisory

RUSTSEC-2021-0037

Also known as: CVE-2021-28305, GHSA-j8q9-5rp9-4mv9

Summary

Fix a use-after-free bug in diesels Sqlite backend

Details

We've misused sqlite3_column_name. The
SQLite documentation
states that the following:

> The returned string pointer is valid until either the prepared statement
> is destroyed by sqlite3_finalize() or until the statement is automatically
> reprepared by the first call to sqlite3_step() for a particular
> run or until the next call to sqlite3_column_name()
> or sqlite3_column_name16() on the same column.

As part of our query_by_name infrastructure we've first received all
field names for the prepared statement and stored them as string slices
for later use. After that we called sqlite3_step() for the first time,
which invalids the pointer and therefore the stored string slice.

Severity

Critical Basis: CVSS v3 score 9.8, vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Dates

Published
2021-03-05 12:00 UTC
Modified
2023-11-08 04:05 UTC

Affected packages and fixes

diesel

crates.io · All systems

Affected

  • introduced 0.0.0-0, fixed 1.4.6 (semver)

Fixed versions

1.4.6

Fix

  • Fixed version 1.4.6
    cargo update -p diesel --precise 1.4.6

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: RustSec Advisory Database · CC0-1.0

Sources & licences