CVE-2020-4035

DoS or local data modification via malicious record IDs in WatermelonDB

5.9 medium EPSS 0.76%

Published 3 Jun 2020 Updated 4 Aug 2024 CNA: GitHub_M

Check your servers for CVE-2020-4035

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2020-4035 affects watermelondb, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

Description

In WatermelonDB (NPM package "@nozbe/watermelondb") before versions 0.15.1 and 0.16.2, a maliciously crafted record ID can exploit a SQL Injection vulnerability in iOS adapter implementation and cause the app to delete all or selected records from the database, generally causing the app to become unusable. This may happen in apps that don't validate IDs (valid IDs are `/^[a-zA-Z0-9_-.]+$/`) and use Watermelon Sync or low-level `database.adapter.destroyDeletedRecords` method. The integrity risk is low due to the fact that maliciously deleted records won't synchronize, so logout-login will restore all data, although some local changes may be lost if the malicious deletion causes the sync process to fail to proceed to push stage. No way to breach confidentiality with this vulnerability is known. Full exploitation of SQL Injection is mitigated, because it's not possible to nest an insert/update query inside a delete query in SQLite, and it's not possible to pass a semicolon-separated second query. There's also no known practicable way to breach confidentiality by selectively deleting records, because those records will not be synchronized. It's theoretically possible that selective record deletion could cause an app to behave insecurely if lack of a record is used to make security decisions by the app. This is patched in versions 0.15.1, 0.16.2, and 0.16.1-fix

Severity (CVSS)

5.9 medium CVSS 3.1 from GitHub_M (CNA)
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:H
Attack vector
network: an attacker can reach the vulnerable part over the network, often from the internet
Attack complexity
high: an attack depends on conditions outside the control of the attacker, such as a race
Privileges required
low: the attacker needs an ordinary user account
User interaction
none: nobody has to click or open anything
Scope
unchanged: the damage stays inside the vulnerable component
Impact
confidentiality none, integrity low, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)

Exploitation

EPSS 0.76%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 51.7% of all scored CVEs. Scores of 28 Nov 2026.

Weakness

  • CWE-89 Improper Neutralization of Special Elements used in an SQL Command

Affected products

As the CNA lists them.

ProductVersions
WatermelonDB
affected < 0.15.1
affected >= 0.16.0, < 0.16.2

Is my server affected?

Find the installed version of watermelondb and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.

Debian, Ubuntu

dpkg -l | grep -i watermelondb
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2020-4035 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2020-4035

RHEL, Rocky, Alma, Fedora

rpm -q watermelondb
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2020-4035

Alpine

apk list --installed | grep -i watermelondb

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2020-4035
trivy image --scanners vuln IMAGE | grep CVE-2020-4035

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Advisories

Other references

Source: the record CVE-2020-4035 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.