Refactor and centralize self-signed certificate generation across Framework

Aperta
#22,011 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@kx7m2qd ci sta già lavorando.

Dal 17/10/2026.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
18/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
ruby
Ambito
backend, security

Direzione di ricerca

Start with lib/msf/core/cert_provider.rb (Msf::Ssl::CertProvider) and the fallback in lib/msf/core/exploit/remote/http_server.rb and tcp_server.rb to see how certificates are produced today. The call sites span dozens of files, so the design of one shared generator has to come first; the issue does not yet specify that API. Done means a single generator is used by the listed components with tests covering key generation, SANs and expiry.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

suggestion-feature

Description

Context

Currently, Framework has fragmented and incomplete support for generating self-signed certificates across several components (e.g., HTTPS-based payloads, fetch payloads, miscellaneous HTTPS servers).

During a recent PR discussion around MCP support, we identified that certificate generation logic is duplicated and less comprehensive than it could be. Instead of maintaining piecemeal implementations, we want to consolidate this capability into a single, feature-complete service.

Objectives
  • Centralize Certificate Generation: Create a single, standard utility/module within Framework responsible for producing self-signed certificates.
  • Expand Capabilities: Enhance the core certificate generation logic (e.g., proper key generation, SANs, configurable expiration) based on recent PR patterns.
  • Unify Existing Usage: Refactor existing Framework components to rely on this centralized generator rather than custom/partial implementations.
Affected Components / Call Sites

LLM-generated list, could be incomplete. This list

Automatic TLS
  • Framework TLS (encrypted transport) services use Msf::Ssl::CertProvider at lib/msf/core/cert_provider.rb:47. It is registered with Rex (Metasploit’s networking library) at lib/msf/core/framework.rb:83.
  • Generic HTTP and TCP server modules generate certificates when TLS is enabled without SSLCert. The controlling paths are lib/msf/core/exploit/remote/http_server.rb:122 and lib/msf/core/exploit/remote/tcp_server.rb:60. These mixins occur across 508 module files.
  • Eight additional modules create custom listeners through the same fallback: modules/exploits/osx/browser/safari_file_policy.rb:173, modules/auxiliary/gather/safari_file_url_navigation.rb:226, modules/auxiliary/gather/apple_safari_ftp_url_cookie_theft.rb:81, modules/exploits/multi/http/log4shell_header_injection.rb:260, modules/exploits/multi/upnp/libupnp_ssdp_overflow.rb:366, modules/exploits/linux/http/panos_readsessionvars.rb:178, modules/exploits/unix/misc/polycom_hdx_auth_bypass.rb:210, and modules/exploits/unix/misc/polycom_hdx_traceroute_exec.rb:149.
  • Credential Capture generates certificates for HTTPS, FTPS, IMAPS, POP3S, and SMTPS at plugins/capture.rb:213.
  • Reverse HTTPS and reverse TCP SSL handlers use generated listener certificates at lib/msf/core/handler/reverse_http.rb:241, lib/msf/core/handler/reverse_tcp_ssl.rb:56, and lib/msf/core/handler/reverse_tcp_double_ssl.rb:78.
  • HTTPS fetch payload adapters generate certificates through FetchSSLCert at lib/msf/core/payload/adapter/fetch/server/https.rb:15.
  • Meterpreter generates and caches its internal server certificate at lib/rex/post/meterpreter/client.rb:287.
  • Meterpreter and SSH pivoted TLS server channels use automatic certificates at lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_server_channel.rb:92 and lib/msf/base/sessions/ssh_command_shell_bind.rb:158.
  • MessagePack RPC (Remote Procedure Call) generates ephemeral certificates for msgrpc, default msfrpcd, and auto-started MCP. Relevant entry points are lib/msf/core/rpc/v10/service.rb:50, msfrpcd:147, and plugins/mcp.rb:563.
  • The msfd -s console daemon generates an ephemeral certificate through msfd:51 and plugins/msfd.rb:62.
  • The Metasploit web service generates persistent certificate files through msfdb:410. Thin and JSON-RPC consume them at msfdb:716 and msfrpcd:228.
Dedicated Generators
  • Android payload generation self-signs every generated APK/JAR at lib/msf/core/payload/android.rb:71.
  • Android template injection creates a KeyTool certificate and re-signs the APK at lib/msf/core/payload/apk.rb:285.
  • SCCM client registration uses a self-signed identity certificate at lib/msf/core/exploit/remote/http/sccm.rb:21.
  • Shadow Credentials creates a self-signed certificate for stored credential material at modules/auxiliary/admin/ldap/shadow_credentials.rb:251.
  • Both Cisco SD-WAN authentication bypass modules use self-signed DTLS certificates at modules/auxiliary/admin/networking/cisco_sdwan_auth_bypass.rb:125 and modules/auxiliary/admin/networking/cisco_sdwan_vhub_auth_bypass.rb:142.
  • HTTP SSL Certificate Impersonation creates self-signed loot when no private key is supplied at modules/auxiliary/gather/impersonate_ssl.rb:172.
  • OpenSSL Heartbeat Client Memory generates and transmits a certificate at modules/auxiliary/server/openssl_heartbeat_client_memory.rb:352.
  • OpenSSL Alternative Chains Forgery generates a self-signed CA (Certificate Authority) certificate at modules/auxiliary/server/openssl_altchainsforgery_mitm_proxy.rb:88.
  • Veritas Backup Exec Agent RCE generates and uses a self-signed CA at modules/exploits/multi/veritas/beagent_sha_auth_rce.rb:346.
  • Backup Exec SSL Use-After-Free generates and uses a self-signed CA at modules/exploits/windows/backupexec/ssl_uaf.rb:566.
  • The msfvenom APK Template Command Injection exploit signs its crafted APK at modules/exploits/unix/fileformat/metasploit_msfvenom_apk_template_cmd_injection.rb:63.
Target-Side Generation
  • Geutebruck CVE-2021-33544 invokes createselfcert at modules/exploits/linux/http/geutebruck_cmdinject_cve_2021_335xx.rb:54.
  • Cisco RV320/RV325 invokes self_generator.htm at modules/exploits/linux/http/cisco_rv32x_rce.rb:155.
  • Trend Micro IMSVA invokes its certificate generator at modules/exploits/linux/http/trend_micro_imsva_exec.rb:127, although the source does not establish whether certType=0 is self-signed.
Lingua principale
Ruby
Stelle
39.7k
Fork
15.1k
Merge medio
4g 2h
PR unite (30g)
71

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rapid7/metasploit-framework

Tutte le issue di rapid7/metasploit-framework

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.