Skip to content

Adds support for MITRE ATT&CK References #20289

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

cgranleese-r7
Copy link
Contributor

@cgranleese-r7 cgranleese-r7 commented Jun 6, 2025

This PR adds support for MITRE ATT&CK References in Metasploit modules, this will allow users to now search for MITRE ATT&CK techniques via our existing search functionality.

Metasploit Pro

I have verified this also work with Metasploit Pro. Links are rendered and clickable etc. The search functionality also works there as well 🚀

Verification

  • CI goes green
  • Code changes look sane

Requirements

  • Can add MITRE technique IDs to module metadata using existing reference field structure
  • Users can search for "T1190" and get relevant modules in results
  • Technique IDs render as clickable links to MITRE ATT&CK website
  • Search performance remains unchanged when including technique ID matching
  • At least 10 existing modules successfully tagged with relevant technique IDs during testing

Manual testing

  • Clickable links(info)
  • Clickable links(info -d):
  • Searchable(search att&ck:T1190)
  • Searchable(search attack:T1190)
  • Searching for the main technique ID should return sub-techniques (search att&ck:T1021 should return modules containing [ 'ATT&CK', 'T1021.001' ]).
  • Try break it

@cgranleese-r7 cgranleese-r7 force-pushed the adds-mitre-attack-references branch from c4fc3b3 to 2d669e2 Compare June 6, 2025 12:25
@h00die
Copy link
Contributor

h00die commented Jun 6, 2025

I started adding these to all the updated persistence techniques. That PR will need to have these redone to the new format.
https://github.com/rapid7/metasploit-framework/pull/19815/files#diff-5156607c9d633cf8541aaa49486428ac5d8f9c5ea9f4aa808fccb4a3b7a63e50R55 #19815

@cgranleese-r7 cgranleese-r7 marked this pull request as ready for review June 10, 2025 09:50
@cgranleese-r7 cgranleese-r7 added the rn-enhancement release notes enhancement label Jun 10, 2025
@adfoster-r7
Copy link
Contributor

Could we spike generating out ruby constants for the techniques so we can auto-complete values in our editors; past experience shows it's very easy for people to get magic values wrong

[ 'URL', 'http://sourceforge.net/projects/smbexec/' ],
[ 'ATT&CK', 'T1021.002' ], # SMB/Windows Admin Shares
[ 'ATT&CK', 'T1569.002' ], # Service Execution
[ 'ATT&CK', 'T1077' ], # Windows Admin Shares
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like T1077 was consolidated into T1021.002 - so I think this is redundant 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will look into this 👍

@cgranleese-r7 cgranleese-r7 marked this pull request as draft June 11, 2025 13:28
@cgranleese-r7 cgranleese-r7 force-pushed the adds-mitre-attack-references branch 4 times, most recently from e7e32c0 to f2fb402 Compare June 11, 2025 18:44
@cgranleese-r7 cgranleese-r7 force-pushed the adds-mitre-attack-references branch from f2fb402 to 3167922 Compare June 11, 2025 20:15
@@ -81,6 +82,12 @@ def initialize(info = {})

# Win 8
['EDB', '42030'],

# MITRE ATT&CK
Copy link
Contributor

@adfoster-r7 adfoster-r7 Jun 11, 2025

Choose a reason for hiding this comment

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

Do we have a plan for how payloads will impact the att&ck metadata here? As well as conditional techniques that are based on actions, or changing datastore values etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, good question - do you have any thoughts on this @smcintyre-r7

Copy link
Contributor

Choose a reason for hiding this comment

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

We have the same issue for side effects. I think at this time, we can completely ignore what a payload is going to do otherwise everything capable of delivering a meterpreter payload would be tagged with everything meterpreter can do. At that point, we'll have diminishing returns on the content.

I'm happy to focus the tags on what the module does. There will need to be a judgement call in regards to tags that are only applicable for particular targets / actions. The precedence we've set in the past is that we add them to the side effects if any target or action uses it and we should probably continue to do that. Long term though, having a way to separate the tags for different targets and actions would enable us to better inform our users of what is going to happen based on their configuration. I'm guessing that'd be a much larger engineering effort and would be happy to leave that out of scope for this work item.

@cgranleese-r7 cgranleese-r7 force-pushed the adds-mitre-attack-references branch 3 times, most recently from 6002bac to 98ce403 Compare June 12, 2025 10:46
@cgranleese-r7 cgranleese-r7 marked this pull request as ready for review June 12, 2025 10:53
@cgranleese-r7 cgranleese-r7 force-pushed the adds-mitre-attack-references branch 4 times, most recently from 5311092 to 57d28d9 Compare June 12, 2025 11:25
Copy link
Contributor

@cdelafuente-r7 cdelafuente-r7 left a comment

Choose a reason for hiding this comment

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

Would it be possible to add a rubocop rule to make sure ATT&CK reference key has no typo and automatically swap to the correct key word?

@cgranleese-r7 cgranleese-r7 force-pushed the adds-mitre-attack-references branch from 464ed53 to 18604a0 Compare June 12, 2025 14:18
output << 'module Msf'
output << ' module Mitre'
output << ' module Attack'
output << ' module Technique'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
output << ' module Technique'
output << " # This file was auto-generated by #{__FILE__} please do not manually edit it"
output << ' module Technique'

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

Successfully merging this pull request may close these issues.

6 participants