DAFT icon indicating copy to clipboard operation
DAFT copied to clipboard

Tool fails to connect if master database's collation is case-sensitive

Open mgeeky opened this issue 3 years ago • 0 comments

There are scenarios in which master database has set COLLATION to Case-Sensitive, which might result in following rather cryptic connection error message:

] SQL01: SQL Exception Occured: Cannot open database "Master" requested by the login. The login failed.
Login failed for user 'john.doe'.

To check if master is case-sensitive run the following query:

select SERVERPROPERTY('COLLATION');

and look for CS = Case-Sensitive or CI = Case-Insensitive.

That happened to me during the engagement whilst authenticating via SQL Server Authentication.

Simply changing master's hardcoded database name was enough to successfully authenticate and operate using the tool:

https://github.com/NetSPI/DAFT/blob/508797407d114d7a38c1b1c25e47b19fa0a6aceb/DAFT/SQLConnection.cs#L16

This error costed me several hours troubleshooting and banging my head against the wall. I think, that both PowerUpSQL and DAFT could benefit from a global "query-maintenance" functionality adapating database name case-sensitiveness based on supplied parameters.

Kind regards, Mariusz

mgeeky avatar Aug 17 '22 22:08 mgeeky