← Lab /Security & privacy

SQL Copilot can be abused to elevate a database owner to sysadmin

SQL Copilot’s read-only mode can be bypassed, allowing arbitrary T-SQL execution and privilege escalation.

Security & privacy Embrace The Red 30 Sep 2026 Disclosure Real-world evidence

Published as “From SELECT to SYSADMIN with SQL Copilot (CVE-2026-65669)”

Why it matters

If exploited, an attacker can gain sysadmin rights on the SQL Server, compromising the entire database environment.

Summary

The researcher reverse-engineered the ReadFromDatabase and RestoreVerifyBackupFile tools in SQL Copilot and discovered that the read-only enforcement relies on a fragile regex blocklist. By crafting prompts that evade the blocklist, they executed arbitrary T-SQL, including sp_executesql, to run write operations and exfiltrate data via xp_dirtree. They further showed that lower-privileged users can embed malicious instructions in extended-property metadata (AGENTS.md/CONSTITUTION.md), which Copilot later executes with higher-privileged connections, enabling a db_owner to become sysadmin. The evidence consists of lab demos on a test SQL Server instance, confirming the vulnerability (CVE-2026-65669).

Caveats 3

  • At first glance, the model did refuse obvious requests to modify data or those that have side-effects.
  • Blocklists are fragile security controls.
  • The read-only enforcement is a regex-based classifier, not a security boundary.

What’s new here 4

  • Identified that SQL Copilot’s read-only enforcement is a regex-based blocklist that can be bypassed.
  • Demonstrated arbitrary T-SQL execution and data exfiltration via the ReadFromDatabase and RestoreVerifyBackupFile tools.
  • Showed indirect prompt injection through extended-property metadata (AGENTS.md/CONSTITUTION.md) leading to privilege escalation from db_owner to sysadmin.
  • Provided mitigation guidance recommending proper permission enforcement and disabling Copilot for high-privilege connections.