Cloudanix VulnDB

CVE-2022-46908

High · 7.3

CVSS

7.3

EPSS

0.4%

Published

Dec 12, 2022

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A problem in database software lets untrusted scripts write files on the computer even when the program is told to run them safely, which could let attackers change or steal information.

Exploit Available
Exploitation
Local Privilege
Attacker needs
Low Privilege
Complexity
Low
Impact
Full Compromise
Component
Library
Class
Authorization Bypass
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

The --safe flag in SQLite CLI fails to enforce the azProhibitedFunctions list, permitting user-defined functions such as WRITEFILE to execute and perform file-system operations from untrusted scripts.

Why it matters to the business

Organizations relying on SQLite's safe-mode execution for untrusted scripts face unauthorized file creation or modification, increasing risk of data tampering or exfiltration in environments that process external database scripts.

How an attack unfolds

An attacker supplies a malicious SQLite script containing calls to WRITEFILE or similar UDFs; when the script is executed via the CLI under the --safe option, the bypassed protection allows the function to write attacker-controlled content to arbitrary paths on the host.

How to fix it

Upgrade sqlite/sqlite (GIT) to commit 1fdaa9d1a79b05503ee5243e360b9b5dea0ff25c or later; avoid executing untrusted scripts with the CLI until patched; consider sandboxing or disabling UDF registration for untrusted input.

How to confirm the fix worked

Confirm the installed SQLite binary reports a version containing commit 1fdaa9d1a79b05503ee5243e360b9b5dea0ff25c; test that --safe now blocks WRITEFILE and other prohibited functions when running sample untrusted scripts.

Typical attack path

  1. Locate applications or automation that invoke the SQLite CLI with the --safe flag on externally supplied scripts.
  2. Craft a script that invokes prohibited UDFs such as WRITEFILE to target desired file paths.
  3. Deliver the script to the vulnerable SQLite instance and trigger execution.
  4. Verify successful file writes to confirm impact and proceed to data manipulation or persistence.

How to detect it

Review process execution logs and command-line history for sqlite3 invocations that include --safe together with scripts containing WRITEFILE or other UDF calls; inspect file-system audit logs for unexpected writes originating from the SQLite process.

What your security team should do

  • Apply the listed commit or newer release across all SQLite deployments within 30 days.
  • Audit code and scripts that invoke sqlite3 with --safe and replace with safer execution patterns.
  • Add SQLite version checks to vulnerability scanning and CI pipelines.
  • Monitor for any new public exploits given the existing proof-of-concept availability.

The record

SQLite through 3.40.0, when relying on --safe for execution of an untrusted CLI script, does not properly implement the azProhibitedFunctions protection mechanism, and instead allows UDF functions such as WRITEFILE.

Affected packages

Ecosystem Package Introduced Fixed
Bitnami sqlite 3.37.0 3.40.1
Chainguard sqlite 0 0
Chainguard sqlite-dev 0 0
Chainguard sqlite-doc 0 0
Chainguard sqlite-libs 0 0
Debian:12 sqlite3 0 3.40.0-2
Debian:13 sqlite3 0 3.40.0-2
Mageia:8 sqlite3 0 3.39.2-1.1.mga8
SUSE:Enterprise Storage 7 sqlite3 0 3.39.3-150000.3.20.1
SUSE:Enterprise Storage 7.1 sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOS sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Micro 5.1 sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Micro 5.2 sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Micro 5.3 sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Module for Basesystem 15 SP4 sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Real Time 15 SP3 sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Server 12 SP2-BCL sqlite3 0 3.39.3-9.26.1
SUSE:Linux Enterprise Server 12 SP4-ESPOS sqlite3 0 3.39.3-9.26.1
SUSE:Linux Enterprise Server 12 SP4-LTSS sqlite3 0 3.39.3-9.26.1
SUSE:Linux Enterprise Server 12 SP5 sqlite3 0 3.39.3-9.26.1
SUSE:Linux Enterprise Server 15 SP1-LTSS sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Server 15 SP2-LTSS sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Server 15 SP3-LTSS sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP4 sqlite3 0 3.39.3-9.26.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP5 sqlite3 0 3.39.3-9.26.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP1 sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP2 sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP3 sqlite3 0 3.39.3-150000.3.20.1
SUSE:Linux Enterprise Software Development Kit 12 SP5 sqlite3 0 3.39.3-9.26.1
SUSE:Manager Proxy 4.2 sqlite3 0 3.39.3-150000.3.20.1
SUSE:Manager Server 4.2 sqlite3 0 3.39.3-150000.3.20.1
SUSE:OpenStack Cloud 9 sqlite3 0 3.39.3-9.26.1
SUSE:OpenStack Cloud Crowbar 9 sqlite3 0 3.39.3-9.26.1
Ubuntu:20.04:LTS sqlite3 0 3.31.1-4ubuntu0.6
Ubuntu:22.04:LTS sqlite3 0 3.37.2-2ubuntu0.3
Ubuntu:23.10 sqlite3 0 3.42.0-1ubuntu0.1
Wolfi sqlite 0 0
Wolfi sqlite-dev 0 0
Wolfi sqlite-doc 0 0
Wolfi sqlite-libs 0 0
openSUSE:Leap 15.3 sqlite3 0 3.39.3-150000.3.20.1
openSUSE:Leap 15.4 sqlite3 0 3.39.3-150000.3.20.1
openSUSE:Leap Micro 5.2 sqlite3 0 3.39.3-150000.3.20.1
openSUSE:Leap Micro 5.3 sqlite3 0 3.39.3-150000.3.20.1
openSUSE:Tumbleweed sqlite3 0 3.40.0-2.1

Related vulnerabilities