Defeating SSH/FTP script kiddies and hacker attempts

AID: 641
  • Status: Published

3800 points

  • By
  • TypeTips/Tricks
  • Posted on2009-05-14 at 10:12:53
Wikipedia defines 'Script Kiddies' in this informal way: "In hacker culture, a script kiddie, occasionally script bunny, skiddie, script kitty, script-running juvenile (SRJ), or similar, is a derogatory term used to describe those who use scripts or programs developed by others to attack computer systems and networks."

In the recent months, I have encountered several 'script kiddies', both of a domestic and foreign locations, attempting to brute-force hack their into my SSH and FTP server. Since I have a need for both applications for personal and business needs, I needed a quick and easy way to 'fix their little red wagon' and keep my site running without having to watch it day and night. As a result, I discovered that someone had developed a Perl script (URL below) but it was only intended for ssh attacks, so I took it upon myself to help improve the script and give it the ability to watch over the ProFTPd application processes as well.

Block.pl script (the one for sshd) can be found here: http://shellscripts.org/projects/s/sshblock/version_1.2/block.pl

But before the script could be deployed as a counter to these ssh and ftp brute-force attacks, I first needed to harden my existing network infrastructure.

First, I reconfigured my router to port forward port 19 (or whatever non '21' port) to port 21 on the IIS/FTP server. Then I configured port 21 on the router to forward to the Linux server (as described below). This way I can tell my customers to use the new FTP forwarded port (i.e. '19') to access the 'other' IIS/FTP server site.

Second, I setup a basic Linux server w/ IPTables. I setup a CentOS Linux server on the same network with the Windows server. On the Linux server, I configured ProFTPd to be the FTP server running on port 21. I then downloaded and executed (in background/nohup mode -- 'nohup ./myapp.pl &') a modified 'block.pl' Perl script (see URL below) to scan the message log for incoming SSH & FTP attempts.

Modified block.pl script -- http://www.mwecomputers.com/EE/block.pl

When a script kiddie attacks, the block.pl script will read the /var/log/messages file for the attack trigger response, determine if the attack is of an 'ftp' or 'ssh' type and then impose a special IPTables firewall rule -- based on the IP address -- to drop the incoming attempts. After a period of one hour, the script check to see if the attack from the offender's IP address have subsided. If the offender has disappeared, the script will then actually clean itself up and remove the offender's IP address from the firewall rule and watch the /var/log/messages file for another attack to happen.

Personally, I have utilized this script and during the first hour alone, the modified block.pl script was able to drop nearly 40 script kiddies and put a knot in their chain. Since the script cleans itself up, I did not have to check to see if my server was operational or not. I was happy and my customers were just as happy.

For other ideas on how to improve this script or make your own 'script kiddie' prevention, I recommend taking at look at this article...

Dynamic IPTables Firewalls:
http://www.gentoo.org/doc/en/articles/dynamic-iptables-firewalls.xml

Good luck!

-- Michael
Asked On
2009-05-14 at 10:12:53ID641
Tags

script kiddies

,

ssh

,

ids

,

iptables

,

hackers

Topic

Network Software Firewalls

Views
3099

Comments

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top Software Firewalls Experts

  1. arnold

    13,533

    0 points yesterday

    Profile
    Rank: Genius
  2. pwindell

    13,050

    0 points yesterday

    Profile
    Rank: Genius
  3. dpk_wal

    11,700

    0 points yesterday

    Profile
    Rank: Genius
  4. erniebeek

    10,264

    0 points yesterday

    Profile
    Rank: Genius
  5. breadtan

    10,051

    0 points yesterday

    Profile
    Rank: Genius
  6. keith_alabaster

    8,050

    0 points yesterday

    Profile
    Rank: Genius
  7. schmitty007

    7,668

    0 points yesterday

    Profile
  8. KeremE

    6,668

    0 points yesterday

    Profile
    Rank: Genius
  9. giltjr

    5,600

    0 points yesterday

    Profile
    Rank: Genius
  10. younghv

    5,500

    0 points yesterday

    Profile
    Rank: Genius
  11. thinkpads_user

    5,284

    2,000 points yesterday

    Profile
    Rank: Genius
  12. JZeolla

    5,200

    0 points yesterday

    Profile
  13. fmarshall

    5,175

    0 points yesterday

    Profile
    Rank: Wizard
  14. grimkin

    5,100

    0 points yesterday

    Profile
    Rank: Wizard
  15. digitap

    5,050

    0 points yesterday

    Profile
    Rank: Genius
  16. amatson78

    4,875

    0 points yesterday

    Profile
    Rank: Master
  17. rigan123

    4,500

    0 points yesterday

    Profile
    Rank: Guru
  18. Run5k

    4,200

    0 points yesterday

    Profile
    Rank: Genius
  19. Syed_M_Usman

    4,124

    0 points yesterday

    Profile
    Rank: Wizard
  20. Netty

    4,000

    0 points yesterday

    Profile
    Rank: Guru
  21. jhyiesla

    4,000

    0 points yesterday

    Profile
    Rank: Genius
  22. washburnma

    4,000

    2,000 points yesterday

    Profile
    Rank: Guru
  23. deimark

    4,000

    0 points yesterday

    Profile
    Rank: Sage
  24. dkotte

    4,000

    0 points yesterday

    Profile
    Rank: Guru
  25. madunix

    3,600

    0 points yesterday

    Profile
    Rank: Sage

Hall Of Fame