Skip to content

Allow a specific service to be used#197

Merged
adfoster-r7 merged 1 commit intorapid7:masterfrom
zeroSteiner:feat/credential-with-explicit-service
Apr 10, 2026
Merged

Allow a specific service to be used#197
adfoster-r7 merged 1 commit intorapid7:masterfrom
zeroSteiner:feat/credential-with-explicit-service

Conversation

@zeroSteiner
Copy link
Copy Markdown
Contributor

This allows credentials to be reported with explicit services. In order to show up in Metasploit's creds command output, the origin must be a Metasploit::Credential::Origin::Service or Metasploit::Credential::Origin::Session instance, an Mdm::Service can't be used. I think this is because it needs to be associated with a module too which is fine, mo info mo betta. This does however complicate the pattern where a module has a service that it has reported, then it's obtained a credential from that service such as a certificate from MS-ICPR or AD CS Web Enrollment. In that case, the Mdm::Service object could be passed as the origin but then the information is omitted from the creds command. This allows a caller to pass the Mdm::Service as the :service argument, and when it is it's used instead of taking the opts to create a new service instance.

If a :service_id is specified, it takes precedence. Ultimately, it's the ID that's used to create the Metasploit::Credential::Origin::Service instance.

Copy link
Copy Markdown

Copilot AI left a comment

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 updates the credential origin creation flow to allow callers to explicitly bind a credential origin to an existing Mdm::Service (or a :service_id), improving how service-associated creds surface in creds output by ensuring origins are Metasploit::Credential::Origin::Service.

Changes:

  • Extend create_credential_origin_service to accept :service (and :service_id) to reuse an existing service instead of always creating one.
  • Prefer :service_id (or :service.id) when creating Metasploit::Credential::Origin::Service, falling back to create_credential_service only when needed.
  • Update method documentation to mention the new :service option.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/metasploit/credential/creation.rb Outdated
Comment thread lib/metasploit/credential/creation.rb
Comment thread lib/metasploit/credential/creation.rb Outdated
@zeroSteiner zeroSteiner force-pushed the feat/credential-with-explicit-service branch from 301cd2d to 36c27a6 Compare April 10, 2026 15:23
@adfoster-r7 adfoster-r7 merged commit e8a4cfa into rapid7:master Apr 10, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants