Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for newer sqlcmd versions #18774

Merged

Conversation

adfoster-r7
Copy link
Contributor

Updates post/windows/gather/credentials/mssql_local_hashdump and post/windows/manage/mssql_local_auth_bypass to work with newer versions of sqlcmd

Verification

Ensure that these post modules work

@@ -99,7 +99,7 @@ def check_osql
# @return [Boolean] true if sqlcmd is present
def check_sqlcmd
result = run_cmd('sqlcmd -?')
result =~ /SQL Server Command Line Tool/i
result =~ /SQL Server Command Line Tool|Version v\d+/i
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, my ssqlcmd -? output only had the help menu and Version vx.y.z

OptString.new('DB_USERNAME', [true, 'New sysadmin login', '']),
OptString.new('DB_PASSWORD', [true, 'Password for new sysadmin login', '']),
OptString.new('DB_USERNAME', [true, 'New sysadmin login', nil]),
OptString.new('DB_PASSWORD', [true, 'Password for new sysadmin login', nil]),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you ran this module, the module would run with an empty db_username and db_password - which wouldn't work

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the param not just be removed then, it's required so if we just don't give it one it should force you to set it right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I preferenced explicitness here

zgoldman-r7
zgoldman-r7 previously approved these changes Jan 31, 2024
@zgoldman-r7 zgoldman-r7 self-requested a review January 31, 2024 20:30
@zgoldman-r7 zgoldman-r7 dismissed their stale review January 31, 2024 20:31

accidental approval

@adfoster-r7 adfoster-r7 force-pushed the add-support-for-newer-sqlcmd-versions branch from ada1307 to 5fa1ce8 Compare February 12, 2024 11:51
@cgranleese-r7 cgranleese-r7 self-assigned this Feb 12, 2024
@cgranleese-r7
Copy link
Contributor

cgranleese-r7 commented Feb 12, 2024

Tested and looks good to me 👍

windows/gather/credentials/mssql_local_hashdump
image

windows/manage/mssql_local_auth_bypass

Note

The errors I believe are because we're running from an account that isn't an admin in the database

image

@cgranleese-r7 cgranleese-r7 added the rn-fix release notes fix label Feb 12, 2024
@cgranleese-r7 cgranleese-r7 merged commit b40f36e into rapid7:master Feb 12, 2024
50 checks passed
@cgranleese-r7
Copy link
Contributor

cgranleese-r7 commented Feb 12, 2024

Release Notes

Updates the following modules to now work with newer versions of sqlcmd,
post/windows/gather/credentials/mssql_local_hashdump and post/windows/manage/mssql_local_auth_bypass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn-fix release notes fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants