Skip to content

MSSQL module fails with "unsupported token: 169" against MSSQL 2022 (RTM) - 16.0.1000.6 (X64) #20607

@supremo369

Description

@supremo369

Can't execute some MSSQL commands

Steps to reproduce

Try to run the module auxiliary/admin/mssql/mssql_sql with set SQL 'EXEC sp_linkedservers;' or any other sp/xp command. Commands like SELECT 1; or SELECT @@version; are working

System Info

My linux version:
Linux 6.12.25-amd64 #1 SMP PREEMPT_DYNAMIC Kali 6.12.25-1kali1 (2025-04-30) x86_64 GNU/Linux

Target info:
Microsoft SQL Server 2022 (RTM) - 16.0.1000.6 (X64)
Copyright (C) 2022 Microsoft Corporation
Enterprise Evaluation Edition (64-bit) on Windows Server 2022 Datacenter 10.0 (Build 20348: ) (Hypervisor)

Expected behavior

it should return info about linked servers, something like:

SRV_NAME            SRV_PROVIDERNAME   SRV_PRODUCT   SRV_DATASOURCE      SRV_PROVIDERSTRING   SRV_LOCATION   SRV_CAT   
-----------------   ----------------   -----------   -----------------   ------------------   ------------   -------   
DC01                SQLNCLI            SQL Server    DC01                NULL                 NULL           NULL      

DC02.domainname.ext   SQLNCLI            SQL Server    DC02.domainname.ext   NULL                 NULL           NULL      

Linked Server       Local Login       Is Self Mapping   Remote Login   
-----------------   ---------------   ---------------   ------------   
DC02.domainname.ext   domainname\username                 0   dc01_sql_svc   

Current behavior

It returns unsupported token: 169. Previous states [:mssql_parse_tds_reply].

Metasploit version

Framework: 6.4.90-dev
Console: 6.4.90-dev

Additional Information

I tried with impacket-mssqlclient an it works fine.
I din't get any extra information with the debug parameter, this is all the info it shows:

[*] Running module against 10.10.11.12
[*] 10.10.11.12:1433 - SQL Query: EXEC sp_linkedservers;
[-] 10.10.11.12:1433 - unsupported token: 169. Previous states: [:mssql_parse_tds_reply]
[*] Auxiliary module execution completed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions