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

restore raw_send_recv for module using SMTP mixin #17435

Merged
merged 1 commit into from
Jan 5, 2023

Conversation

jmartin-tech
Copy link
Contributor

@jmartin-tech jmartin-tech commented Jan 4, 2023

Fixes #17411

Changes in #16153 adjusted modules that were not utilizing Exploit::Remote::SMTPDeliver in error. Restore calls to raw_send_recv that is no longer shadowed by in SMTPDeliver.

Verification

  • review modules restored here and test as needed.

changes in rapid7#16153 adjusted modules that were not utilizing
`Exploit::Remote::SMTPDeliver` in error restore calls to `raw_send_recv`
that is no longer shadowed by in `SMTPDeliver`.
@gwillcox-r7 gwillcox-r7 self-assigned this Jan 5, 2023
@gwillcox-r7 gwillcox-r7 added bug rn-fix release notes fix labels Jan 5, 2023
@gwillcox-r7
Copy link
Contributor

Before fix:

msf6 > use auxiliary/dos/smtp/sendmail_prescan 
msf6 auxiliary(dos/smtp/sendmail_prescan) > show optoins
[-] Invalid parameter "optoins", use "show -h" for more information
msf6 auxiliary(dos/smtp/sendmail_prescan) > show options

Module options (auxiliary/dos/smtp/sendmail_prescan):

   Name      Current Setting     Required  Description
   ----      ---------------     --------  -----------
   MAILFROM  sender@example.com  yes       FROM address of the e-mail
   MAILTO    target@example.com  yes       TO address of the e-mail
   RHOSTS                        yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
   RPORT     25                  yes       The target port (TCP)


View the full module info with the info, or info -d command.

msf6 auxiliary(dos/smtp/sendmail_prescan) > set RHOSTS 127.0.0.1
RHOSTS => 127.0.0.1
msf6 auxiliary(dos/smtp/sendmail_prescan) > run
[*] Running module against 127.0.0.1

[-] 127.0.0.1:25 - Auxiliary failed: NoMethodError undefined method `smtp_send_recv' for #<Module:auxiliary/dos/smtp/sendmail_prescan datastore=[#<Msf::ModuleDataStoreWithFallbacks:0x00007f0b7ce43e08 @options={"WORKSPACE"=>#<Msf::OptString:0x0000556fbd97f630 @name="WORKSPACE", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="Specify the workspace for this module", @default=nil, @enums=[], @owner=Msf::Module>, "VERBOSE"=>#<Msf::OptBool:0x0000556fbd97f0b8 @name="VERBOSE", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="Enable detailed status messages", @default=false, @enums=[], @owner=Msf::Module>, "RHOSTS"=>#<Msf::OptRhosts:0x0000556fb7e98438 @name="RHOSTS", @advanced=false, @evasion=false, @aliases=["RHOST"], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc="The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Smtp>, "RPORT"=>#<Msf::OptPort:0x0000556fbd94b9e8 @name="RPORT", @advanced=false, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc="The target port", @default=25, @enums=[], @owner=Msf::Exploit::Remote::Smtp>, "SSL"=>#<Msf::OptBool:0x0000556fbd97cbd8 @name="SSL", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="Negotiate SSL/TLS for outgoing connections", @default=false, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "SSLServerNameIndication"=>#<Msf::OptString:0x0000556fbd97c908 @name="SSLServerNameIndication", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="SSL/TLS Server Name Indication (SNI)", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "SSLVersion"=>#<Msf::OptEnum:0x0000556fb7e8e438 @name="SSLVersion", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc_string="Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate)", @enums=["Auto", "TLS", "SSL23", "SSL3", "TLS1", "TLS1.1", "TLS1.2"], @default="Auto", @owner=Msf::Exploit::Remote::Tcp>, "SSLVerifyMode"=>#<Msf::OptEnum:0x0000556fbd953c38 @name="SSLVerifyMode", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc_string="SSL verification method", @enums=["CLIENT_ONCE", "FAIL_IF_NO_PEER_CERT", "NONE", "PEER"], @default="PEER", @owner=Msf::Exploit::Remote::Tcp>, "SSLCipher"=>#<Msf::OptString:0x0000556fbd950948 @name="SSLCipher", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="String for SSL cipher - \"DHE-RSA-AES256-SHA\" or \"ADH\"", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "Proxies"=>#<Msf::OptString:0x0000556fb7ec8f70 @name="Proxies", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="A proxy chain of format type:host:port[,type:host:port][...]", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "CPORT"=>#<Msf::OptPort:0x0000556fb7f259f0 @name="CPORT", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="The local client port", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "CHOST"=>#<Msf::OptAddress:0x0000556fb7f2e690 @name="CHOST", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="The local client address", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "ConnectTimeout"=>#<Msf::OptInt:0x0000556fbd9f2ce8 @name="ConnectTimeout", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc="Maximum number of seconds to establish a TCP connection", @default=10, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "TCP::max_send_size"=>#<Msf::OptInt:0x0000556fbd9e0fe8 @name="TCP::max_send_size", @advanced=false, @evasion=true, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="Maxiumum tcp segment size.  (0 = disable)", @default=0, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "TCP::send_delay"=>#<Msf::OptInt:0x0000556fbd9a2770 @name="TCP::send_delay", @advanced=false, @evasion=true, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="Delays inserted before every send.  (0 = disable)", @default=0, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "MAILFROM"=>#<Msf::OptString:0x0000556fbd9487e8 @name="MAILFROM", @advanced=false, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc="FROM address of the e-mail", @default="sender@example.com", @enums=[], @owner=Msf::Exploit::Remote::Smtp>, "MAILTO"=>#<Msf::OptString:0x0000556fbd936f20 @name="MAILTO", @advanced=false, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc="TO address of the e-mail", @default="target@example.com", @enums=[], @owner=Msf::Exploit::Remote::Smtp>}, @aliases={"rhost"=>"rhosts"}, @defaults={}, @user_defined={"RHOSTS"=>"127.0.0.1", "VERBOSE"=>false, "RPORT"=>25, "SSL"=>false, "SSLVersion"=>"Auto", "SSLVerifyMode"=>"PEER", "ConnectTimeout"=>10, "TCP::max_send_size"=>0, "TCP::send_delay"=>0, "MAILFROM"=>"sender@example.com", "MAILTO"=>"target@example.com", "UNPARSED_RHOSTS"=>"127.0.0.1", "RHOSTNAME"=>nil}, @_module=#<Module:auxiliary/dos/smtp/sendmail_prescan datastore=[#<Msf::ModuleDataStoreWithFallbacks:0x0000556fbd97fb80 @options={"WORKSPACE"=>#<Msf::OptString:0x0000556fbd97f630 @name="WORKSPACE", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="Specify the workspace for this module", @default=nil, @enums=[], @owner=Msf::Module>, "VERBOSE"=>#<Msf::OptBool:0x0000556fbd97f0b8 @name="VERBOSE", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="Enable detailed status messages", @default=false, @enums=[], @owner=Msf::Module>, "RHOSTS"=>#<Msf::OptRhosts:0x0000556fb7e98438 @name="RHOSTS", @advanced=false, @evasion=false, @aliases=["RHOST"], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc="The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Smtp>, "RPORT"=>#<Msf::OptPort:0x0000556fbd94b9e8 @name="RPORT", @advanced=false, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc="The target port", @default=25, @enums=[], @owner=Msf::Exploit::Remote::Smtp>, "SSL"=>#<Msf::OptBool:0x0000556fbd97cbd8 @name="SSL", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="Negotiate SSL/TLS for outgoing connections", @default=false, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "SSLServerNameIndication"=>#<Msf::OptString:0x0000556fbd97c908 @name="SSLServerNameIndication", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="SSL/TLS Server Name Indication (SNI)", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "SSLVersion"=>#<Msf::OptEnum:0x0000556fb7e8e438 @name="SSLVersion", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc_string="Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate)", @enums=["Auto", "TLS", "SSL23", "SSL3", "TLS1", "TLS1.1", "TLS1.2"], @default="Auto", @owner=Msf::Exploit::Remote::Tcp>, "SSLVerifyMode"=>#<Msf::OptEnum:0x0000556fbd953c38 @name="SSLVerifyMode", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc_string="SSL verification method", @enums=["CLIENT_ONCE", "FAIL_IF_NO_PEER_CERT", "NONE", "PEER"], @default="PEER", @owner=Msf::Exploit::Remote::Tcp>, "SSLCipher"=>#<Msf::OptString:0x0000556fbd950948 @name="SSLCipher", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="String for SSL cipher - \"DHE-RSA-AES256-SHA\" or \"ADH\"", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "Proxies"=>#<Msf::OptString:0x0000556fb7ec8f70 @name="Proxies", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="A proxy chain of format type:host:port[,type:host:port][...]", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "CPORT"=>#<Msf::OptPort:0x0000556fb7f259f0 @name="CPORT", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="The local client port", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "CHOST"=>#<Msf::OptAddress:0x0000556fb7f2e690 @name="CHOST", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="The local client address", @default=nil, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "ConnectTimeout"=>#<Msf::OptInt:0x0000556fbd9f2ce8 @name="ConnectTimeout", @advanced=true, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc="Maximum number of seconds to establish a TCP connection", @default=10, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "TCP::max_send_size"=>#<Msf::OptInt:0x0000556fbd9e0fe8 @name="TCP::max_send_size", @advanced=false, @evasion=true, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="Maxiumum tcp segment size.  (0 = disable)", @default=0, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "TCP::send_delay"=>#<Msf::OptInt:0x0000556fbd9a2770 @name="TCP::send_delay", @advanced=false, @evasion=true, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=false, @desc="Delays inserted before every send.  (0 = disable)", @default=0, @enums=[], @owner=Msf::Exploit::Remote::Tcp>, "MAILFROM"=>#<Msf::OptString:0x0000556fbd9487e8 @name="MAILFROM", @advanced=false, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc="FROM address of the e-mail", @default="sender@example.com", @enums=[], @owner=Msf::Exploit::Remote::Smtp>, "MAILTO"=>#<Msf::OptString:0x0000556fbd936f20 @name="MAILTO", @advanced=false, @evasion=false, @aliases=[], @max_length=nil, @conditions=[], @fallbacks=[], @required=true, @desc="TO address of the e-mail", @default="target@example.com", @enums=[], @owner=Msf::Exploit::Remote::Smtp>}, @aliases={"rhost"=>"rhosts"}, @defaults={}, @user_defined={"RHOSTS"=>"127.0.0.1"}, @_module=#<Module:auxiliary/dos/smtp/sendmail_prescan datastore=[#<Msf::ModuleDataStoreWithFallbacks:0x0000556fbd97fb80 ...>]>>]>>]>
[-] 127.0.0.1:25 - Call stack:
[-] 127.0.0.1:25 -   /home/gwillcox/git/metasploit-framework/modules/auxiliary/dos/smtp/sendmail_prescan.rb:41:in `run'
[*] Auxiliary module execution completed
msf6 auxiliary(dos/smtp/sendmail_prescan) > 

@gwillcox-r7
Copy link
Contributor

After fix:

msf6 > use auxiliary/dos/smtp/sendmail_prescan
msf6 auxiliary(dos/smtp/sendmail_prescan) > set RHOSTS 127.0.0.1
RHOSTS => 127.0.0.1
msf6 auxiliary(dos/smtp/sendmail_prescan) > show options

Module options (auxiliary/dos/smtp/sendmail_prescan):

   Name      Current Setting     Required  Description
   ----      ---------------     --------  -----------
   MAILFROM  sender@example.com  yes       FROM address of the e-mail
   MAILTO    target@example.com  yes       TO address of the e-mail
   RHOSTS    127.0.0.1           yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
   RPORT     25                  yes       The target port (TCP)


View the full module info with the info, or info -d command.

msf6 auxiliary(dos/smtp/sendmail_prescan) > run
[*] Running module against 127.0.0.1

[*] 127.0.0.1:25 - Sending DoS packet.
[*] Auxiliary module execution completed
msf6 auxiliary(dos/smtp/sendmail_prescan) > 

@gwillcox-r7 gwillcox-r7 merged commit 725f836 into rapid7:master Jan 5, 2023
@gwillcox-r7
Copy link
Contributor

Release Notes

A bug has been fixed whereby some modules were accidentally updated to use smtp_send_recv when they did not import the required Exploit::Remote::SMTPDeliver mixin. These modules have been updated to use the appropriate raw_send_recv method instead.

@jmartin-tech jmartin-tech deleted the restore-exim4 branch April 11, 2023 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug rn-fix release notes fix
Projects
None yet
2 participants