• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

How to create a Snort custom rule to not allow ip in the url?

Scheduled Pinned Locked Moved IDS/IPS
3 Posts 3 Posters 1.6k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    javcasta
    last edited by Jan 21, 2017, 1:25 PM

    Hi.

    How to create a Snort custom rule to not allow ip in the url?

    http://one-domain.com <–-> allow
    http://1.2.3.4 <---> not allow

    Regards.

    Javier Castañón
    Técnico de comunicaciones, soporte y sistemas.

    Mi web: https://javcasta.com/

    Soporte scripting/pfSense https://javcasta.com/soporte/

    1 Reply Last reply Reply Quote 0
    • B
      bmeeks
      last edited by Jan 21, 2017, 2:38 PM

      @javcasta:

      Hi.

      How to create a Snort custom rule to not allow ip in the url?

      http://one-domain.com <–-> allow
      http://1.2.3.4 <---> not allow

      Regards.

      I don't believe you can do that.  The source and destination address values in the rules must be numbers.  Variable substitution is allowed, but even then the value substituted for the variable at runtime must be numeric.  See the HOME_NET and EXTERNAL_NET variables for examples.

      No matter what you type in the URL field for your browser, the browser will convert it to the numeric IP address before sending the request out.  So your example domain name would generate a DNS lookup from your browser to get the actual IP address for the domain.  The browser would then put that IP address in the web request.  If what is typed in the URL is already a valid IP address, the DNS lookup part is skipped.  No matter, what leaves the browser destined for Snort to inspect has already been converted to a numeric IP address.

      I guess you could do some very limited content inspection on the payload of port 80 HTTP requests, but not sure that will be very effective.  And should the protocol be HTTPS instead, then content inspection by Snort won't work due to the encryption.

      Bill

      1 Reply Last reply Reply Quote 0
      • I
        iplost
        last edited by Jan 21, 2017, 6:56 PM

        Maybe with ???

        http://asecuritysite.com/forensics/snort?fname=webpage.pcap&rulesname=ruleip.rules

        IP address

        alert tcp any any <> any any (pcre:"/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/";
        msg:"IP address";content:"number";nocase;sid:9000003;rev:1;)

        1 Reply Last reply Reply Quote 0
        3 out of 3
        • First post
          3/3
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
          This community forum collects and processes your personal information.
          consent.not_received