Antisipasi SSH Brute Force Attack

Sebenarnya saya sudah malas menulis tutorial dan sejenisnya, tapi karena belakangan ini ada report dari temen temen masalah sering muncul log failed login ke ssh, yang kebanyakan dari IP luar. Ya, ini pasti brute force attack.

Setelah googling kesana kesini, akhrinya dapat cara sederhana untuk mengantisipasi serangan brute force SSH

#!/bin/bash
#This script will monitor for failed login attempts and after a specified number of times add the ip to a deny list
#Chad
LOGFILE=”/var/log/secure”
HOSTSDENY=”/etc/hosts.deny”
BADCOUNT=”5″
# read logfile and look for invalid login attemps
grep sshd $LOGFILE |grep “Invalid user”| awk ‘{print $NF}’|sort|uniq -c|sort -n|sed “s/[[:space:]]*//” | while
read i
do
# read number of failed attempts
count=`echo $i | cut -d” ” -f1`
# read ip address from failed attempt
ip=`echo $i | cut -d” ” -f2`
#check hostdeny file to see if IP already exist
already=`grep $ip $HOSTSDENY | grep sshd`
#if IP does not exist add it to hostdeny file
if [ -z "$already"  ]
then
if [ "$count" -ge "$BADCOUNT" ]
then
echo “sshd: “$ip >> $HOSTSDENY
fi
fi
done

Simpan script di atas dan jalankan dengan cron. Disini kita memanfaatkan hosts.deny , sehingga untuk 5 kali failed login SSH, secara otomatis IP nya akan di masukkan ke dalam hosts.deny server

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • Posterous
This entry was posted in Hacking and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

23 Comments

  1. Posted February 5, 2010 at 9:26 am | Permalink

    Wah. Om yudi carder hebat sekali… *kagum*

  2. Posted February 5, 2010 at 2:23 pm | Permalink

    @hamid
    hahahah hus hus hus

  3. Posted February 5, 2010 at 4:43 pm | Permalink

    Ooow… jadi gitu toh ya ya ya…

    Dan beberapa webpanel, salah satu contoh cPanel/WHM sudah memberikan fasilitas itu. Tinggal di enable / disable. Dari sisi security & firewallnya juga sudah ada settingan untuk itu.

    Jadi itu ato ini informasi ini sangat bermanfaat ini itu *halah

    Salut to #yudicarder

  4. Posted February 5, 2010 at 4:46 pm | Permalink

    Yudi Carder sakti xD

  5. Posted February 5, 2010 at 6:26 pm | Permalink

    Test Komen, warna backgroundnya moga-moga kuning .. buhahahah

  6. Posted February 5, 2010 at 10:30 pm | Permalink

    @masdapit
    huehehe
    ampun juragan XD

    @crussd2
    *lempar ssh*

    @omyn
    bercak kuning po?

  7. Posted February 13, 2010 at 4:26 am | Permalink

    ha ha ha

    sorry OOT

    klo cara colok- colok SSH-2.0-OpenSSH_4.5 cemana sih ?
    binun ane.

    klo ada , tolong kasih tau ane yah gay eh guys :P

    ha ha

  8. Posted February 13, 2010 at 5:21 pm | Permalink

    @xXfaZzXx
    wah sayangnya ane kagak mudeng ni..
    xixixixi

  9. Posted February 18, 2010 at 7:37 pm | Permalink

    woh,tep #yudicarder nek iki

  10. Posted February 19, 2010 at 3:11 am | Permalink

    @kentruk
    #yudicarder ki sapa truk?

  11. Posted February 21, 2010 at 8:49 am | Permalink

    mas e heker :P

  12. Posted February 23, 2010 at 9:38 am | Permalink

    @afithk
    mas e karder :p

  13. Posted February 25, 2010 at 6:40 pm | Permalink

    sebelum di brute force, ganti aj portnya..:D

  14. Posted February 27, 2010 at 10:44 am | Permalink

    @anjar
    dolo udah, tp bbrp alasan akhirnya di balikin ke semula
    di markas besar n via hp klo ganti port ga bisa di akses
    klo di markas kepaksa pake tunnel dolo

  15. apaajha
    Posted March 6, 2010 at 9:20 am | Permalink

    script dari sebelah y…?
    tambahan aja, script ini ga berlaku jika attacker menggunakan user root dalam aksi brute force nya…

    Regards,

  16. Posted March 7, 2010 at 10:43 pm | Permalink

    @apaajha
    yoyoy

    lah kalo login as root, ngapain juga nge brute ssh nya lagi :)

  17. Posted April 22, 2010 at 7:13 pm | Permalink

    wew, mantap kali #yudicarder ini..

  18. Posted April 29, 2010 at 6:41 pm | Permalink

    wha ini ini.. *klik-kanan sep as* #minggat

  19. Posted April 30, 2010 at 2:44 am | Permalink

    @tedi
    woh programmer e teko :o

  20. Posted June 11, 2010 at 1:32 pm | Permalink

    Ctrl+D (Bookmark)
    mas bernad sakti eh… :D

  21. Posted June 11, 2010 at 6:10 pm | Permalink

    @astonix
    hayah XD *keplak

  22. apaajha
    Posted July 8, 2010 at 3:41 pm | Permalink

    @bernadsatriani

    maksudnya klo si hacker ngebrute alias nembak user root kita.. script ini ga berlaku alias basi kayak nasi kerak ga pake telor wakakaa… pizz kk… pake BFD lebih di sarankan kk… coba jalanin perintah

    #cat /var/log/secure | grep root

    pasti masih kebobolan… :P

  23. mengacau
    Posted July 17, 2010 at 10:27 pm | Permalink

    dibobol

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>