Skip to content
SSRF Write-up Advanced

Oops, I Weaponized the Database: Abusing AI Features in SQL Server 2025

SQL Server 2025's new AI features, notably the external REST endpoint procedure and external model definitions, let a highly privileged database account send data to arbitrary HTTPS hosts and coerce NTLM authentication over SMB. An attacker with sysadmin rights could exfiltrate tables and files, persist via triggers, and build a command-and-control channel inside the database engine.

Justin Kalnasy Follow

Published on specterops.io

I’m a big fan of leveraging Microsoft SQL Server during offensive engagements because it’s seemingly always over-privileged and under-monitored, which is ideal for lateral movement. Administrators routinely expose credentials in file shares, the service accounts running MSSQL often have excessive rights, and the…

Justin Kalnasy, on specterops.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the new AI features grant a privileged database account native outbound HTTPS and SMB request capability with large payloads and no restriction on destination, so existing post-exploitation primitives gain a quieter transport.

Impact

An attacker holding a sysadmin database account could exfiltrate large tables and files, persist via triggers, coerce NTLM authentication, and run a native C2 channel; Microsoft judged the SMB coercion not to cross a security boundary, so it remains.

What the attacker needed

Sysadmin role on SQL Server 2025; external REST endpoint enabled; attacker-controlled HTTPS server with valid cert

The fix

Should be fixed by restricting which accounts may use the AI features, limiting outbound destinations and payload sizes, and monitoring or disabling the external REST endpoint and external model creation.

How it was found

  1. Enable the external REST endpoint feature on the instance
  2. Query a table and format the rows as a JSON payload
  3. Send the payload to an attacker-controlled HTTPS server via the external REST procedure
  4. Receive the table contents on the web server

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

SQL Server is a database program, and the 2025 version added features that let it talk to outside web services and AI models. The author shows that someone who already controls the database can use those same features to quietly send stolen data out and receive commands back, because the database is allowed to make outbound connections. This is not a break-in by itself; it needs an already powerful database login.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.