skahwah/SQLRecon

TestAuthentication.cs calls Environment.Exit

dmchell opened this issue · 2 comments

File affected: SQLRecon/SQLRecon/authentication/TestAuthentication.cs

The TestAuthentication class calls Environment.Exit(0) as follows:

Console.WriteLine(“[!] Failed! ” + user + ” can not log in to ” + sqlServer + “\n”);
Environment.Exit(0);
return null;

This is generally recognised as "not great practice" as it may cause beacons to exit if the tool is run over a c2.

This can be avoided by some CLR harnesses when used correctly (eg. https://www.mdsec.co.uk/2020/08/massaging-your-clr-preventing-environment-exit-in-in-process-net-assemblies/) but may not necessarily be used by all, leading to the beacon exiting.

Good spot. Thanks Dom. Fixed in 2.1.1.

Wow thanks for the fast fix! 👍