fixes the "unsupported token: 169" error that occurs when executing stored procedures against Microsoft SQL #20618
+758
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this change does
This PR fixes the "unsupported token: 169" error that occurs when executing stored procedures against Microsoft SQL Server 2022 using Metasploit's MSSQL modules.
**Fixes GitHub issue #20607 **
Problem
EXEC sp_linkedservers;against SQL Server 2022Solution
mssql_parse_nbcrowmethodChanges Made
lib/rex/proto/mssql/client_mixin.rbspec/lib/rex/proto/mssql/client_mixin_spec.rbVerification
Prerequisites
Steps to verify the fix works:
msfconsoleuse auxiliary/admin/mssql/mssql_sqlset RHOSTS [target_sql_server_ip]set USERNAME [sql_username]set PASSWORD [sql_password]set SQL 'EXEC sp_linkedservers;'runset SQL 'SELECT @@version;'andrunAdditional verification steps:
set SQL 'EXEC xp_cmdshell "whoami";'andrunset SQL 'EXEC sp_databases;'andrunExpected Results
Before Fix:
After Fix:
Testing Environment
Compatibility Matrix
Documentation
The fix is self-documenting through code comments and maintains the existing API. No additional documentation is required as this is a bug fix that restores expected functionality.
Error Handling
Performance Impact
This fix enables proper enumeration of SQL Server environments using stored procedures, which is essential for penetration testing and security assessments against modern SQL Server installations.