Skip to content

[DRAFT] Add malleablec2 tests - #21660

Merged
adfoster-r7 merged 2 commits into
rapid7:6.5from
cgranleese-r7:add-malleable-profile-tests
Jul 18, 2026
Merged

[DRAFT] Add malleablec2 tests#21660
adfoster-r7 merged 2 commits into
rapid7:6.5from
cgranleese-r7:add-malleable-profile-tests

Conversation

@cgranleese-r7

@cgranleese-r7 cgranleese-r7 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Note

In draft until 6.5 is green

Description

PR to add tests for the new MalleableC2 work. I wanted to add some tests to cover future regressions and update the existing tests suite to now have some additional payloads that use the new option.

Breaking Changes

None

Reviewer Notes

This likely wont pass until other PRs and merged into 6.5. #21656 for sure needs to be in the 6.5 tree before this will pass.

Verification Steps

    • Tests go green
    • Tests make sense

Test Evidence

N/A

Environment

Field Details
Operating System macOS 26.5.2

AI Usage Disclosure

Kiro

Pre-Submission Checklist

  • Included a corresponding documentation markdown file in documentation/modules (new modules only)
  • No sensitive information (IP addresses, credentials, API keys, hashes) in code or documentation
  • Tested on the target environment specified in the Environment section above
  • Included RSpec tests for library changes (encouraged for lib/ changes)
  • Read the CONTRIBUTING.md and module acceptance guidelines

@cgranleese-r7
cgranleese-r7 force-pushed the add-malleable-profile-tests branch 5 times, most recently from ecd4413 to 933937c Compare July 9, 2026 15:09
Comment thread .github/workflows/shared_meterpreter_acceptance.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds MalleableC2 fixture profiles and expands the meterpreter acceptance and unit test suites to exercise the new MALLEABLEC2 option across multiple runtimes, while also adjusting meterpreter file reading behavior and CI timeouts to reduce flakiness.

Changes:

  • Add MalleableC2 parser specs plus two profile fixtures used by both unit and acceptance testing.
  • Expand acceptance payload matrices (Windows/PHP/Python/Java/Mettle) to include reverse_http(s) payloads configured with MALLEABLEC2, and improve acceptance output labeling/skip controls.
  • Update meterpreter file reading to avoid premature EOF behavior (notably in PHP meterpreter over TCP) and increase the meterpreter acceptance workflow timeout.

Impact Analysis:

  • Blast radius: medium — affects all modules using Msf::Post::File#read_file on meterpreter sessions, plus CI behavior for meterpreter acceptance workflows.
  • Data and contract effects: no schema/serialization changes identified; read semantics may change for edge cases where fd.read can return empty/nil, but intent is to improve correctness (avoid partial reads).
  • Rollback and test focus: rollback is straightforward (revert the read loop / workflow timeout); focus testing on meterpreter file read/write post modules (especially PHP meterpreter) and acceptance handler startup for reverse_http(s) payloads.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
spec/support/acceptance/session/windows_meterpreter.rb Adds reverse_http(s) Windows meterpreter acceptance payloads using MalleableC2 fixtures.
spec/support/acceptance/session/python.rb Adds reverse_http(s) Python meterpreter acceptance payloads using MalleableC2 fixtures.
spec/support/acceptance/session/php.rb Adds reverse_http(s) PHP meterpreter acceptance payloads using MalleableC2 fixtures and updates known-failures expectations.
spec/support/acceptance/session/mettle.rb Adds reverse_http(s) mettle acceptance payloads using MalleableC2 fixtures.
spec/support/acceptance/session/java.rb Adds reverse_http(s) Java meterpreter acceptance payloads using MalleableC2 fixtures.
spec/lib/msf/core/payload/malleable_c2_spec.rb Introduces unit tests for the MalleableC2 parser and URIs extraction using fixtures.
spec/file_fixtures/malleable_c2/minimal_uris_headers.profile Adds a minimal profile fixture exercising custom URIs and headers.
spec/file_fixtures/malleable_c2/base64_transforms.profile Adds a profile fixture exercising base64 + prepend/append transforms.
spec/acceptance/meterpreter_spec.rb Updates handler-start regex for reverse_http(s), improves test naming, and adds per-payload module-test skip support.
lib/msf/core/post/file.rb Changes meterpreter file reads to chunk-loop until nil/empty to avoid premature EOF issues.
.github/workflows/shared_meterpreter_acceptance.yml Increases meterpreter acceptance job timeout to accommodate expanded acceptance coverage.

Comment thread spec/lib/msf/core/payload/malleable_c2_spec.rb Outdated
Comment thread lib/msf/core/post/file.rb Outdated
Comment thread .github/workflows/shared_meterpreter_acceptance.yml Outdated
@adfoster-r7
adfoster-r7 force-pushed the add-malleable-profile-tests branch from 51ce275 to 5e68cf0 Compare July 17, 2026 21:24
@adfoster-r7
adfoster-r7 marked this pull request as ready for review July 17, 2026 21:26
@adfoster-r7
adfoster-r7 force-pushed the add-malleable-profile-tests branch 2 times, most recently from be2baf3 to fe12bb2 Compare July 17, 2026 23:34
@adfoster-r7
adfoster-r7 force-pushed the add-malleable-profile-tests branch from fe12bb2 to e981246 Compare July 17, 2026 23:35
@adfoster-r7
adfoster-r7 merged commit cd974ad into rapid7:6.5 Jul 18, 2026
68 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Metasploit Kanban Jul 18, 2026
@cdelafuente-r7 cdelafuente-r7 added the rn-enhancement release notes enhancement label Jul 31, 2026
@cdelafuente-r7

cdelafuente-r7 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Old Release Notes
This adds tests for the new MalleableC2 feature.

@adfoster-r7 adfoster-r7 added rn-no-release-notes no release notes and removed rn-enhancement release notes enhancement labels Jul 31, 2026
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

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants