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 arch and platform detection for mssql sessions #19112

Merged

Conversation

zgoldman-r7
Copy link
Contributor

@zgoldman-r7 zgoldman-r7 commented Apr 18, 2024

This adds platform and arch detection to MSSQL

To test:

  • create a session using mssql_login module with createsession=true
  • list sessions with sessions command
  • ensure platform and arch is correctly listed
  • ensure tests pass

Before:
Screenshot 2024-04-18 at 3 54 39 PM

After:
Screenshot 2024-04-18 at 3 53 43 PM

@zgoldman-r7 zgoldman-r7 force-pushed the mssql-arch-platform-detection branch from 1f1b46f to ff56e6f Compare April 18, 2024 20:37
Comment on lines 81 to 82
result[:arch] = ARCH_X86_64
result[:platform] = server_vars[:rows][0][0].match?('Windows') ? Msf::Platform::Windows.realname : Msf::Platform::Linux.realname
Copy link
Contributor

@adfoster-r7 adfoster-r7 Apr 18, 2024

Choose a reason for hiding this comment

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

It'd be good to follow the pattern of the other PRs (postgres+mysql), as well as adding tests (following the pattern of the postgres PR) 👍

@zgoldman-r7 zgoldman-r7 force-pushed the mssql-arch-platform-detection branch from ff56e6f to 777a065 Compare April 18, 2024 21:26
@zgoldman-r7 zgoldman-r7 marked this pull request as ready for review April 19, 2024 13:48
elsif os_data.match?('win')
platform = Msf::Platform::Windows
else
platform = Msf::Platform::Unknown
Copy link
Contributor

Choose a reason for hiding this comment

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

I think instead of unknown we'll just default to the string that the server gives back. We'll need to update the mysql logic here for consistency

elsif arch_data.match?('32-bit')
arch = ARCH_X86
else
arch = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

I think instead of unknown we'll just default to the string that the server gives back. We'll need to update the mysql logic here for consistency

@zgoldman-r7 zgoldman-r7 force-pushed the mssql-arch-platform-detection branch from 777a065 to 8eb5f45 Compare April 19, 2024 13:54
@zgoldman-r7 zgoldman-r7 force-pushed the mssql-arch-platform-detection branch from 8eb5f45 to 5c89b6a Compare April 19, 2024 13:54
@zgoldman-r7 zgoldman-r7 force-pushed the mssql-arch-platform-detection branch from 70a6624 to 0c6af95 Compare April 19, 2024 14:23
@cgranleese-r7 cgranleese-r7 self-assigned this Apr 19, 2024
@cgranleese-r7 cgranleese-r7 added enhancement rn-enhancement release notes enhancement labels Apr 19, 2024
@cgranleese-r7
Copy link
Contributor

Tested against mcr.microsoft.com/mssql/server:2022-preview-ubuntu-22.04 and worked as expected 👍

Before

image

After

image

@cgranleese-r7 cgranleese-r7 merged commit aa3181c into rapid7:master Apr 19, 2024
44 checks passed
@cgranleese-r7
Copy link
Contributor

Release Notes

Adds architecture and platform detection for MSSQL sessions.

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

Successfully merging this pull request may close these issues.

3 participants