• Home
  • Hacking & Security
    • Network Hacking
    • Web Hacking
    • Social Engineering
    • Kali Linux
    Submit An Article
  • Courses
    • All Courses
    • Bundles
    • Masterclass
    • VIP Membership
    • FAQ

    Popular Courses

  • Shop
    • Hardware Bundles
    • Wireless Adapters
    • Pentesting Tools
    • Security
    • Accessories
    • Clothing
    • Books
    • All
  • Competition
  • Services
    Penetration Testing
    Consulting
    Code Review
    One on one Training
    Online Courses
    VPN
  • Blog
      • Cart

    VIP Membership Masterclass
    Got a question?
    [email protected]
    RegisterLogin
    zSecurity
    • Home
    • Hacking & Security
      • Network Hacking
      • Web Hacking
      • Social Engineering
      • Kali Linux
      Submit An Article
    • Courses
      • All Courses
      • Bundles
      • Masterclass
      • VIP Membership
      • FAQ

      Popular Courses

    • Shop
      • Hardware Bundles
      • Wireless Adapters
      • Pentesting Tools
      • Security
      • Accessories
      • Clothing
      • Books
      • All
    • Competition
    • Services
      Penetration Testing
      Consulting
      Code Review
      One on one Training
      Online Courses
      VPN
    • Blog
        • Cart

      Hacking & Security

      Network Intrusion Detection with Snort

      • Posted by Kalyani Rajalingham
      • Date November 3, 2020

      If you’re anything like me, you’re paranoid about network intrusion. In all event, we just need something to monitor our systems and warn us of potential attacks. This can be done through a package known as Snort. Snort is a real-time packet sniffer, packet logger and a network intrusion detection system.

      On Ubuntu, installing snort is easy via command line:

      sudo apt-get install snort -y

       

      The snort configuration files are located in /etc/snort/snort.conf. To test if the configuration files are working properly, type the following command:

      sudo snort -T -c /etc/snort/snort.conf -i <interface>

       

       

      Snort Rules

      The best part about snort is that though rules are available, they can be configured by the user. Once rules are created, they can be added to the configuration file as follows:

      include $RULE_PATH/<yourrule.rules>

       

      Once the path to the rules has been added to the configuration files, the rules can be created in the <yourrule.rules> file using an editor using the specified custom rules syntax. Rules (such as <yourrule.rules>) can be added and configured in /etc/snort/rules.

      Custom rules are easy to create using the specified rule headers/options. Snort rules abide by a specific format. The rule header is as follows:

      [action] [protocol][sourceIP][sourceport] → [destIP][destport] (rules options)

      —action: Snort action headers determines the fate of the packet if it matches the rule. Snort has 3 default modes: alert, log, and pass (ignore packet); there are 3 additional inline modes: drop, reject, and sdrop (block but no logging).

      —protocol: Snort analyzes 3 protocols: TCP, UDP, and ICMP.

      —sourceIP: The source IP (the incoming packet)

      —sourceport: The source port

      —destIP: The destination IP

      —destport: The desitnation port

       

      The rule options are as follows:

      –msg: The message displayed if there is a match.

      —content: The content that is searched in the data packet/payload.

      —flow: The connection state

       

      Rules

      An example of a rule:

      alert tcp $EXTERNAL_NET any -> $HOME_NET 21 (msg:"FTP ADMw0rm ftp login attempt"; flow:to_server,established; content:"USER"; nocase; content:"w0rm"; distance:1; nocase; pcre:"/^USER\s+w0rm/smi"; reference:arachnids,01; classtype:suspicious-login; sid:144; rev:9;)

      In this case, it says to alert the user if it encounters a TCP protocol coming from the external world from any port to the home network on port 21. It further says that the message to be displayed is “FTP Admworm ftp login attempt”. The content section contains the information that is searched in the payload.

       

      alert tcp $EXTERNAL_NET any -> $TELNET_SERVERS 23 (msg:"TELNET Solaris memory mismanagement exploit attempt"; flow:to_server,established; content:"|A0 23 A0 10 AE 23 80 10 EE 23 BF EC 82 05 E0 D6 90|%|E0|"; classtype:shellcode-detect; sid:1430; rev:7;)

      Here, if a TCP packet from any external network from any port encounters the telnet servers of the home network on port 23, it will display an alert. The payload is searched for the following content:”|A0 23 A0 10 AE 23 80 10 EE 23 BF EC 82 05 E0 D6 90|%|E0|”.

       

      Packet Sniffer

      In the packet sniffer mode, all incoming packets are displayed. To put snort into packet sniffer mode, type:

      sudo snort -dve

       

      Packet Logger

      In the packet logger mode, all incoming packets are logged into a file. To put snort into packet logger mode, type (the default logging directory is /var/log/snort):

      sudo -l <logging directory>

       

      Network Intrusion Detection

      In the network intrusion detection mode, all packets are analyzed using the configuration file. To put snort into network intrusion detection mode, type:

      snort -c /etc/snort/snort.conf -l <logging directory> -A console

       

      It will use the configuration files to log everything to the console.

      In other words, snort is an easy to use intrusion detection system that can come in handy for the paranoid. It will effectively verify if any kinds of attacks are conducted on your system within nanoseconds.

       

      • Share:
      Kalyani Rajalingham
      Kalyani Rajalingham

      I'm from Sri Lanka (live in Canada), and am a Linux and code lover.

      Previous post

      HTTP / HTTPS Enumeration
      November 3, 2020

      Next post

      Cyber Security & Devops With Zaid Sabih & Brett Fisher
      November 5, 2020

      You may also like

      domain-controllers_370x208
      Identifying Domain controller in a network
      24 March, 2023
      storm-braker_370x208
      Access Location, Camera & Mic of any Device 🌎🎤📍📷
      23 March, 2023
      Common-Authentication-Bypass-Techniques_370x208
      Common Authentication Bypass Techniques
      16 March, 2023

      Leave A Reply Cancel reply

      You must be logged in to post a comment.

      Categories

      • Cryptography
      • Cryptography
      • CTF
      • Forensics
      • Hacking & Security
      • Hardware
      • IOT
      • Kali Linux
      • Network Hacking
      • News
      • OSINT
      • Post Exploitation
      • Post Exploitation
      • Privacy
      • Programming
      • Security
      • Social Engineering
      • Uncategorized
      • Web Hacking

      Popular Posts

      Got a Blank Screen After Importing Kali in Virtual Box ? Here’s How To Fix It
      25Jan2018

      Connect with us

      • Facebook
      • Twitter
      • LinkedIn
      • Instagram
      • Youtube

      “Everything related to ethical hacking

      & cyber security in one place.”

      Quick Links

      • Home
      • About Us
      • Hacking & Security
      • Download Custom Kali
      • Contact
      • FAQ

      Services

      • Penetration Testing
      • Consulting
      • Code Review
      • One on one training
      • VPN
      • VIP Membership

      Company

      • About Us
      • Contact
      • Vulnerability Disclosure

      Support

      • FAQ
      • Forums

      Copyright © 2022 Z IT SECURITY LTD t/a zSecurity. All rights reserved.

      • Privacy
      • Shipping
      • Refunds
      • Terms

      Contribute

      Share your knowledge with the world

      SUBMIT AN ARTICLE

      Login with your site account

      Lost your password?

      Not a member yet? Register now

      Register a new account


      Are you a member? Login now

      Enroll in this course to access this lesson!

      All of our courses include:

      ✔ Lifetime, unlimited access to course materials & training videos.

      ✔ Watch online or download lectures for offline use.

      ✔ Verifiable certificate of completion from zSecurity, signed by the course instructor, Zaid.

      ✔ Get answers from our Support Team within a maximum of 15 hours.

      ✔ Unlimited Updates.

      Get free 1 month VIP membership per course with:

      ✔ Live mentorship and Q&A session with the course instructor, Zaid.

      ✔ Instant support from community members through our private discord channel.

      ✔ Daily updates with the latest tutorials & news in the hacking world.

      ✔ Daily resources like CTFs, bug bounty programs, onion services and more!

      ✔ Access our VIP community & connect with like-minded people.

      ✔ Discounts on other zSecurity products and services.

      We are using cookies to give you the best experience on our website. This includes but is not limited to:

      • Storing your settings and preferences.
      • Remember your access information
      • Track website performance and make our website more relevant to you.

      You can find out more about which cookies we are using or switch them off in settings.

      Privacy Overview

      This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

      Strictly Necessary Cookies

      Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

      3rd Party Cookies

      This website uses Google Analytics and Linkedin to collect anonymous information such as the number of visitors to the site, and the most popular pages.

      Keeping this cookies enabled helps us to improve our website.

      Please enable Strictly Necessary Cookies first so that we can save your preferences!

      Powered by  GDPR Cookie Compliance