LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-01-2015, 05:43 AM   #1
Lop3
Member
 
Registered: Aug 2013
Posts: 48

Rep: Reputation: Disabled
Exclamation Blocking a brute force password hacker


Someone is hammering away on my webserver trying to brute force passwords. I've added their IP to my ipset blacklist. (and confirmed they're on the ipset by listing all the IPs in the blacklist and grepping theirs etc) and I have a rule to drop everything in that IPset.

iptables-save -C shows my first filter rule is
Code:
[477:19080] -A INPUT -m set --match-set my_blklist src -j DROP
which is clearly active, yet this hacker is hammering away.

I thought perhaps because he has a keepalive connection, but then I tried: `tcpkill -i br0 -9 host 6.6.6.6`...
I've tried running TCPkill
* on the host http://pastebin.com/80vwdn3h
* on the webserver VM http://pastebin.com/96rA1FX5

I see that his port number is changing constantly, which means he is somehow able to establish new connections? This should not be happening. Any ideas?

IP's have been obfuscated, where 1.2.3.4 is my servers IP, 6.6.6.6 is the hacker. and 10.0.0.2 is my webserver VM's IP.


My blacklist was created like so:
Code:
create my_blklist hash:ip
iptables --table filter -I INPUT --match set --match-set my_blklist src -j DROP
On my nat table, incoming HTTP connections are forwarded to my webserver with
Code:
-A PREROUTING -i br0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.0.0.2:80
(which would be the first rule that gets matched)

I tried adding this now
Code:
iptables --table nat -A INPUT -m set --match-set my_blklist src -j DROP
But it said The "nat" table is not intended for filtering, the use of DROP is therefore inhibited.

============================

I investigated a little more now. I ran
Code:
iptables -Z
to reset my counters.
Then I found that on the filter table pretty much the only thing getting hit was
Code:
-A INPUT -m state --state ESTABLISHED -j ACCEPT
and my blacklist ipset rule was zero (inactive).

So then I ran tcpkill again for a few seconds.

Then checked iptables -c again. And then I saw the blacklist ipset DROP rule had been active while running tcpkill.
But when I'm not running tcpkill, then the ipset rule is inactive (counter does not go up).


============================

SOLVED: I was dropping INPUT stuff. I needed to drop FORWARD stuff.

Last edited by Lop3; 08-01-2015 at 06:33 AM.
 
Old 08-01-2015, 06:46 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Lop3 View Post
SOLVED: I was dropping INPUT stuff. I needed to drop FORWARD stuff.
Thanks for posting.

This thread also clearly illustrates why not posting actual rule sets (as in 'iptables-save;' output) hampers troubleshooting...
 
Old 08-01-2015, 08:47 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,668
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
The best thing to do is to disable passwords altogether in "ssh," using only digital certificates and not permitting a fall-back to passwords. Now, even though authorized users pass through the gauntlet immediately, no one else can pass. You can't brute-force a certificate.
 
Old 08-02-2015, 02:52 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by sundialsvcs View Post
The best thing to do is to disable passwords altogether in "ssh,"
He's talking TCP/80 here?..
 
  


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
fail2ban best method of blocking brute force attempts? mrtwice Linux - Security 3 12-09-2008 10:52 AM
Does anyone know if guardian can be set to block brute force attacks and only brute f abefroman Linux - Software 2 06-05-2008 10:55 AM
Brute Force... Cottsay Linux - Software 1 03-02-2006 03:58 PM
someone trying to brute force me stitchman Slackware 8 12-16-2005 02:02 PM
Blocking brute force port scanning?? FunkFlex Linux - Security 1 05-03-2002 01:43 AM

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

All times are GMT -5. The time now is 03:10 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