首 页 网络编程
网页制作 图形图象 操作系统 冲浪宝典
软件教学 认证考试

网络安全 网络办公 行业资讯 评测对比
您当前位置:站长天空 -> 网络编程-> Delphi教程
对抗杀毒软件Kick the Heuristic Anti-virus out of the Rootkit-.NET教程,安全和优化
作者:网友供稿 点击:87
推荐
西部数码-全国虚拟主机10强!20余项虚拟主机管理功能,全国领先!第6代双线路虚拟主机,南北访问畅通无阻!可在线rar解压,自动数据恢复设置虚拟目录等.免费赠送访问统计,企业邮局.Cn域名注册10元/年,自助建站480元起,免费试用7天,满意再付款!P4主机租用799元/月.月付免压金
站内搜索
文章页数:[1] 
recently, some friend complained to me that their rootkit driver had been killed by anti-virus software like mcafee and nod32.so i began to find why.
i found that these "heuristic anti-virus" based on the export function mentioned in one of jonnas article(btw:give my respect to jonna).
first i take a look at mcafee, it has a strange heuristic strategy. if it found an export symbol "keservicedescriptortable" ,while it didn`t found some normal driver function like "iocreatedevice", it report the virus. so i think the first method is to find the keservicedescriptortable dynamically.
with 90210s article "a more stable way to locate real kiservicetable"(http://www.rootkit.com/newsread.php?newsid=176) and his help, i can find the keservicedescriptortables servicetablebase, it is enough.(thank you 90210).
but i find nod32 is more restrice, it will detect zw* function and reported your driver as virus. so i must find a more common ways to locate export functions and symbols. fortunately i found some pieces in from sven b. schreiber. this book is cool!! the code is here:



pvoid spymemorycreate (dword dsize)
    {
    return exallocatepoolwithtag (pagedpool, max (dsize, 1),
                                  spy_tag);
    }

// -----------------------------------------------------------------

pvoid spymemorydestroy (pvoid pdata)
    {
    if (pdata != null) exfreepool (pdata);
    return null;
    }

// ==============================================================
// module info management
// =================================================================

pmodule_list spymodulelist (pdword    pddata,
                            pntstatus pns)
    {
    dword        dsize;
    dword        ddata = 0;
    ntstatus     ns    = status_invalid_parameter;
    pmodule_list pml   = null;

    for (dsize = page_size; (pml == null) && dsize; dsize <<= 1)
        {
        if ((pml = spymemorycreate (dsize)) == null)
            {
            ns = status_no_memory;
            break;
            }
        ns = zwquerysysteminformation (systemmoduleinformation,
                                       pml, dsize, &ddata);
        if (ns != status_success)
            {
            pml   = spymemorydestroy (pml);
            ddata = 0;

            if (ns != status_info_length_mismatch) break;
            }
        }
    if (pddata != null) *pddata = ddata;
    if (pns    != null) *pns    = ns;
    return pml;
    }

// -----------------------------------------------------------------

pmodule_list spymodulefind (pbyte     pbmodule,
                            pdword    pdindex,
                            pntstatus pns)
    {
    dword        i;
    dword        dindex = -1;
    ntstatus     ns     = status_invalid_parameter;
    pmodule_list pml    = null;

    if ((pml = spymodulelist (null, &ns)) != null)
        {
        for (i = 0; i < pml->dmodules; i++)
            {
            if (!_stricmp (pml->amodules [i].abpath +
                           pml->amodules [i].wnameoffset,
                           pbmodule))
                {
                dindex = i;
                break;
                }
            }
        if (dindex == -1)
            {
            pml = spymemorydestroy (pml);
            ns  = status_no_such_file;
            }
        }
    if (pdindex != null) *pdindex = dindex;
    if (pns     != null) *pns     = ns;
    return pml;
    }

// -----------------------------------------------------------------

pvoid spymodulebase (pbyte     pbmodule,
                     pntstatus pns)
    {
    pmodule_list pml;
    dword        dindex;
    ntstatus     ns    = status_invalid_parameter;
    pvoid        pbase = null;

    if ((pml = spymodulefind (pbmodule, &dindex, &ns)) != null)
        {
        pbase = pml->amodules [dindex].pbase;
        spymemorydestroy (pml);
        }
    if (pns != null) *pns = ns;
    return pbase;
    }

// -----------------------------------------------------------------

pimage_nt_headers spymoduleheader (pbyte     pbmodule,
                                   pvoid    *ppbase,
                                   pntstatus pns)
    {
    pvoid             pbase = null;
    ntstatus          ns    = status_invalid_parameter;
    pimage_nt_headers pinh  = null;

    if (((pbase = spymodulebase (pbmodule, &ns)) != null) &&
        ((pinh  = rtlimagentheader (pbase))      == null))
        {
        ns = status_invalid_image_format;
        }
    if (ppbase != null) *ppbase = pbase;
    if (pns    != null) *pns    = ns;
    return pinh;
    }

// -----------------------------------------------------------------

pimage_export_directory spymoduleexport (pbyte     pbmodule,
                                         pvoid    *ppbase,
                                         pntstatus pns)
    {
    pimage_nt_headers       pinh;
    pimage_data_directory   pidd;
    pvoid                   pbase = null;
    ntstatus                ns    = status_invalid_parameter;
    pimage_export_directory pied  = null;

    if ((pinh = spymoduleheader (pbmodule, &pbase, &ns)) != null)
        {
        pidd = pinh->optionalheader.datadirectory
               + image_directory_entry_export;

        if (pidd->virtualaddress &&
            (pidd->size >= image_export_directory_))
            {
            pied = ptr_add (pbase, pidd->virtualaddress);
            }
        else
            {
            ns = status_data_error;
            }
        }
    if (ppbase != null) *ppbase = pbase;
    if (pns    != null) *pns    = ns;
    return pied;
    }

// -----------------------------------------------------------------

pvoid spymodulesymbol (pbyte     pbmodule,
                       pbyte     pbname,
                       pvoid     *ppbase,
                       pntstatus pns)
    {
    pimage_export_directory pied;
    pdword                  pdnames, pdfunctions;
    word                    *pwordinals;
    dword                   i, j;
    pvoid                   pbase    = null;
    ntstatus                ns       = status_invalid_parameter;
    pvoid                   paddress = null;

    if ((pied = spymoduleexport (pbmodule, &pbase, &ns)) != null)
        {
        pdnames     = ptr_add (pbase, pied->addressofnames);
        pdfunctions = ptr_add (pbase, pied->addressoffunctions);
        pwordinals  = ptr_add (pbase, pied->addressofnameordinals);

        for (i = 0; i < pied->numberofnames; i++)
            {
            j = pwordinals [i];

            if (!strcmp (ptr_add (pbase, pdnames [i]), pbname))
                {
                if (j < pied->numberoffunctions)
                    {
                    paddress = ptr_add (pbase, pdfunctions [j]);
                    }
                break;
                }
            }
        if (paddress == null)
            {
            ns = status_procedure_not_found;
            }
        }
    if (ppbase != null) *ppbase = pbase;
    if (pns    != null) *pns    = ns;
    return paddress;
    }

// -----------------------------------------------------------------

pvoid spymodulesymbolex (pbyte     pbsymbol,
                         pvoid     *ppbase,
                         pntstatus pns)
{
    dword    i;
    byte     abmodule [maximum_filename_length] = "ntoskrnl.exe";
    pbyte    pbname   = pbsymbol;
    pvoid    pbase    = null;
    ntstatus ns       = status_invalid_parameter;
    pvoid    paddress = null;
    
    for (i = 0; pbsymbol [i] && (pbsymbol [i] != !); i++);
    
    if (pbsymbol [i++])
    {
        if (i <= maximum_filename_length)
        {
            memcpy (abmodule, pbsymbol, i);
            pbname = pbsymbol + i;
        }
        else
        {
            pbname = null;
        }
    }
    if (pbname != null)
    {
        paddress = spymodulesymbol (abmodule, pbname, &pbase, &ns);
    }
    if (ppbase != null) *ppbase = pbase;
    if (pns    != null) *pns    = ns;
    return paddress;
}


so now we can get symbol like this:

pkeservicedescriptortable = spymodulesymbolex("keservicedescriptortable", null, &ns);

cool!


文章整理:站长天空 网址:http://www.z6688.com/
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

文章页数:[1] 


放大字体显示 缩小字体显示 打印文章 推荐给朋友
热门文章
·ListBox控件基本功能-.NET教程,组件控件开发
·用window.location.href实现刷新另个框架页面-.NET教程,Asp.Net开发
·JSP+STRUTS+EJB+DAO+HIBERNATE实例-JSP教程,Jsp/Servlet
·.NET中的设计模式四:命令模式-.NET教程,Asp.Net开发
·数字转英文(货币)大写-.NET教程,数据库应用
·用户控件用户登录判断-ASP教程,客户端相关
·计数器的另一用法:自动切换首页图片-ASP教程,ASP应用
·漫谈Java数据库存取技术-JSP教程,Java技巧及代码
·正则表达式-.NET教程,Asp.Net开发
·即时通讯靠免费短信能赚10亿?
最新文章
·让flash动画适应任何分辨率的网页_flash教程
·新手必看之网站的定位篇_站长心得
·1000ip的效益也能大于一万ip_网赚技巧
·google adsense课堂:西联快汇知识_网赚技巧
·googleadsense的无效点击_google推广
·google adsense高价关键字[排行榜]_google推广
·google搜索引擎的十大应用_google推广
·windows vista下如何关闭远程控制_windows vista
·修改配置 让windows vista系统实现自动登录_windows vista
·整齐划一 将整个网页保存在一个文件中_站长心得
相关主题
西部数码虚拟主机

友情链接
CNNIC 西部数码
万网 自助建站
虚拟主机 asp空间
域名注册 域名
域名申请 主页空间
论坛空间 网站空间
国际域名 虚拟空间
空间租用 DDOS防火墙
成都主机托管 四川主机托管
主机租用 服务器租用
网站目录 自助建站
虚拟主机 网址大全
软件下载
自助链接
虚拟主机资讯 特价虚拟主机
版权申明:本站文章均来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!
关于我们:站长天空:专业提供最新的站长资讯、在线教程、虚拟主机权威评测、虚拟主机性能对比、网站制作教程,开发教程,站长工具。包括网页制作教程、冲浪宝典、编程参考、操作系统、软件教学、行业动态等。
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。
发表评论 打印  刷新     关闭