upatch.dev

CVE-2026-86123

SQL Chat Unauthenticated Database-Connection Proxy in the /api/connection Endpoints

Refuses SQL Chat connections to loopback, link-local and private IP addresses to mitigate CVE-2026-86123.

Critical 9.4Vetted

EPSS 0.5%: the estimated chance this CVE is exploited in the next 30 days, as of 25 Nov 2026.

At a glance

CVE-2026-86123 is a critical (CVSS 9.4) vulnerability in SQL Chat, published 5 September 2026. A vetted upatch, cve-2026-86123-ssrf-block, blocks it on running Linux machines with shirudo until SQL Chat is upgraded.

Severity
Critical 9.4 CVSS 4.0
Chance of exploitation
0.5% in the next 30 days (EPSS, 25 Nov 2026)
Known exploited
No, not on CISA’s KEV list
Weakness
CWE-918
Affected software
SQL Chat (sqlchat)
Upatch status
Vetted, merged into the registry
How to apply
Build, sign and roll out with shirudo

Overview

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.

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.

Sources

More references from NVD (5)

Mitigation

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.

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.

The policy

121 lines of BPF C, attached at lsm/socket_connect.

// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause

#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <bpf/bpf_core_read.h>
#include <bpf/bpf_endian.h>

#define EPERM		1
#define AF_INET		2
#define AF_INET6	10

char _license[] SEC("license") = "Dual BSD/GPL";

struct {
	__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
	__uint(max_entries, 1);
	__type(key, __u32);
	__type(value, __u64);
} refused SEC(".maps");

static __always_inline void count_refused(void)
{
	__u32 key = 0;
	__u64 *value = bpf_map_lookup_elem(&refused, &key);

	if (value)
		__sync_fetch_and_add(value, 1);
}

static __always_inline int earlier_verdict(int ret)
{
	return ret >= -4095 && ret < 0 ? ret : -EPERM;
}

static __always_inline bool current_is_node(void)
{
	struct task_struct *task = bpf_get_current_task_btf();
	const struct dentry *exe = BPF_CORE_READ(task, mm, exe_file, f_path.dentry);
	const unsigned char *name = BPF_CORE_READ(exe, d_name.name);
	char buf[8] = {};

	if (!exe || BPF_CORE_READ(exe, d_name.len) != 4 || !name)
		return false;
	if (bpf_probe_read_kernel_str(buf, sizeof(buf), name) < 0)
		return false;
	return buf[0] == 'n' && buf[1] == 'o' && buf[2] == 'd' && buf[3] == 'e';
}

static __always_inline bool is_internal_ipv4(__u32 ip)
{
	if (ip == 0)
		return true;
	if ((ip & 0xff000000U) == 0x7f000000U)
		return true;
	if ((ip & 0xff000000U) == 0x0a000000U)
		return true;
	if ((ip & 0xfff00000U) == 0xac100000U)
		return true;
	if ((ip & 0xffff0000U) == 0xc0a80000U)
		return true;
	if ((ip & 0xffff0000U) == 0xa9fe0000U)
		return true;
	return false;
}

static __always_inline bool is_internal_ipv6(const struct in6_addr *addr6)
{
	__u32 w0 = bpf_ntohl(addr6->in6_u.u6_addr32[0]);
	__u32 w1 = bpf_ntohl(addr6->in6_u.u6_addr32[1]);
	__u32 w2 = bpf_ntohl(addr6->in6_u.u6_addr32[2]);
	__u32 w3 = bpf_ntohl(addr6->in6_u.u6_addr32[3]);

	if (w0 == 0 && w1 == 0 && w2 == 0 && (w3 == 0 || w3 == 1))
		return true;
	if (w0 == 0 && w1 == 0 && w2 == 0x0000ffffU)
		return is_internal_ipv4(w3);
	if ((w0 & 0xfe000000U) == 0xfc000000U)
		return true;
	if ((w0 & 0xffc00000U) == 0xfe800000U)
		return true;
	return false;
}

SEC("lsm/socket_connect")
int BPF_PROG(cve_2026_86123_connect, struct socket *sock,
	     struct sockaddr *address, int addrlen, int ret)
{
	__u16 family = 0;

	if (ret)
		return earlier_verdict(ret);
	if (!address || addrlen < (int)sizeof(family))
		return 0;
	if (bpf_probe_read_kernel(&family, sizeof(family), &address->sa_family))
		return 0;
	if (family == AF_INET) {
		struct sockaddr_in sin = {};

		if (addrlen < (int)sizeof(sin) ||
		    bpf_probe_read_kernel(&sin, sizeof(sin), address))
			return 0;
		if (!is_internal_ipv4(bpf_ntohl(sin.sin_addr.s_addr)))
			return 0;
	} else if (family == AF_INET6) {
		struct sockaddr_in6 sin6 = {};

		if (addrlen < (int)sizeof(sin6) ||
		    bpf_probe_read_kernel(&sin6, sizeof(sin6), address))
			return 0;
		if (!is_internal_ipv6(&sin6.sin6_addr))
			return 0;
	} else {
		return 0;
	}
	if (!current_is_node())
		return 0;
	count_refused();
	return -EPERM;
}

Process

How this upatch was written, checked and reviewed, from the registry’s history.

  1. 5 Sept 2026CVECVE published
  2. 25 Nov 2026CommitCommitted directlyAdd CVE-2026-86123romanlab

No human review is recorded on GitHub for this upatch yet.

Evidence

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
StateUnauthenticated /api/connection/test SSRF blocked
Before loadingno
Upatch loadedyes
After unloadingno
tools-test.log Output of tools/test --setup showing the SSRF probe reaching the internal listener before and after, and refused with EPERM while the upatch was loaded.
tools/test --setup, 2026-11-25T15:44:20Z
Target: shirudo test VM, Linux 7.4-shirudo-ci-20261123, x86_64, swtpm
cve-2026-86123
  setup   done         SQLCHAT_URL=http://127.0.0.1:3000
  before  reached      SQL Chat connected to internal listener 127.0.0.1:36213 without authentication (HTTP 400)
  loaded  blocked      SQL Chat connection to 127.0.0.1:33079 was refused with EPERM (HTTP 400)
  after   reached      SQL Chat connected to internal listener 127.0.0.1:46095 without authentication (HTTP 400)
  PASS: reached before, blocked while loaded, reached again after

Use it

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
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
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>