CVE-2022-21227: Denial-of-Service in sqlite3

sqlite3 Updated 02 Oct 2025

Summary

28/04/2022
Yes i
High
7.5

CVE-2022-21227: Denial-of-Service when binding invalid parameters in sqlite3. Affects sqlite3 versions >= 5.0.0, < 5.0.3. Fixed in 5.0.3. How to fix ↓

Also tracked for

The same CVE-2022-21227 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The sqlite3 package is a popular npm package that provides a lightweight and self-contained SQL database engine. It is widely used in various applications to manage local databases. However, versions 5.0.0 to 5.0.2 of sqlite3 are vulnerable to a Denial-of-Service (DoS) attack. This vulnerability allows an attacker to crash the application by supplying a specific object in the parameter array, resulting in a fatal error that cannot be caught. The issue has been addressed in version 5.0.3 of sqlite3.

Vulnerability Detail

The vulnerability in sqlite3 arises from a lack of proper validation and handling of invalid parameters. When an attacker provides a specific object in the parameter array, it triggers a fatal error that crashes the application. This vulnerability can be exploited remotely without authentication, potentially leading to a complete denial of service. The impact of this vulnerability is severe, as it can disrupt the availability of the affected application. The vulnerability is assigned a CVSS score of 7.5, indicating a high severity level.

How To Fix

Minimum fixed version

5.0.3

This is the first release that contains the fix.

npm install sqlite3@5.0.3

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, it is advised to implement sufficient sanitization in the parent application to protect against invalid values being supplied to binding parameters. By validating and sanitizing user input, the risk of encountering the specific object that triggers the crash can be mitigated. Here is an example of how to sanitize user input in a Node.js application using the express framework:

const express = require('express');
const sqlite3 = require('sqlite3');

const app = express();
const db = new sqlite3.Database(':memory:');

app.get('/query', (req, res) => {
  const userInput = req.query.input;
  const sanitizedInput = sanitize(userInput); // Implement your own sanitization logic

  db.run('INSERT INTO table (column) VALUES (?)', [sanitizedInput], (err) => {
    if (err) {
      console.error(err);
      res.status(500).send('Internal Server Error');
    } else {
      res.send('Query executed successfully');
    }
  });
});

function sanitize(input) {
  // Implement your sanitization logic here
  return input;
}

Conclusion

The vulnerability in sqlite3 versions 5.0.0 to 5.0.2 can lead to a denial-of-service attack by crashing the application. It is crucial to upgrade to version 5.0.3 or later to fix this vulnerability. Implementing proper input sanitization in the parent application can also provide a temporary workaround. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for sqlite3 →

Share this vulnerability

FAQ

The vulnerability allows an attacker to crash the application, resulting in a denial of service. This can disrupt the availability of the affected application.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your package-lock.json file and it will provide real-time alerts for open-source vulnerabilities.

No, authentication is not required to exploit this vulnerability. It can be exploited remotely.

The vulnerability is assigned a CVSS score of 7.5, indicating a high severity level.

A temporary workaround is to implement sufficient sanitization in the parent application to protect against invalid values being supplied to binding parameters. This can help mitigate the risk of encountering the specific object that triggers the crash.

Related vulnerabilities

Recent vulnerabilities recorded for sqlite3.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

5.0.3

This is the first release that contains the fix.

npm install sqlite3@5.0.3

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback