CVE-2019-9039 SQL Injection in Couchbase Sync Gateway
Attackers can inject N1QL queries via REST API parameters to extract sensitive data or cause denial of service in Couchbase Sync Gateway.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2019-9039?
CVE-2019-9039 is a critical SQL injection vulnerability in n/a, published on 26 Jun 2019. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
In Couchbase Sync Gateway 2.1.2, an attacker with access to the Sync Gateway’s public REST API was able to issue additional N1QL statements and extract sensitive data or call arbitrary N1QL functions through the parameters "startkey" and "endkey" on the "_all_docs" endpoint. By issuing nested queries with CPU-intensive operations they may have been able to cause increased resource usage and denial of service conditions. The _all_docs endpoint is not required for Couchbase Mobile replication and external access to this REST endpoint has been blocked to mitigate this issue. This issue has been fixed in versions 2.5.0 and 2.1.3.
Weakness: CWE-89
Which versions are affected by CVE-2019-9039?
2 open source packages ship an affected version, including github.com/couchbase/sync_gateway. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
github.com/couchbase/sync_gateway Go | All versions | 2.5.0 |
github.com/couchbase/sync_gateway Go | All versions | 2.5.0 |
Products include Couchbase Sync Gateway.
How do I fix CVE-2019-9039?
Upgrade github.com/couchbase/sync_gateway to 2.5.0 or later.
Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.
Is CVE-2019-9039 being exploited?
There is no known exploitation of CVE-2019-9039 in the wild and no public exploit code.
Other vulnerabilities in n/a
Sources
Also known as GHSA-g622-r636-qfqh.