CVE-2020-4035: DoS via malicious record IDs in WatermelonDB

@nozbe/watermelondb Updated 02 Oct 2025

Summary

03/06/2020
Yes i
Moderate
5.9

CVE-2020-4035: DoS via malicious record IDs in WatermelonDB. Affects @nozbe/watermelondb across 2 version ranges.

< 0.15.1 >= 0.16.0, < 0.16.2

Fixed in 0.15.1 or 0.16.2, depending on the release line you run. How to fix ↓

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

WatermelonDB is an open-source JavaScript library for managing an in-memory database in React Native applications. It provides a simple and efficient way to store and retrieve data locally. However, a vulnerability has been discovered in WatermelonDB that allows for a denial-of-service (DoS) attack using malicious record IDs.

Vulnerability Detail

The vulnerability arises from a SQL Injection vulnerability in the iOS adapter implementation of WatermelonDB. By crafting a malicious record ID, an attacker can exploit this vulnerability and cause the app to delete all or selected records from the database, rendering the app unusable. This vulnerability can be triggered in apps that do not properly validate record IDs and use Watermelon Sync or the low-level database.adapter.destroyDeletedRecords method. While the integrity risk is low as maliciously deleted records won't synchronize, some local changes may be lost if the sync process fails. It is not possible to breach confidentiality or perform full exploitation of SQL Injection due to the limitations of SQLite. However, if an app relies on the absence of a record for security decisions, selective record deletion could lead to insecure behavior.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 0.15.1 0.15.1
    npm install @nozbe/watermelondb@0.15.1
  • >= 0.16.0, < 0.16.2 0.16.2
    npm install @nozbe/watermelondb@0.16.2

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If updating to the patched versions is not immediately feasible, there are two workarounds available:

  1. Ensure that your backend service sanitizes record IDs sent in the pull sync endpoint, allowing only IDs matching the pattern ^[a-zA-Z0-9_-.]+$ to be returned.

  2. If you directly use the destroyDeletedRecords method, validate all IDs passed using the same pattern mentioned above.

Conclusion

The vulnerability in WatermelonDB allows for a DoS attack using malicious record IDs. It is recommended to update to the patched versions or apply the provided workarounds to mitigate the vulnerability. For further assistance with vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for @nozbe/watermelondb →

Share this vulnerability

FAQ

WatermelonDB is a JavaScript library for managing an in-memory database in React Native applications. It provides a simple and efficient way to store and retrieve data locally.

The vulnerability allows for a DoS attack by deleting records from the database. This can render the app unusable, but the deleted records won't synchronize. However, some local changes may be lost if the sync process fails.

No, there is no known way to breach confidentiality using this vulnerability. The limitations of SQLite prevent full exploitation of SQL Injection, and selectively deleted records will not be synchronized.

The patched versions of WatermelonDB are 0.15.1, 0.16.2, and 0.16.1-fix. Updating to these versions will mitigate the vulnerability.

Yes, if updating to the patched versions is not immediately feasible, you can sanitize record IDs in the backend service or validate IDs passed to the destroyDeletedRecords method.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 0.15.1 0.15.1
    npm install @nozbe/watermelondb@0.15.1
  • >= 0.16.0, < 0.16.2 0.16.2
    npm install @nozbe/watermelondb@0.16.2

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. 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