skahwah / SQLRecon

A C# MS SQL toolkit designed for offensive reconnaissance and post-exploitation.
BSD 3-Clause "New" or "Revised" License
629 stars 108 forks source link

Executing RPC queries on linked SQL servers with an FQDN fails #21

Open skahwah opened 1 week ago

skahwah commented 1 week ago

There is currently an issue where any RPC queries that have an AT statement will fail on the destination server if the supplied hostname is a FQDN and not a NETBIOS name. This is because I am not wrapping the destination server in braces.

For example, this currently works:

EXECUTE ('sp_configure ''clr enabled'', 1; RECONFIGURE;') AT sql02;

Whereas, this currently fails:

EXECUTE ('sp_configure ''clr enabled'', 1; RECONFIGURE;') AT sql02.corp.local;

However, correcting the query to the following will allow it to work:

EXECUTE ('sp_configure ''clr enabled'', 1; RECONFIGURE;') AT [sql02.corp.local];

The change needs to be made here. It's a quick fix, and I will take care of it as soon as possible.

skahwah commented 1 week ago

This has been completed in the 3.9-dev branch