# CVE-2026-86123: SQL Chat Unauthenticated Database-Connection Proxy in the /api/connection Endpoints

The Markdown version of <https://upatch.dev/cve/CVE-2026-86123>. Last updated 25 Nov 2026.

## At a glance

CVE-2026-86123 is rated Critical 9.4 (CVSS 4.0, CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:H/SI:H/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X). It affects SQL Chat (sqlchat) and was published on 5 Sept 2026. It is not in CISA's Known Exploited Vulnerabilities catalog. Its EPSS score is 0.5%: the estimated chance it is exploited in the next 30 days, as of 25 Nov 2026. The upatch `cve-2026-86123-ssrf-block` mitigates it, and is vetted (merged into the registry).

A upatch is a signed BPF program that shirudo loads into a running Linux kernel to block the code path this CVE's exploit takes. It holds the line until the fix ships; it does not replace patching.

## The vulnerability

CVE-2026-86123, "SQL Chat Unauthenticated Database-Connection Proxy in the /api/connection Endpoints", was published on 5 September 2026. SQL Chat exposes four API routes under `/api/connection` (`POST /api/connection/execute`, `POST /api/connection/test`, `POST /api/connection/db_schema` and `POST /api/connection/db`) that accept a client-supplied `connection` object (`host`, `port`, `username`, `password` and `engineType`) in the request body and open a connection from the server through `newConnector(connection)` in `src/lib/connectors/`. None of the four handlers checks authentication, and the connectors apply no host allowlist or restriction on loopback, RFC 1918 private networks or link-local metadata addresses. Any unauthenticated client that can reach the SQL Chat server can use it to probe internal ports or execute SQL statements against internal PostgreSQL, MySQL, TiDB, OceanBase or SQL Server databases.

### Official description

SQL Chat contains four unauthenticated API endpoints that accept client-supplied database connection parameters and execute arbitrary SQL queries against attacker-specified hosts. Attackers can connect to internal databases, execute SQL commands, enumerate schemas, and pivot into the server's network without authentication.

## What the upatch does

One BPF LSM program on `lsm/socket_connect` inspects the destination address of `connect()` calls and returns `-EPERM` when the calling process's executable is named `node` and the destination is an internal IPv4 or IPv6 address:

| Family     | Refused destination ranges                                                                                                                                                                  |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AF_INET`  | `0.0.0.0/32`, `127.0.0.0/8` (loopback), `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16` (RFC 1918 private networks), and `169.254.0.0/16` (link-local and cloud metadata `169.254.169.254`) |
| `AF_INET6` | `::/128`, `::1/128` (loopback), `::ffff:0:0/96` mapped to any of the IPv4 ranges above, `fc00::/7` (unique local), and `fe80::/10` (link-local)                                             |

The program checks the socket family and destination IP range first, and only checks whether the current task's executable is `node` when the destination falls inside a restricted internal range. Refusals are counted in the `refused` per-CPU array map at key 0.

The policy: [`cve-2026-86123-ssrf-block.bpf.c`](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-86123), 121 lines of BPF C attached at `lsm/socket_connect`, licensed GPL-2.0 OR BSD-2-Clause.

## Side effects

- Any `node` process on the machine is refused outbound connections (`-EPERM`) to loopback, RFC 1918 private, link-local and cloud metadata IP addresses.
- SQL Chat requests to `/api/connection/test`, `/api/connection/execute`, `/api/connection/db_schema` and `/api/connection/db` that target internal or loopback addresses fail with HTTP 400 (`EPERM`), while connections to public database hosts continue to work.
- If SQL Chat is deployed in `usedb` mode with its own backing PostgreSQL database on loopback or a private IP on the same host, `node` cannot connect to that backing database over TCP while the upatch is loaded unless it uses a Unix domain socket.

## Preemption model and cost

The program holds no locks and shares only the per-CPU `refused` counter, which is updated with `__sync_fetch_and_add`, making it safe under every preemption model including `PREEMPT_LAZY`, `PREEMPT_DYNAMIC` and `PREEMPT_RT`. Connections to public addresses exit after reading the socket address family and IPv4/IPv6 prefix without inspecting task structures.

## Affected versions

SQL Chat (`pkg:github/sqlchat/sqlchat`):

| Branch | Affected                                                | Fixed in         |
| ------ | ------------------------------------------------------- | ---------------- |
| `main` | up to commit `665af875413affadfeefff81794f1d7758782bc2` | unfixed upstream |

Kernels: any Linux kernel with BPF LSM and BTF enabled.

## How it was tested

On SQL Chat commit 665af875413affadfeefff81794f1d7758782bc2, the loaded upatch refused unauthenticated POST /api/connection/test SSRF connections from node to an internal loopback listener with EPERM.

- **Tested:** 25 Nov 2026
- **Target:** SQL Chat 665af875413affadfeefff81794f1d7758782bc2 on Node.js 20.18.1, listening on 127.0.0.1:3000
- **Kernel:** 7.4-shirudo-ci-20261123
- **Architecture:** x86_64

### Results

| State           | Unauthenticated /api/connection/test SSRF blocked |
| --------------- | ------------------------------------------------- |
| Before loading  | no                                                |
| Upatch loaded   | yes                                               |
| After unloading | no                                                |

## How to apply

Build the upatch from source, sign it with your own shirudo key, and publish it to your own OCI registry. Machines that follow your upatch tree load it within about a minute.

Build and sign:

```sh
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-86123
```

Publish and roll out:

```sh
shirudo bpm push build/packages/cve-2026-86123-1.0.0.bee oci://<registry>/<namespace>/cve-2026-86123 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-86123-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>
```

## Review

- Contributors: romanlab.
- Reviewers: none recorded yet.

## Sources and links

- [CVE-2026-86123 record (CVE API)](https://cveawg.mitre.org/api/cve/CVE-2026-86123)
- [VulnCheck advisory](https://www.vulncheck.com/advisories/sql-chat-unauthenticated-database-connection-proxy-in-the-api-connection-endpoints)
- [SQL Chat issue #189](https://github.com/sqlchat/sqlchat/issues/189)
- [SQL Chat vulnerable `execute.ts` at `665af875413affadfeefff81794f1d7758782bc2`](https://github.com/sqlchat/sqlchat/blob/665af875413affadfeefff81794f1d7758782bc2/src/pages/api/connection/execute.ts)
- [SQL Chat vulnerable `test.ts` at `665af875413affadfeefff81794f1d7758782bc2`](https://github.com/sqlchat/sqlchat/blob/665af875413affadfeefff81794f1d7758782bc2/src/pages/api/connection/test.ts)

### Links

- [CVE-2026-86123 on upatch.dev](https://upatch.dev/cve/CVE-2026-86123) (this page, as HTML)
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-86123)
- [CVE.org](https://www.cve.org/CVERecord?id=CVE-2026-86123)
- [CWE-918](https://cwe.mitre.org/data/definitions/918.html)
- Upatch source: [upatches/cve-2026-86123](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-86123)

### More references from NVD (5)

- [github.com](https://github.com/sqlchat/sqlchat)
- [github.com](https://github.com/sqlchat/sqlchat/blob/665af875413affadfeefff81794f1d7758782bc2/src/pages/api/connection/execute.ts)
- [github.com](https://github.com/sqlchat/sqlchat/blob/665af875413affadfeefff81794f1d7758782bc2/src/pages/api/connection/test.ts)
- [github.com](https://github.com/sqlchat/sqlchat/issues/189)
- [vulncheck.com](https://www.vulncheck.com/advisories/sql-chat-unauthenticated-database-connection-proxy-in-the-api-connection-endpoints)
