{"schemaVersion":3,"id":"CVE-2019-9039","aliases":["GHSA-g622-r636-qfqh"],"status":"published","duplicateOf":null,"title":null,"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.","dates":{"published":"2019-06-26T18:55:45.000Z","modified":"2024-08-04T21:38:45.151Z","reserved":null,"kevAdded":[],"kevDue":[]},"cvss":{"headline":{"score":9.8,"severity":"critical","version":"3.0","versionLabel":"v3.0","source":"NVD","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","computed":false,"selection":"backend-summary"},"metrics":[{"version":"3.0","versionLabel":"v3.0","source":"OSV · Go","score":9.8,"severity":"critical","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","exploitability":10,"impact":9.8,"computed":true},{"version":"3.0","versionLabel":"v3.0","source":"NVD","score":9.8,"severity":"critical","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","exploitability":null,"impact":null,"computed":false},{"version":"2.0","versionLabel":"v2.0","source":"NVD","score":7.5,"severity":"high","vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","exploitability":null,"impact":null,"computed":false}]},"epss":{"probability":0.02741,"percentile":0.85959,"severity":"low","asOf":"2026-10-19T00:00:00.000Z","change":{"pp":0,"baselineDate":"2026-09-19T00:00:00.000Z","baselineScore":0.02741},"history":[{"date":"2026-09-14T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-15T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-16T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-17T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-18T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-19T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-20T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-21T00:00:00.000Z","score":0.02408,"percentile":null},{"date":"2026-09-22T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.02741,"percentile":0.85959}],"last30":[{"date":"2026-09-19T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-20T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-21T00:00:00.000Z","score":0.02408,"percentile":null},{"date":"2026-09-22T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.02741,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.02741,"percentile":0.85959}]},"kev":{"state":"not-listed","entries":[],"listedCount":0,"totalCatalogs":3,"catalogs":[{"source":"cisa","label":"CISA","listed":false,"entry":null},{"source":"enisa","label":"ENISA","listed":false,"entry":null},{"source":"circl","label":"CIRCL","listed":false,"entry":null}]},"ransomware":{"state":"none-recorded","sources":[]},"exploits":[{"id":"REF_7E6CF4BCEA8B5A11","name":"Exploit Reference (research.hisolutions.com)","source":"reference","url":"https://research.hisolutions.com/2019/06/n1ql-injection-in-couchbase-sync-gateway-cve-2019-9039/","maturity":"unknown","reliabilityScore":0.2,"verified":false,"type":null,"platforms":[],"requiresAuth":null,"exploitdb":null,"metasploit":null}],"exploitCount":1,"weaknesses":[{"id":"CWE-89","name":"Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')","description":"The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.","type":"weakness","status":"Stable","abstraction":"Base","likelihoodOfExploit":"High","url":"https://cwe.mitre.org/data/definitions/89.html"}],"affected":[{"vendor":"couchbase","product":"sync_gateway","name":"sync gateway","label":"sync_gateway","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"2.1.2","noFixRecorded":false,"fixedIn":null}],"versionsText":"2.1.2","eol":null,"hubHref":"/vendor/couchbase/sync_gateway"},{"vendor":"github.com/couchbase","product":"sync_gateway","name":"github.com/couchbase/sync_gateway","label":"sync_gateway","ecosystem":"Go","cpePart":null,"purl":"pkg:golang/github.com/couchbase/sync_gateway","purlType":"golang","versions":[{"text":"< 2.5.0","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 2.5.0","eol":null,"hubHref":null}],"affectedCount":2,"eol":{"hasEol":false,"count":0},"references":[{"url":"https://docs.couchbase.com/sync-gateway/2.5/release-notes.html","label":"docs.couchbase.com/sync-gateway/2.5/release-notes.html","hostname":"docs.couchbase.com","tags":["X Refsource CONFIRM","WEB","Release Notes","Vendor Advisory"]},{"url":"https://research.hisolutions.com/2019/06/n1ql-injection-in-couchbase-sync-gateway-cve-2019-9039/","label":"research.hisolutions.com/2019/06/n1ql-injection-in-couchbase-sync-gateway-cve-2019-9039/","hostname":"research.hisolutions.com","tags":["X Refsource MISC","Exploit","Third Party Advisory"]},{"url":"https://www.couchbase.com/resources/security#SecurityAlerts","label":"www.couchbase.com/resources/security","hostname":"www.couchbase.com","tags":["X Refsource MISC","WEB"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2019-9039","label":"nvd.nist.gov/vuln/detail/CVE-2019-9039","hostname":"nvd.nist.gov","tags":["Advisory"]},{"url":"https://github.com/couchbase/sync_gateway/commit/97adb5b496aa96aa70398018ea96da913ffd8d8c","label":"github.com/couchbase/sync_gateway/commit/97adb5b496aa96aa70398018ea96da913ffd8d8c","hostname":"github.com","tags":["WEB"]},{"url":"https://research.hisolutions.com/2019/06/n1ql-injection-in-couchbase-sync-gateway-cve-2019-9039","label":"research.hisolutions.com/2019/06/n1ql-injection-in-couchbase-sync-gateway-cve-2019-9039","hostname":"research.hisolutions.com","tags":["WEB"]}],"lineage":{"upstream":[],"downstream":[],"duplicates":[],"related":[]},"timeline":[{"kind":"published","date":"2019-06-26T18:55:45.000Z","label":"Published","detail":"Vulnerability first disclosed.","source":null},{"kind":"modified","date":"2024-08-04T21:38:45.151Z","label":"Last modified","detail":"Vulnerability information updated.","source":null}],"risk":{"score":70,"level":"high","profile":"Default","thresholds":{"critical":75,"high":50,"medium":25,"low":10}},"meta":{"dataAsOf":"2026-10-20T06:58:36.516Z","stale":false,"partial":false}}