Stopping a Brute-Force Attack with Snort

Stopping a Brute-Force Attack with Snort

Installing Snort on Ubuntu 22.04.1

You can find the Ubuntu 22.04.1 iso here:

One important note: To use IPS mode on Snort, you must have two network adapters. So, I have a network adapter connected to my Tech Subnet and a Network Adapter connected to NAT.

After setting up a virtual machine and getting it up and running. You can do a?sudo apt-get update?and?a sudo apt-get upgrade

Side note: I found out that ifconfig isn't installed on the bootup of Ubuntu 22.04.1, so what we have to do is?sudo apt install net-tools

After that, you should be able to use ifconfig.

Now, let's install snort. It is pretty straightforward.

sudo apt install snort

You can do?the snort --version?to ensure it is installed.

No alt text provided for this image

All right, let's add our rules to the local.rules in /etc/snort/rules

sudo nano /etc/snort/rules/local.rules

drop tcp any any -> 172.20.25.16 80 (msg: "Hacker tool found ALERT ALERT"; content:"(Hydra)"; offset: 12; sid: 1000001; rev: 2;)

Make sure you change the IP to your DVWA IP

You can find more information about writing snort rules here:

or here

Save it by pressing CTRL + S.

Let's start snort in IPS mode.

sudo snort -c /etc/snort/snort.conf -q -Q --daq afpacket -i ens33:ens37 -A console

No alt text provided for this image

Don't worry if you don't see any output on the screen. It will appear once we launch our attack.

Speaking of attack, let's launch our attack.

We will not cover the instructions to launch in complete detail; I'll provide the command. Remember to change your PHPSESSID to the current session id you currently have.

If you need the refresher for steps, you can look?here

Command:

hydra -V -L username.txt -P password.txt 172.20.25.16 http-get-form "/DVWA/vulnerabilities/brute/:username=^USER^&password=^PASS^&Login=Login:F=Username and/or password incorrect.:H=Cookie\: PHPSESSID=82nglh6dnikvej5j8fmka7b92l;security=low"        

This is the output from Hydra:

No alt text provided for this image

As you can see, the request using admin/password was dropped since the attacker was using Hydra. That means our rule works!

This is what it would look like if we didn't have the rule set in place:

No alt text provided for this image

This is what it looks like from snort:

No alt text provided for this image

Additionally, this rule doesn't prohibit regular valid users from login in.

I will log in using a regular browser (firefox)

No alt text provided for this image

As you can see, it works. That is all I have for now. Next is Command Injection

[Click-Here] for Command Injection

Muhamad Rifki Arisagas

System Engineer | CND | ECIH

1 年

Thank you for sharing this insightful article! It's been incredibly helpful in my IDS/IPS study. Grateful for the valuable information you've provided. ??

回复

要查看或添加评论,请登录

Nguyen N.的更多文章

  • Personal philosophy on life

    Personal philosophy on life

    My philosophy is to improve by 1% each day and only compare yourself to who you were yesterday. If you improve by 1%…

    1 条评论
  • Personal Careers Goals

    Personal Careers Goals

    For my personal career goal, I want to become a SOC (Security) analyst and work my way into a Cybersecurity Engineer…

    1 条评论
  • Volunteer Opportunity @ NoobVillage, and Cyber Supply Drop

    Volunteer Opportunity @ NoobVillage, and Cyber Supply Drop

    Noobvillage and Cyber Supply Drop both have a common mission. The mission is to provide free resources and training to…

    1 条评论
  • XSS (DOM) [DVWA]

    XSS (DOM) [DVWA]

    Today, we will be covering XSS (DOM). Our goal for today is Learn the methodology behind XSS (DOM) How to carry out an…

    1 条评论
  • SQL Injection (Blind) [DVWA]

    SQL Injection (Blind) [DVWA]

    Today, we will be covering SQL Injection. Our goal for today is Learn the methodology behind SQL Injection [Blind] How…

    1 条评论
  • SQL Injection [DVWA]

    SQL Injection [DVWA]

    Today, we will be covering SQL Injection. Our goal for today is Learn the methodology behind SQL Injection How to carry…

  • File upload Vulnerability [DVWA]

    File upload Vulnerability [DVWA]

    Today, we will be covering file inclusion. Our goal for today is Learn the methodology behind File Upload Attack How to…

    2 条评论
  • File inclusion (RFI/LFI) [DVWA]

    File inclusion (RFI/LFI) [DVWA]

    Today, we will be covering file inclusion. Our goal for today is Learn the methodology behind LFI/RFI How to carry out…

  • Cross-site request forgery (CSRF) [DVWA Edition]

    Cross-site request forgery (CSRF) [DVWA Edition]

    Today, we will be covering Cross-site Request Forgery (CSRF). Our goal for today is Learn the methodology behind…

  • Command Injection (DVWA Series)

    Command Injection (DVWA Series)

    Today, we will be covering Command injection. Our goal for today is Learn the methodology behind Command Injection How…

社区洞察

其他会员也浏览了