{"id":302,"date":"2015-11-27T11:19:04","date_gmt":"2015-11-27T11:19:04","guid":{"rendered":"http:\/\/cloudkul.com\/blog\/?p=302"},"modified":"2017-06-14T11:34:31","modified_gmt":"2017-06-14T11:34:31","slug":"block-libwww-perl-attack-in-apache-web-server","status":"publish","type":"post","link":"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/","title":{"rendered":"Block libwww-perl attack in Apache Web Server"},"content":{"rendered":"<p>In the world of IT, there is also a name called HACKING, which is growing very fast in the industry. Yes hackers, spammers, bots are keep growing very fastly. The time has come when we need to become mindful.<\/p>\n<p>There is a threat called libwww-perl (LWP). It is a WWW client\/server library for perl which helps lot of hacker, spammer, bots to perform attacks on your website. So you\u00a0need to be aware &amp; try to apply some security through which attackers would not be able to steal any type of information from your web server.<\/p>\n<p>So the first question arises, how to block libwww-perl (LWP) in Apache webserver to keep bots, spammers, attackers away ?<\/p>\n<p>first check the apache access logs by typing:-<\/p>\n<pre class=\"lang:default decode:true \">tail -f \/var\/log\/apache2\/access.log<\/pre>\n<p>if you see the same marked line shown as in screen shot in your apache access log that means there is someone hacker who is trying to break the security of your webserver.<\/p>\n<p><a href=\"http:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2015\/11\/Blur.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-370\" src=\"http:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2015\/11\/Blur.png\" alt=\"Blur\" width=\"1532\" height=\"462\" \/><\/a><\/p>\n<p>So libwww-perl (LWP) need to be blocked in your webserver so that your webserver would be safe from this type of attacks.<\/p>\n<p>Now the question is how to block libwww-perl attacks ?<\/p>\n<p>First you need to access your webserver and go to www\/html directory &amp; find the .htaccess file<\/p>\n<p>Now edit your .htaccess file and add the code written below :-<\/p>\n<pre class=\"lang:default decode:true \">RewriteCond %{HTTP_USER_AGENT} libwww-perl.*\r\n\r\nRewriteRule .* \u2013 [F,L]\r\n\r\n<\/pre>\n<p><span style=\"line-height: 1.5\">make sure that code should be written after the <strong>&#8220;RewriteEngine On&#8221;<\/strong> line in your<strong> .htaccess file<\/strong>.<\/span><\/p>\n<p>Now the question arises that how would you get to know that the code added by you in .htaccess file is working or not ?<\/p>\n<p>So, it is very easy to know. What all you need to do is make a new script named test_libwww and add the below content in it :-<\/p>\n<pre class=\"lang:default decode:true \">#!\/usr\/bin\/perl\r\n\r\n# Simple LWP browser for testing\r\n\r\nuse LWP::UserAgent;\r\n\r\n$ua = LWP::UserAgent-&gt;new;\r\n\r\n$ua-&gt;agent(\"$0\/0.1 \" . $ua-&gt;agent);\r\n\r\n# $ua-&gt;agent(\"Mozilla\/8.0\") # pretend we are very capable browser\r\n\r\n$req = HTTP::Request-&gt;new(GET =&gt; 'http:\/\/your-website.com\/');\r\n\r\n$req-&gt;header('Accept' =&gt; 'text\/html');\r\n\r\n# send request\r\n\r\n$res = $ua-&gt;request($req);\r\n\r\n# check the outcome\r\n\r\nif ($res-&gt;is_success) {\r\n\r\nprint $res-&gt;content;\r\n\r\n} else {\r\n\r\nprint \"Error: \" . $res-&gt;status_line . \"\\n\";\r\n\r\n}<\/pre>\n<p>Replace <strong>&#8220;http:\/\/your-website.com&#8221;<\/strong> with your domain name and then save &amp; exit from the script.<\/p>\n<p>Make that script executable by typing:-<\/p>\n<pre class=\"lang:default decode:true\">chmod +x test_libwww<\/pre>\n<p>Now execute the script by typing:-<\/p>\n<pre class=\"lang:default decode:true \">.\/test_libwww<\/pre>\n<p>Now the output should be <strong>&#8220;Error : 403 Forbidden&#8221;<\/strong><\/p>\n<p>If you get that output, it means you are safe from this types of attack&#8230;<\/p>\n<p>If you have any doubt or query regarding this, just reply here so that i would be able to reply your query&#8230;:)<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/cloudkul.com\/contact\/\" target=\"_blank\">FOR ANY TYPE OF QUERY OR HELP, PLEASE CONTACT US<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the world of IT, there is also a name called HACKING, which is growing <a class=\"text-primary\" title=\"read more\" href=\"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":4,"featured_media":318,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[15],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Block libwww-perl attack in Apache Web Server - Cloudkul<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Block libwww-perl attack in Apache Web Server - Cloudkul\" \/>\n<meta property=\"og:description\" content=\"In the world of IT, there is also a name called HACKING, which is growing [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudkul\" \/>\n<meta property=\"article:published_time\" content=\"2015-11-27T11:19:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-06-14T11:34:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2015\/11\/block-libwww-perl-attack-in-Apache-Web-Server.png\" \/>\n\t<meta property=\"og:image:width\" content=\"848\" \/>\n\t<meta property=\"og:image:height\" content=\"422\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Prashant Arora\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/\",\"url\":\"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/\",\"name\":\"Block libwww-perl attack in Apache Web Server - Cloudkul\",\"isPartOf\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\"},\"datePublished\":\"2015-11-27T11:19:04+00:00\",\"dateModified\":\"2017-06-14T11:34:31+00:00\",\"author\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/0f130d5c45f7a843f035c2b26dfd8822\"},\"breadcrumb\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Block libwww-perl attack in Apache Web Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\",\"url\":\"https:\/\/cloudkul.com\/blog\/\",\"name\":\"Cloudkul\",\"description\":\"Host your eCommerce Store on AWS with Optimized Performance\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudkul.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/0f130d5c45f7a843f035c2b26dfd8822\",\"name\":\"Prashant Arora\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ffd3d12ef1ac706011cfd6f835707402?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ffd3d12ef1ac706011cfd6f835707402?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"caption\":\"Prashant Arora\"},\"url\":\"https:\/\/cloudkul.com\/blog\/author\/prashant089\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Block libwww-perl attack in Apache Web Server - Cloudkul","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/","og_locale":"en_US","og_type":"article","og_title":"Block libwww-perl attack in Apache Web Server - Cloudkul","og_description":"In the world of IT, there is also a name called HACKING, which is growing [...]","og_url":"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/","og_site_name":"Cloudkul","article_published_time":"2015-11-27T11:19:04+00:00","article_modified_time":"2017-06-14T11:34:31+00:00","og_image":[{"width":848,"height":422,"url":"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2015\/11\/block-libwww-perl-attack-in-Apache-Web-Server.png","type":"image\/png"}],"author":"Prashant Arora","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/","url":"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/","name":"Block libwww-perl attack in Apache Web Server - Cloudkul","isPartOf":{"@id":"https:\/\/cloudkul.com\/blog\/#website"},"datePublished":"2015-11-27T11:19:04+00:00","dateModified":"2017-06-14T11:34:31+00:00","author":{"@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/0f130d5c45f7a843f035c2b26dfd8822"},"breadcrumb":{"@id":"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cloudkul.com\/blog\/block-libwww-perl-attack-in-apache-web-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Block libwww-perl attack in Apache Web Server"}]},{"@type":"WebSite","@id":"https:\/\/cloudkul.com\/blog\/#website","url":"https:\/\/cloudkul.com\/blog\/","name":"Cloudkul","description":"Host your eCommerce Store on AWS with Optimized Performance","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudkul.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/0f130d5c45f7a843f035c2b26dfd8822","name":"Prashant Arora","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ffd3d12ef1ac706011cfd6f835707402?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ffd3d12ef1ac706011cfd6f835707402?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","caption":"Prashant Arora"},"url":"https:\/\/cloudkul.com\/blog\/author\/prashant089\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/302"}],"collection":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/comments?post=302"}],"version-history":[{"count":14,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/302\/revisions"}],"predecessor-version":[{"id":430,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/302\/revisions\/430"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/media\/318"}],"wp:attachment":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/media?parent=302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/categories?post=302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/tags?post=302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}