Categories
CVE-2020-4035

SQL Injection in @nozbe/watermelondb (CVE-2020-4035)

Summary

SQL injection in @nozbe/watermelondb (CVE-2020-4035). Risk of unauthorized operations or information disclosure. Exploitable via database.adapter.destroyDeletedRecords. Mitigation: upgrade to 0.16.2 or later.

Original description

The description as published by the source.

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

Source: OSV.dev (Open Source Vulnerabilities) NVD GitHub Advisory OSV

Auto-generated summary

Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.

A vulnerability tracked as CVE-2020-4035 has been found in @nozbe/watermelondb.
Attackers can target a specific entry point like database.adapter.destroyDeletedRecords over the network to misuse the product.
Risk of unauthorized operations or information disclosure.
What to do: upgrade @nozbe/watermelondb to 0.16.2 or later.
If unsure, ask your IT team or search "@nozbe/watermelondb CVE-2020-4035" on the vendor's site.

CVE-2020-4035 (@nozbe/watermelondb) — CWE-89
Attack vector: remote (network-reachable) / no user interaction
Attack surface: database.adapter.destroyDeletedRecords
Patched: 0.16.2 — apply immediately
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.

❓ What is the problem

SQL injection (CWE-89) exists in @nozbe/watermelondb. Attackers reach the vulnerable code path via database.adapter.destroyDeletedRecords.

📍 Affected scope

Check the vendor advisory for the affected versions of @nozbe/watermelondb. Attack surface: database.adapter.destroyDeletedRecords.

🔥 Severity

Severity: ?. Risk of unauthorized operations or information disclosure.

🔧 How to fix

Update to 0.16.2.

🛡️ Workaround

Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.

🔍 Detection

Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r '@nozbe/watermelondb' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.

Response actions

Concrete steps and command examples for SOC/SRE teams to execute in order

  1. 1
    Identify exposure identify
    grep -r '@nozbe/watermelondb' . | grep -v node_modules

    リポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で @nozbe/watermelondb を grep し、稼働しているサービス・バージョンを把握する。

  2. 2
    Apply patch patch
    Upgrade @nozbe/watermelondb to 0.16.2

    ステージング環境で 0.16.2 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。

  3. 3
    Post-deployment verification verify
    Confirm patched version is live in production

    パッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。

Affected packages

npm @nozbe/watermelondb
[{"type":"SEMVER","events":[{"introduced":"0.16.0"},{"fixed":"0.16.2"}]}]

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details