Commit Graph

980 Commits (1fd065403897e005dc41c391eca6e2f1a9d6365d)

Author SHA1 Message Date
RageLtMan 332862bfea Server needs a resolver to perform fwd lookups
Dont send requests to a nil object for lookups, it's not very good
at that.
2017-06-23 19:58:33 -04:00
RageLtMan b1b43555cf Fixup Resolver socket creation slop 2017-06-23 19:58:33 -04:00
RageLtMan 6e86ac6e1b Tweak Server and Resolver
Create default_dispatch_request method in Server to allow an
intercepted dispatch request to fall back into default exec flow.

Add attr_reader to the records hash in Cache

Provide Resolver and Server with comm option for their sockets.
2017-06-23 19:58:33 -04:00
RageLtMan e3c372834e Update Resolver's use of Rex Sockets
Compose configuration hashes for the Rex Sockets used in requests
based on the Resolver's own configuration, including passing the
Framework context, and CHOST/CPORT options in from Msf namespaces.
2017-06-23 19:58:32 -04:00
RageLtMan a8c3adf19c Move recursion bit logic into the fwd lookup 2017-06-23 19:58:32 -04:00
RageLtMan 136cc964f5 Accessors, cache stop lock fix, and resp header
Missed the attr_accessors in first commit - added.

Updated Cache stop method to iterate over the resulting Array of
records without holding a write lock over it (:each vs :map).

Glanced over https://www.ietf.org/rfc/rfc1035.txt and set proper
bits for the response and recursion fields prior to passing off the
data for return.

TODO:
  Write mixin for easier packet manipulation with configurable
response builders which can determine proper settings for header
fields based on server/resolver configuration. Document to allow
exploit/vector developers to make use of the functionality...
2017-06-23 19:58:32 -04:00
RageLtMan 9f49903b14 Initial implementation of Rex::Proto::DNS
Add Rex::Proto::DNS and Rex::Proto::DNS::Constants namespaces
Create Rex::Proto::DNS::Resolver from Net::DNS::Resolver
Create Rex::Proto::DNS::Server and Rex::Proto::DNS::Server::Cache

Constants -
  A Rex::Socket style MATCH_HOSTNAME regex has been added to
help validate DNS names.

Resolver -
  Based off of old work creating Rex socket overrides in the
Net::DNS::Resolver as well as allowing for proxying and making
automatic adjustments to use TCP for proxied connections. This
resolver pivots with MSF, uses proxies, and doesnt pull in the
default /etc/resolv.conf information which can lead to info leak.
  Automatically sends Net::DNS::Packet and Resolv::DNS::Message
objects to the appropriate nameservers.
  TODO: Review for potential low level concurrent resolution impl.

Server::Cache -
  Threadsafe wrapper around a Hash which holds Net::DNS::RR keys
with Time.to_i values for counting eviction/stale time without
altering the original record.
  Takes records with a TTL of < 1 as static entries which are not
flushed or pruned by the monitor thread.

Server -
  A standard Rex level server allowing for client connections with
TCP and UDP listeners. Provides common framework for handling the
different transports by creating a "client" type object as a Rex
UDP socket and passing it back to the dispatch/sender methods.
This server can host listeners on remote pivot targets since it
utilizes Rex sockets, and should not leak internal information
from the resolver as easily either.
  Can be configured with a custom resolver regardless of its own
listener configuration (UDP/TCP mix is fine), and carries a
threadsafe wrapper for swapping the resolvers nameservers under
a Mutex.synchronize. Since listeners and resolvers can pivot,
a compromised host in one environment can serve DNS information
obtained by the resolver pivoting through a completely different
target.
  The server takes blocks for dispatch and send functions which
when defined, will intercept the standard execution flow which is
to parse the request, check the cache for corresponding records,
then forward the remaining questions in a request via the resolver,
and build + send a response back to the client.
  The accessors for dispatch and send, resolver, and cache are
accessible at runtime, though it is likely unsafe to replace the
cache and resolver while they are accessed from other threads.

-----

Testing:
  Initial testing performed in IRB/Pry generating manual requests.
  Subsequent checks performed using the running server as the sys
resolver.
  Additional testing is needed - the default dispatch_request
behavior may not be correct (i need to check the RFCs for this) as
it handles multiple questions for A records. This should be tuned
to be RFC compliant, with inheriting classes changing behavior as
needed. We also need to ensure that we're not leaking our own DNS
information to our targets, so all sorts of abuse is in order.

-----

TODO:
  Create Msf::Exploit::DNS namespace utilizing this functionality.
  - Move the threaded enum_dns work, as well as work from 6187,
into the namespace
  - Review existing modules for functional overlap and move here
as needed. This should be done in separate commits/PRs.
  Create specific DNS servers for spoofing, exploit delivery, and
finally handling DNS tunnels (the primary reason for this work).
  Write spec
  - Convince/coerce a friendly soul in the community to handle
spec for this fiasco while building further functionality.
2017-06-23 19:58:29 -04:00
William Webb 47a659f554
Land #8185, Convert ntp modules to bindata 2017-06-22 09:37:58 -05:00
HD Moore e8b5cc3397 Avoid a stacktrace by verifying that the share is known 2017-05-26 17:01:44 -05:00
William Vu ee55516e06 Allow lowercase HTTP in command strings 2017-05-10 15:17:20 -05:00
William Vu 3a45c2f321 Allow complete override of Host header 2017-05-10 15:17:20 -05:00
Brent Cook 7b936b0012
Land #8184, convert IPMI protocol and modules to bindata 2017-04-17 07:40:15 -05:00
Christian Mehlmauer 3c260ea452
fix #7921, HttpTrace and chunked encoding 2017-04-05 22:58:11 +02:00
Brent Cook 5f88971ca9 convert NTP modules to bindata 2017-04-04 02:57:38 -05:00
Brent Cook 46c7e822c8 convert IPMI protocol and modules to bindata 2017-04-04 02:44:17 -05:00
dmohanty-r7 92c0748447
Land #8102, Add a plugin to notify new sessions via SMS 2017-03-24 11:17:59 -05:00
wchen-r7 bb4d6e17c8 Resolve #8026, Add a plugin to notify new sessions via SMS
This plugin will notify you of a new session via SMS.

It also changes the SMS text format to MIME.

Resolve #8026
2017-03-13 16:13:59 -05:00
wchen-r7 702d1c2b7e Fix bug for subject 2017-03-08 11:43:36 -06:00
wchen-r7 ed22902fd4 Support the subject field 2017-03-08 11:40:08 -06:00
wchen-r7 036a443a41 Add Google Fi gateway 2017-03-07 17:02:32 -06:00
wchen-r7 dc36bc4a0d Add rspec 2017-03-07 16:49:42 -06:00
wchen-r7 dc13b84189 Bring mms branch up to date w/ master 2017-03-07 16:13:39 -06:00
wchen-r7 d32f08f969 Add doc and fix mms message class 2017-03-07 14:40:37 -06:00
wchen-r7 fae05f2e98 And API to send an MMS message to mobile devices
This API allows you to send a malicious attachment to mobile
devices.
2017-03-07 12:34:45 -06:00
wchen-r7 a466dc44c6 Do exception handling for sms client 2017-03-06 10:54:08 -06:00
wchen-r7 4d44911d5c Do doc for google fi 2017-03-03 11:38:47 -06:00
wchen-r7 d9b21b16a9 Support Google Project Fi gateway 2017-03-03 11:36:13 -06:00
wchen-r7 2edb116855 Send texts individually
If we pass all the phone numbers at once in one email, it becomes
a group chat, and that allows the recipients to see each other's
number, which isn't the intended behavior.
2017-03-03 11:12:59 -06:00
wchen-r7 c61f8ded78 Comment out Sprint
It looks like the Sprint gateways won't accept our email for
some reason, so we can't use it.
2017-03-03 11:09:04 -06:00
wchen-r7 6ad8afb8b3 Add API to send a text message (SMS) to mobile devices 2017-03-02 16:47:55 -06:00
Brent Cook 836da6177f Cipher::Cipher is deprecated 2017-01-22 10:20:03 -06:00
Brent Cook f69b4a330e handle Ruby 2.4 Fixnum/Bignum -> Integer deprecations 2017-01-22 10:20:03 -06:00
wchen-r7 180795f209 Fix #7743, nil @cnonce in rex/proto/http/client.rb
Fix #7743
2017-01-04 11:50:31 -06:00
Justin Angel 318c0eda81 Update to line 126
Line originally references the read_timeout instance variable associated with the smb variable (line 118 || 120), which is an object of the simpleclient class that doesn't have a read_timeout instance variable. Updated the line to reference the client instance variable of smb, which does have a read_timeout variable. Testing this change appears to result in expected behavior.
2016-12-16 14:24:02 -05:00
Jin Qian cdc82891d8 Fix the issue 7593 where I get a stacktrace when running module auxiliary/scanner/http/blind_sql_query
Add a guard against the case when opts['vars_get'] is nil
2016-11-21 17:39:09 -06:00
Brendan 1644a1e20b Change how we populate workgroup/domain data 2016-10-19 17:24:26 -05:00
Brendan 95294b00d1 Whitespace 2016-10-19 17:13:07 -05:00
Brendan 078496437f Make sure that the ntlm blob data is pasrsed into UTF-8 2016-10-19 17:11:04 -05:00
Brendan fe36801918 Changed to convert hostnames and domains to UTF-8 rather than ANSI
after pulling them from the NTLM blob
2016-10-11 15:51:50 -05:00
Brendan 332ba47356 refactored blob parsing to get unicode, but break everything else 2016-09-16 11:22:53 -05:00
Brent Cook b5ae287235 ensure that default_name, dns_host_name, and dns_domain_name are set 2016-09-13 18:32:59 -05:00
Brent Cook 1d4b0de560
Land #6616, Added an Outlook EWS NTLM login module. 2016-09-09 11:43:52 -05:00
Brendan a30711ddcd
Land #7279, Use the rubyntlm gem (again) 2016-09-07 16:33:35 -05:00
Pearce Barry 1f5fbd4a67
Put remaining consts in exploit mixin... 2016-07-27 17:43:29 -05:00
Pearce Barry bdf073516b
Switch errors over to windows_error gem... 2016-07-27 17:43:00 -05:00
David Maloney 01d0d1702b
Merge branch 'master' into feature/MS-1688/net-ssh-cleanup 2016-07-14 09:48:28 -05:00
James Lee 11685b7c6b
Set the server challenge key 2016-07-07 15:00:42 -05:00
James Lee cfb56211e7
Revert "Revert "Land #7009, egypt's rubyntlm cleanup""
This reverts commit 1164c025a2.
2016-07-07 15:00:41 -05:00
James Lee 1164c025a2 Revert "Land #7009, egypt's rubyntlm cleanup"
This reverts commit d90f0779f8, reversing
changes made to e3e360cc83.
2016-07-05 15:22:44 -05:00
David Maloney ee2d1d4fdc
Merge branch 'master' into feature/MS-1688/net-ssh-cleanup 2016-06-28 15:00:35 -05:00
David Maloney 6072697126
continued 2016-06-22 14:54:00 -05:00
James Lee 4b3f6c5d29
Use rubyntlm for mssql login scanner 2016-06-22 10:15:22 -05:00
James Lee 039e8f5899
Use rubyntlm for HTTP Negotiate auth 2016-06-22 10:15:22 -05:00
James Lee c2a063c8ae
Start using rubyntlm for ssp auth 2016-06-22 10:15:16 -05:00
Adam Cammack fda4c62c1f
Respect SSLCipher in server mixins
This allows us to set a sane cipher spec for SSL-enabled server modules.
2016-05-20 16:59:36 -05:00
wchen-r7 d4b89edf9c Fix #6398, Missing Content-Length header in HTTP POST
RFC-7230 states that a Content-Length header is normally sent in
a POST request even when the value (length) is 0, indicating an
empty payload body. Rex HTTP client failed to follow this spec,
and caused some modules to fail (such as winrm_login).

Fix #6398
2016-04-28 11:44:10 -05:00
thao doan 5e36a3128c Fix #5197, Fixed yard doc errors
Fix #5197 Fixed issues that caused errors during yard doc generation
2016-04-21 13:06:00 -05:00
William Vu 3e0f8d67c9 Use #strip to more correctly simulate #blank?
See f900d9cf26.
2016-03-07 13:14:37 -06:00
Brent Cook 289f43bb80
Land #4848, remove some reliance on rails libraries from rex 2016-03-07 07:38:30 -06:00
rwhitcroft 4b10331cf0 style fixups 2016-03-01 10:18:25 -05:00
wchen-r7 bff4b4d5fc Fix #6609 and #6587 - Change Content-Length behavior in Rex HTTP
This patches changes two things:

1. If a module has a custom Content-Length, it will respect that
   instead of forcing its own.

2. If a request does not have anything in the body, the
   Content-Length header will not be set.

Fix #6609
Fix #6587
2016-02-29 10:50:21 -06:00
rwhitcroft f735a904ff create owa_ews_login module, modify HttpClient to accept preferred_auth option 2016-02-28 22:01:05 -05:00
Brent Cook 3d1861b3f4 Land #6526, integrate {peer} string into logging by default 2016-02-15 15:19:26 -06:00
James Lee ad026b3a7a
Add #peer to Tcp 2016-01-28 13:58:24 -06:00
William Vu d6facbe339
Land #6421, ADB protocol and exploit 2016-01-22 20:45:44 -06:00
joev 00f1511b46 Use the right op for the data checksum. 2016-01-03 01:48:25 -06:00
joev 849857a418 Fix spacing issues in message.rb. 2016-01-02 22:57:26 -06:00
joev 6668dbec41 Remove stray binding.pry. 2016-01-02 22:50:06 -06:00
joev dcd36b74db Last mile polish and tweaks. 2016-01-02 22:41:38 -06:00
joev 9c85c5d4fe Add newline. 2016-01-02 01:17:28 -06:00
joev a88471dc8d Add ADB client and module for obtaining shell. 2016-01-02 01:13:53 -06:00
Brent Cook e23b5c5435
Land #6179, add NTP initial crypto nak spoofing module 2015-12-24 15:46:18 -06:00
wchen-r7 d6921fa133 Add Atlassian HipChat for Jira Plugin Velocity Template Injection
CVE-2015-5603

Also fixes a bug in response.rb (Fix #6254)
2015-11-18 11:34:25 -06:00
jvazquez-r7 00d09744fb
Land #6118, @wchen-r7's new methods for Rex HTTP response 2015-11-03 10:42:42 -06:00
Jon Hart ced20ba51c
Refactor NTP symmetric packet creation; add vuln detection to NAK to the future 2015-11-02 12:46:58 -08:00
wchen-r7 1805774b16 Resolve #6020, Better RPC exception handling
Resolve #6020. Avoid trying to rescue RuntimeError.
2015-10-28 11:16:44 -05:00
Jon Hart f2b6d37630 Add WIP module for Cisco Talos' NTP 'NAK to the future' 2015-10-27 18:10:07 -07:00
wchen-r7 f6b9f38326 This method is not needed because Nokogiri does that already 2015-10-23 19:38:17 -05:00
wchen-r7 065d042ec4 Update doc a little bit 2015-10-21 16:29:27 -05:00
wchen-r7 12cdd786a6 Add more Nokogiri and RKelly support for Rex::Proto::Http::Response
These new methods allow the module writer to being able to parse
HTML/XML/JSON responses properly without using regex first.
2015-10-21 16:26:31 -05:00
Brent Cook 157bab4f0d
Land #5518, TFTP::Client retransmit lost data blocks on upload 2015-09-23 21:58:42 -05:00
HD Moore 9e98385417 Fix #5716 by correctly setting the data length 2015-09-02 15:16:25 -05:00
Jon Hart 407d701fd9
Remove unnecessary version_random_case option 2015-08-20 10:05:16 -07:00
Jon Hart 2e4944b8ec
Remove unnecessary version_random_case option 2015-08-20 10:05:04 -07:00
Brent Cook 015d045730 read max_size bytes at a time 2015-08-18 15:56:57 -05:00
Brent Cook b40c36688c check send retry count and abort in excess 2015-07-31 16:17:34 -05:00
Brent Cook 6e146794a2 fix indents and style 2015-07-31 14:48:02 -05:00
Mo Sadek 4cd6e0c72b Added "Failed" to line 121 of kdc_request.rb 2015-07-13 11:27:32 -05:00
Mo Sadek 6a5645d747 Changed "Filed" to "Failed" in multiple files 2015-07-13 11:21:20 -05:00
jvazquez-r7 7eeb8805ee
Do minor code cleanup 2015-06-19 13:37:02 -05:00
Th3R3p0 8ea09532c8 removed a debugging line 2015-06-17 13:13:00 -04:00
Th3R3p0 e30b0e0cda forced client to version 3 for servers and added comments. This adds support for RFB version 4 servers. Tested on 004.001 2015-06-17 12:57:24 -04:00
Th3R3p0 772a5dd7df Created array and added support for version 4 2015-06-17 12:31:51 -04:00
David Barksdale 91a06fb6fb TFTP::Client retransmit lost data blocks on upload
Retransmit data blocks until we receieve a matching ACK.
2015-06-09 15:53:33 -05:00
Brent Cook c3438955d4
Land #5169, stop reading when the HTTP socket is closed 2015-05-01 11:40:49 -05:00
Brent Cook 27f6adcd81
Land #5110, teach Http::Response to extract hidden form inputs 2015-04-24 13:30:57 -05:00
rwhitcroft 70f94bbd96 break loop if socket is closed 2015-04-21 11:09:17 -04:00
William Vu 79ca0a56f9
Land #4171, Steam protocol support 2015-04-20 15:35:06 -05:00
wchen-r7 f280e5191b I forgot to move this require statement 2015-04-16 21:11:09 -05:00
wchen-r7 3493d25ff9 Move all this to Rex 2015-04-16 21:07:23 -05:00
rwhitcroft 602e9c8df1 Update client.rb 2015-04-16 16:06:16 -04:00
rwhitcroft 6ef86b69a7 Fix loop spinning in HttpClient 2015-04-16 10:49:47 -04:00
jvazquez-r7 2e52817b24
Add DecodeError 2015-04-05 18:16:19 -05:00
jvazquez-r7 85a70d401b
Introduce Rex::Proto::Rmi::DecodeError 2015-04-05 18:15:04 -05:00
jvazquez-r7 72c36eb23e Use concatenation 2015-04-05 15:57:50 -05:00
jvazquez-r7 e3bbb7c297 Solve conflicts 2015-04-03 14:57:49 -05:00
root 4ba761986f Correct YARD doc comments 2015-04-02 16:14:25 +05:00
jvazquez-r7 6ea42f6599
Fix description 2015-03-24 12:30:27 -05:00
jvazquez-r7 39e87f927a
Make code consistent 2015-03-24 11:44:26 -05:00
jvazquez-r7 04341bfc78
Support JMX_ROLE again 2015-03-23 17:32:26 -05:00
jvazquez-r7 d8d4c23d60
JMX code refactoring 2015-03-23 17:06:51 -05:00
jvazquez-r7 962bb670de
Remove old JMX mixin 2015-03-23 15:48:10 -05:00
jvazquez-r7 5c3134a616
Add first support to gather information from RMI registries 2015-03-19 11:16:04 -05:00
jvazquez-r7 14be07a2c4
Update java_rmi_server modules 2015-03-17 21:29:52 -05:00
jvazquez-r7 6315e07312 Add specs for UniqueIdentifier 2015-03-17 20:38:43 -05:00
jvazquez-r7 87b777e923
Refactor moving code to rex 2015-03-17 17:15:32 -05:00
jvazquez-r7 1c064f6b46
Land #3074, @0x41414141 SMB Share mixin 2015-03-04 10:16:04 -06:00
jvazquez-r7 8328c5c5e9 Add specs for SMB_FIND_FILE_BOTH_DIRECTORY_INFO requests 2015-03-03 12:43:41 -06:00
jvazquez-r7 eb3aedf4a7 Define constants for WordCount in responses 2015-02-28 18:15:14 -06:00
jvazquez-r7 89a033c194 Delete unnecessary paddings due to miscalculations 2015-02-26 15:54:00 -06:00
William Vu 0a51ca12a5 Download all of every file implicitly 2015-02-26 14:10:53 -06:00
William Vu d0ca1b2dc6 Delete a thing I added for no reason 2015-02-26 14:06:10 -06:00
William Vu 5996256ccc Fix formatting 2015-02-26 14:05:50 -06:00
jvazquez-r7 c73ffea1b9 Do minor cleanup 2015-02-26 12:50:45 -06:00
HD Moore d75f55e493 Rex should not depend on ActiveSupport, .blank? is not stdlib Ruby 2015-02-26 11:23:38 -06:00
jvazquez-r7 970f0c94b2 Create CREATE_ANDX constants 2015-02-26 10:44:07 -06:00
Matthew Hall ab1bb0e50d bugfixes to https://github.com/jvazquez-r7/metasploit-framework/tree/review_3074_clean_server
to provide consistent support for various exploits and OS SMB Commands.

Reintroduces smb_cmd_trans_query_path_info_network for use with the Struts2 JSP injection vulnerability.
Reintroduces smb_cmd_trans_query_file_info_basic for common use with rundll32.
Corrects some issues with filename formatting and pattern matching for file requests (can still be improved).
2015-02-26 16:10:34 +00:00
William Vu ed9213eb4c Add fsquery check to fs{download,delete} methods 2015-02-25 17:37:20 -06:00
William Vu ea5b6f66d4 Add UEL to fsdownload method 2015-02-25 17:35:34 -06:00
William Vu 5d3c7f3b4a Add fsquery method 2015-02-25 17:18:23 -06:00
William Vu 1f981dd336 Add FSQUERY constant 2015-02-25 17:00:27 -06:00
jvazquez-r7 993c75ec77 Update Offset counts with constants 2015-02-25 16:25:16 -06:00
William Vu 91f0713056 Add fsdelete method 2015-02-25 15:41:40 -06:00
William Vu a096a17e21 Add FSDELETE constant 2015-02-25 15:39:51 -06:00
William Vu 80d8491d09 Add fsdownload method 2015-02-25 15:00:31 -06:00
William Vu e8c2c3687d Replace "pathname" with "path"
This always bothered me, since I usually say "path."
2015-02-25 15:00:18 -06:00
William Vu 02ea7a0282 Add FSDOWNLOAD constant 2015-02-25 15:00:11 -06:00
jvazquez-r7 df50aa0f06 Use constants for DataCount and DataCountTotal 2015-02-25 14:11:38 -06:00
jvazquez-r7 f21959a8a2 Add constants for session setup actions 2015-02-25 13:31:57 -06:00
jvazquez-r7 e967cfbfb3 Create Access rights constants 2015-02-25 13:22:16 -06:00
jvazquez-r7 1caffbea2d Add constants for Negotiation Capabilities 2015-02-25 12:50:33 -06:00
jvazquez-r7 50d50d5353 Define constants for SMB Flags 2015-02-25 12:28:25 -06:00
jvazquez-r7 e5d9bb0a47 Update from master 2015-02-25 11:37:13 -06:00
jvazquez-r7 ec9be4531b Add SMB_CREATE_ANDX_RES_PKT template 2015-02-25 11:33:08 -06:00
jvazquez-r7 d10385cfed Add template for SMB_TREE_CONN_ANDX_RES_PKT 2015-02-24 19:27:25 -06:00
jvazquez-r7 642765aeb5 Delete comments 2015-02-24 18:27:02 -06:00
jvazquez-r7 bb36899699 Do templates names consistent 2015-02-24 18:26:46 -06:00
jvazquez-r7 d29e9fc20b Parse TRAN2_FIND_FIRST2 commands 2015-02-24 17:02:49 -06:00
Brent Cook ab4a416958 comment out duplicate keys that can only be used for reference
ruby is ignoring all but the second instances, and 2.2 still throws a
warning
2015-02-24 08:50:02 -06:00
William Vu 5eec07d4d1 Fix duplicate hash key "jpeg"
In lib/rex/proto/http/server.rb.
2015-02-24 05:19:42 -06:00