LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-04-2014, 10:25 AM   #1
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Rep: Reputation: Disabled
Cgi attack solution.


Dear All,
I notice quite a number of these "GET /cgi-bin/php4 HTTP/1.1" 404 210 "-" "-" in my log file. Should I do something about it. Some suggest to comment this part. Will this be effective or any other better solution to this?

Code:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>
 
Old 02-04-2014, 10:39 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
I used iptables on one host like so:
Code:
iptables -I INPUT -p tcp --dport 80 -m string --algo bm --string "GET /cgi-bin/" --to 1000 -j DROP
It's only 1 method. Others here may have better ones.

Quote:
Originally Posted by newbie14 View Post
...Should I do something about it...
Not necessary (it just bugs me no end that they 'try') but 404s are "Not found".
Enough of those could inhibit your server's ability to satisfy valid requests.

Last edited by Habitual; 02-04-2014 at 10:42 AM.
 
Old 02-05-2014, 07:10 PM   #3
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Dear Habitual,
Besides the iptables what can I do in my httpd.conf to totally stop this cgi-bin so that there is not chance of any possible intrusion?
 
Old 02-05-2014, 07:16 PM   #4
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
If you're not using it, then yes, just comment it out.
I also like to add regular "exploit probes" to my fail2ban rules.
 
Old 02-05-2014, 07:28 PM   #5
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Dear Descdendant,
I saw few section with cgi among them is this. So should I just comment all this. Anything else I should set on httpd.conf. Any sample config which you suggest on fail2ban.
Quote:
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

LoadModule cgi_module modules/mod_cgi.so
 
Old 02-06-2014, 08:40 AM   #6
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Commenting out those entries is fine, but it does NOT stop the "attack".
You can either setup a iptables rule or ignore the "not found" 404s.
 
Old 02-08-2014, 08:21 PM   #7
Corpus-Khu
LQ Newbie
 
Registered: Oct 2011
Posts: 19

Rep: Reputation: Disabled
You can configure apache to redirect your error pages to a cdn or another server so as to not service the request more than once for a single request. It is also possible to drop the connection at layer 3 without providing a response. I would look into both options as if a client continues to request the same non-existing article you are wasting your time. You could do this from within script by making comparisons to previous requests from the same location, ip-address exc.. What I would do is perminently drop a user if they don't except at least 1 identifying cookie or redirect with a url encoded authentication code in an http scenerio,

I see many sites that give abusive users a time out. I am unsure if a person would do this with iptables or dynamically change a firewall, you could accomplish this for your website with htaccess or somehow add rules to a dmz on the fly with a dmz that allows that to ensure you are not overworking your server or the intermediate services that allow you to operate effectively.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] simulating blackhole attack and wormhole attack in ns-2 aditijigyasi Linux - Newbie 7 07-04-2016 08:50 AM
Nagios: statusmap.cgi & Trends.cgi files missing wlchak Linux - Software 6 10-30-2009 06:47 AM
LXer: Sometimes a CGI script is the most elegant solution LXer Syndicated Linux News 0 03-02-2007 12:31 PM
http://www.burstnet.com/cgi-bin/ads/ad7954a.cgi/3980/RETURN-CODE rverlander LQ Suggestions & Feedback 1 06-07-2002 07:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration