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 Meterpreter sanity tests to CI #18210

Conversation

adfoster-r7
Copy link
Contributor

@adfoster-r7 adfoster-r7 commented Jul 21, 2023

Revival of #16357

Adds a larger suite of Meterpreter sanity tests to Github Actions

image

We also use Allure to generate an interactive test report:

image

Each generated test has the reproduction steps, and console output available for debugging purposes:

image

Under the hood the test suite spins up msfconsole as a child process and interacts with it via stdin/stdout. The main work flow is generating a payload, creating a listener, executing the payload, validating the stdout of the module. This approach was chosen over pure unit tests to help replicate more closely how a user would interact with msfconsole, and to catch semantic differences, such as autoloading disparity, between the existing test suite versus booting msfconsole directly

Verification

  • Review the code
  • Ensure the acceptance tests can be run locally

@adfoster-r7 adfoster-r7 force-pushed the add-meterpreter-sanity-tests-to-github-actions-refreshed branch from 7222e68 to c21fcc1 Compare July 21, 2023 18:23
.github/workflows/acceptance.yml Show resolved Hide resolved
.github/workflows/acceptance.yml Outdated Show resolved Hide resolved
@adfoster-r7 adfoster-r7 force-pushed the add-meterpreter-sanity-tests-to-github-actions-refreshed branch 3 times, most recently from e51b097 to e616b65 Compare July 27, 2023 19:05
@adfoster-r7 adfoster-r7 force-pushed the add-meterpreter-sanity-tests-to-github-actions-refreshed branch 3 times, most recently from 2fcf9fa to 0ed4075 Compare August 2, 2023 22:30
@adfoster-r7 adfoster-r7 marked this pull request as ready for review August 2, 2023 22:31
@adfoster-r7 adfoster-r7 force-pushed the add-meterpreter-sanity-tests-to-github-actions-refreshed branch from 0ed4075 to 9a3d068 Compare August 3, 2023 16:12
Comment on lines +116 to +117
REM pcap dependencies
powershell -Command "[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} ; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip', 'C:\Windows\Temp\WpdPack_4_1_2.zip')"
Copy link
Contributor

Choose a reason for hiding this comment

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

Just out of curiosity what's all this needed for? and any chance that version will disappear and break the job?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The pcaprub gem dependency needs it to compile during a bundle on windows

Comment on lines -106 to +105
if session_has_registry_ext
if session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_LOAD_KEY)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these changes related to the tests?

Copy link
Contributor Author

@adfoster-r7 adfoster-r7 Aug 4, 2023

Choose a reason for hiding this comment

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

Yes; I could extract this out - but made sense to land together in the context of this PR

@dwelch-r7 dwelch-r7 merged commit 6f7ebb3 into rapid7:master Aug 4, 2023
55 checks passed
@dwelch-r7 dwelch-r7 added the rn-enhancement release notes enhancement label Aug 4, 2023
@dwelch-r7
Copy link
Contributor

dwelch-r7 commented Aug 4, 2023

Old release notes before it was reverted:

Adds stability enhancements to Meterpreter payloads. Additionally adds a large suite of automated sanity tests to Github Actions that verify OSX/Windows/Linux/Python/Java/PHP Meterpreter payloads work.

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

Successfully merging this pull request may close these issues.

3 participants