SQL Browser detection for MSSQL protocol based on mrsheepsheep work#1200
SQL Browser detection for MSSQL protocol based on mrsheepsheep work#1200Dfte wants to merge 5 commits into
Conversation
Signed-off-by: Deft_ <aurelien.chalot@protonmail.com>
Signed-off-by: Deft_ <aurelien.chalot@protonmail.com>
|
Nice one, thanks! I'll take a closer look in the evening |
|
So from our chat and looking at the code, Imo we should abstract the information about the instances from the technique itself, meaning that I would:
TLDR; The end user doesn't specifically need to know how we enumerated the instances (sqlbrowser), just that there are more than 1 and that you can switch. We can print information that there is an "SQLBrowser" via some info/debug log if needed/wanted. |
|
Problem is we can't do that for now because tds.py does not support SQL over named pipes. Hence, if the first instance is a named pipe one, we get blocked. To me we shouldn't specify any instance by default. Instead we tell the user the sql browser is running, provide an option to list the instances and then another option --instance to select which one he wants to use. Then we'll have to make a new connection form scratch. |
patch broadcast address sql browser udp Signed-off-by: Deft_ <aurelien.chalot@protonmail.com>
|
Last PR patches the ip.py parse_targets function which was incorrectly passing the broadcast address to scan. From: for ip in ip_network(target, strict=False)to for ip in ip_network(target, strict=False).hosts()Thx @azoxlpf for the information (eyes) |
Not being able to support named pipes is unfortunate. Any experience how common that is? Perhaps we can get away to just skip these for now until someone invests the time to implement support for it. We could still try to select the instance and just tell the user "eh sorry, that instance is running via named pipes which isn't supported yet". Otherwise, how would you access the instances? What would be the argument against selecting the first (possible) instance we get by default? Just makes it less work if you have the sqlbrowser available. To alert the user that there are others as well, we could do something like make the instance banner yellow if >2 are available, else green (similar to signing/smbv1 etc.). |
I think that's the biggest question of the feature : are SQL browser and named pipes widely used or is it just a niche feature ? I'll ask the colleagues to run those scans on the next AD assessments in the following weeks to see if they find any. |
I know that we definitely have seen them, as my colleague told me that nessus reports the sql browser as well. I have no idea tho what instances are typically running behind these or even if there are more instances than just the default one. |
|
I'd say that even if it's a niche feature, being able to expose these instances is important as it could be, during an internal assessment, the last resort to compromise the domain :P! |
Description
This PR is an original idea from @mrsheepsheep which allows connecting to the SQL browser if it is running. Basically, the SQL browser is listening on UDP port 1434 and can be reached to list all SQL instances available on a MSSQL server. Considering this SQL browser can be reached anonymously, it becomes a great asset for enumeration purposes.
This PR implements three differents usages:
Auto discovery of the SQL browser means connecting to a UDP port with a default timeout of 5 secondes. For that reason it is possible to disable the discovery using the following nxc config option:
Type of change
Insert an "x" inside the brackets for relevant items (do not delete options)
Checklist (WIP, none of these checks were made yet):
Insert an "x" inside the brackets for completed and relevant items (do not delete options)
poetry run ruff check ., use--fixto automatically fix what it can)tests/e2e_commands.txtfile if necessary (new modules or features are required to be added to the e2e tests)