The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Replay Attack Ashvin Gaur Security 3 05-27-2008 04:22 AM
anonymous ftp attack? dennisheazle Security 2 04-07-2008 05:11 PM
Need ideas how to attack this problem frequency8 High Level Programming 5 06-16-2007 02:24 PM
winzip.exe virus attack thaduka Security 1 02-05-2006 09:01 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-14-2007
Registered User
 

Join Date: Oct 2007
Posts: 25
Stumble this Post!
Bruteforce attack on my pc & IPFW

since putting my pc online, it keeps getting slower and i dig the logfile to have such a surprise:

Quote:
Oct 14 22:13:52 server sshd[68513]: Illegal user video from 200.41.81.228
Oct 14 22:13:52 server sshd[68513]: Failed password for illegal user video from 200.41.81.228 port 54273 ssh2
Oct 14 22:13:53 server sshd[68515]: Failed password for cpanel from 200.41.81.228 port 54337 ssh2
Oct 14 22:13:54 server sshd[68517]: Failed password for cpanel from 200.41.81.228 port 54409 ssh2
Oct 14 22:13:56 server sshd[68519]: Failed password for cpanel from 200.41.81.228 port 54475 ssh2
Oct 14 22:13:57 server sshd[68521]: Illegal user gnax from 200.41.81.228
Oct 14 22:13:57 server sshd[68521]: Failed password for illegal user gnax from 200.41.81.228 port 54545 ssh2
Oct 14 22:13:58 server sshd[68523]: Illegal user gnax from 200.41.81.228
Oct 14 22:13:58 server sshd[68523]: Failed password for illegal user gnax from 200.41.81.228 port 54610 ssh2
Oct 14 22:13:59 server sshd[68525]: Failed password for bind from 200.41.81.228 port 54673 ssh2
Oct 14 22:14:00 server sshd[68527]: Failed password for bind from 200.41.81.228 port 54742 ssh2
Oct 14 22:14:02 server sshd[68529]: Failed password for bind from 200.41.81.228 port 54819 ssh2
Oct 14 22:14:03 server sshd[68531]: Failed password for bind from 200.41.81.228 port 54883 ssh2
Oct 14 22:14:04 server sshd[68533]: Failed password for bind from 200.41.81.228 port 54949 ssh2
Oct 14 22:14:05 server sshd[68535]: Failed password for bind from 200.41.81.228 port 55013 ssh2
Oct 14 22:14:07 server sshd[68537]: Failed password for root from 200.41.81.228 port 55075 ssh2
this is just one of a many and I beleived it's a bruteforce attack
how do i block this IP 200.41.81.228 from trying to knock my online pc?

my system:
FreeBSD testing.net 6.2-STABLE-JE FreeBSD 6.2-STABLE-JE #0: Sat Apr 21 01:07:18 UTC 2007 root@server:/usr/obj/usr/src/sys/GENERIC i386

thank you

Last edited by rdns; 10-15-2007 at 10:39 AM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-14-2007
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,428
Stumble this Post!
Probably the simplest way is not to block individual IPs but to switch SSH to a higher and obscure port number, switch to an exclusive public key authentication model, and only allow explicit blocks of IP to access if possible. Blocking IPs are usually futile because these IPs most often do not represent the real cracker's IP. They just crack into many vulnerable systems and use those as shields to break in others' systems for one-time only and so the list is essentially infinite, and you will see new IPs emerge every day. They have many of these victim hosts at their disposal so if you block one they simply switch to another.
Reply With Quote
  #3 (permalink)  
Old 10-15-2007
Registered User
 

Join Date: Oct 2007
Posts: 25
Stumble this Post!
thanks! cbkihong,

i'm willing to change the sshd port
meanwhile i'm learning on IPFW and managed to get IPFW up

but while configuring the rules, I stucked at here:
Quote:
############### start of example ipfw rules script #############
#
ipfw -q -f flush # Delete all rules
# Set defaults
oif="tun0" # out interface
odns="192.0.2.11" # ISP's DNS server IP address
cmd="ipfw -q add " # build rule prefix
ks="keep-state" # just too lazy to key this each time
$cmd 00500 check-state
$cmd 00502 deny all from any to any frag
$cmd 00501 deny tcp from any to any established
$cmd 00600 allow tcp from any to any 80 out via $oif setup $ks
$cmd 00610 allow tcp from any to $odns 53 out via $oif setup $ks
$cmd 00611 allow udp from any to $odns 53 out via $oif $ks
################### End of example ipfw rules script ############
this is /etc/ipfw.rules script sourced at IPFW

just a simple question:
do i need to change
Quote:
oif="tun0" # out interface
odns="192.0.2.11" # ISP's DNS server IP address
1. tun0 to my ethernet id
2. odns to my ISP DNS server?

let say from ifconfig, my ethernet is "bge0"
and my DNS IP is 202.188.1.1 and 202.188.2.2

thanks for advice
Reply With Quote
  #4 (permalink)  
Old 10-15-2007
reborg's Avatar
Administrator
 
Join Date: Mar 2005
Location: Ireland
Posts: 3,513
Stumble this Post!
denyhosts might also be a useful tool.
Reply With Quote
  #5 (permalink)  
Old 10-16-2007
indo1144's Avatar
Registered User
 

Join Date: Jun 2002
Location: Netherlands
Posts: 54
Stumble this Post!
fail2ban

Quote:
Originally Posted by rdns View Post
since putting my pc online, it keeps getting slower and i dig the logfile to have such a surprise
You really should look into a neat program called "fail2ban". I have it running on a Debian-server and it's great.
You can configure how many retries someone has after a password-failure and how long they are banned (two hours in my case). It continually scans your /var/log/auth.log and acts. Check out Main Page - Fail2ban for more info.

Quote:
2007-10-14 15:28:26,088 fail2ban.actions: WARNING [ssh] Ban 61.146.178.13
2007-10-14 17:28:26,809 fail2ban.actions: WARNING [ssh] Unban 61.146.178.13
2007-10-15 19:27:09,866 fail2ban.actions: WARNING [ssh] Ban 218.234.170.147
2007-10-15 21:27:10,316 fail2ban.actions: WARNING [ssh] Unban 218.234.170.147
Reply With Quote
  #6 (permalink)  
Old 10-16-2007
Registered User
 

Join Date: Oct 2007
Posts: 9
Stumble this Post!
Cool, but...

I've looked at fail2ban a couple of times.

The one problem I can possibly see is if someone spoofed the address of a computer that you usually use to access the server.

Is it theoretically possible to create a DoS situation then? If not, let me know.

Say they keep failing using your address. Are they not effectively banning you from accessing your server.

Maybe not, just trying to verify one way or the other.
Reply With Quote
  #7 (permalink)  
Old 10-16-2007
indo1144's Avatar
Registered User
 

Join Date: Jun 2002
Location: Netherlands
Posts: 54
Stumble this Post!
Quote:
Originally Posted by JimJ View Post
The one problem I can possibly see is if someone spoofed the address of a computer that you usually use to access the server.

Is it theoretically possible to create a DoS situation then? If not, let me know.
In the config-file, there is an "ignoreip" where you can exclude certain IP-addresses from being banned, you could put the admin-computer in there, I guess.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0