ids
2 TopicsSecuring Your Applications with F5 BIG-IP IDS/IPS
Introduction Are you taking advantage of F5 BIG-IP’s built in IDS/IPS?IDS systems monitor traffic for anomalies, where IPS systems react to those events. Since BIG-IP version 13.1.0, you have had the ability to process traffic running through your BIG-IP with an IPS/IDS engine that we call Protocol Inspection. Enabling IDS/IPS on your BIG-IP will allow you to increase your defense-in-depth posture using your existing BIG-IP investment. This is the first article in the series where I will provide background and describe the features and functionality. The following articles will review: Features and functionality Deep dive into features Configurations and best practices Background First, some details explaining the differences and how F5 fits in the puzzle. Intrusion detection systems (IDS) are passive devices that monitor and log events on the network and can be configured to send alerts to an Administrator. These IDSs come in Network IDSs and Host based IDSs. This article will focus on Network based IDSs. Intrusion preventions systems (IPS) on the other hand have response capabilities. The responses range from dropping traffic, resetting the connection or passing the traffic to a sandboxed environment. The terms are used interchangeably, by most, so from now on I will refer to the systems as IDS/IPS. These IDS/IPS devices are usually placed in strategic ingress or egress locations such as security zones, data centers orthe edge of the network to capture and analyze critical traffic. Generally, these systems operate on signatures developed from known attacks or custom rules, protocol analysis and content matching. If your organization is running a BIG-IP, it most likely sits in one of these strategic locations within your network, protecting your most valuable assets. This enables you to take advantage of the built-in functionality of BIG-IP IDS/IPS engine instead of passing off the process to a 3rd party device which adds additional latency. The BIG-IP IDS/IPS capability is delivered as two major features: Protocol Inspection Engine Subscription Service BIG-IP Advanced Firewall Manager and Protocol Inspection BIG-IP’s Advanced Firewall Manager (AFM) is the module that allows you to take advantage of the IDS/IPS feature. When enabled, the Protocol Inspection Engine does both application protocol compliance checks and signature matching. The concept behind protocol match is the following: Drop traffic if it does not conform to protocol standards Drop traffic based on a signature match The versatility of the BIG-IP allows Protocol inspection to be applied as an AFM rule to all contexts (global/route/domain or virtual server) or directly to a virtual server.The beauty of this approach is in the processing of traffic.You can inspect the traffic pre-decryption or post- decryption based on polices, politics, or design. Want to step it up a notch further?Apply it to both an AFM rule and a virtual server. Protocol Inspection offers several features and functionality including the following: Granular Protocol Compliance Checks TCP, SCTP and UDP Signatures Learning and Staging Subscription Service Protocol Inspection and Signature Updates Granular Protocol Compliance Checks At the heart of F5s IDS/IPS is the Protocol Inspection Profile, seen below: After naming the profile, you have all the configuration options available to you. You enable or disable if this profile uses signatures, compliance checks, if will you collect stats for reporting in Application Visibility Reporting (AVR) and what services you are inspecting. We support 30 services currently. When you select one or multiples of services to inspect, you will have the option to see and further refine which signatures are used. Additional configuration selections of Suggestion Properties and Update Settings will be covered in another article. Signatures The F5 signatures are based on a subset of Snort rules syntax. When looking at signatures, you will notice they have been assigned a classification or grouping based on what the exploit is attempting to execute (see below): Additionally, signatures are broken down and grouped into “services” to assist in finding the specific signature you might look for. Drilling even further down into an exploit/signature, you can click the signature name and additional information becomes available. I’d like to call attention to the Last Refreshed date and the Hyperlinks to the References; CVE and Bugtraq ID. The Last Refreshed date indicates when the signature was last modified. Clicking either hyperlink takes you to the related article. Here is an example of the CVE article. Here is an example of the Bugtraq article. Subscription Service When AFM is initially downloaded and installed it comes with a base set of protocol inspections and signatures. In order to take advantage and receive regular timely updates to both the protocol inspection profiles and signatures, you need to add the IPS Subscription Service. Protocol Inspection and Signature Updates AFM allows the ability to manually check for and import updated files when you decide or have time. Or for the easy button, the ability to automatically check, download and deploy updated for updated files. You have the option to select whether to “Download” or “Download and Deploy” and the frequency of updating, daily, weekly or monthly. Additionally, you get visibility into what is available to install and what is available to deploy. . Review the example screenshot below. Summary In this article we discussed the features and functionality of BIG-IP AFMs IDS/IPS, configuration and updates of the Protocol Engine and signatures. In the next article we will look deeper into protocol compliance, inspections and signatures. Appendix Advanced Firewall Manager Datasheet Advanced Firewall Manager Operation Guide AFM Intrusion Prevention Systems3.9KViews2likes2CommentsConverting a Snort Rule to an AFM Protocol Inspection Custom Signature
We recently had the opportunity to demonstrate what I consider the most interesting use case for Protocol Inspection custom signatures: adapting existing Snort rules for use in AFM Protocol Inspection. Security company FireEye announced a breach in which the tools used by their red teams to test network and application defenses were stolen. FireEye released Snort rules to identify traffic associated with the command and control of these tools. We ported these Snort rules to AFM Protocol Inspection custom signatures and published them in F5's Guidance.https://devcentral.f5.com/s/articles/F5-SIRT-FireEye-Breach-Guidance The reason I find this such a compelling use case is that most of our customers have day jobs. They are not full-time security researchers who model application protocols and swap inside information with other security researchers as a profession. However, we can leverage the work of those who do have those jobs and adapt the Snort rules they write for use with AFM Protocol Inspection. That's exactly what we've done here and I'll show you the process we used to do it. General Observations First, I want to describe the relationship between a Snort rule and a Protocol Inspection custom signature. Basically, the detection syntax is the same, but everything else is different. Both provide tons of useful meta-data, but how that is provided by the two systems is different. Another thing to think about is preservation of information. I don't want my custom signature to lose any information present in the Snort rule. At a minimum, you will want to record where the custom signature came from. I recommend recording the source of the Snort rule in your custom signature in the references or reference-links fields, and retain anything that might provide a breadcrumb to your incident response, such as the Snort rule's msg , reference , and metadata field contents. If you can preserve the Snort rule'ssid by the use of prefixes or suffixes in the custom signature'sid , that might help an incident responder track down the original Snort rule. I'll show one approach to doing this in my conversion below. The Snort Signature - what we're adapting We'll adapt the following signature, provided by FireEye under a BSD license (see below): alert tcp any $HTTP_PORTS -> any any (msg:"Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]"; flow:from_server,established; content:"{\"meta\":{},\"status\":\"OK\",\"saved\":\"1\",\"starttime\":17656184060,\"id\":\"\",\"vims\":{\"dtc\":\""; sid:25888; rev:1;) Signature Creation walk-through Here's how I built out one Snort rule conversion into a custom signature. We'll go field by field, building out the command and editing as we go. The added or changed sections at each step will be in bold. I put a comparison of Snort rule elements and custom signature fields after the walk-thru if you want details on each step. I have a tmsh session open on the BIG-IP, in the security.protocol-inspection.signature context, and a Snort rule I can cut from to paste into my tmsh session. The first field I need is the custom signature name. I will use the msg field from the Snort rule as the basis for the name . This follows the convention for importing signatures from a file. I copy the Snort rulemsgfield, Backdoor.HTTP.BEACON.[CSBundle MSOffice Server], omitting the starting and ending quotation marks. I need to remove the brackets and remove or replace the spaces to use in the name. My convention is to remove prohibited characters and swap underscore characters for spaces. create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server I can use the Snort rule msg unchanged for the description so long as I enclose it in quotes, and since it's in the copy buffer I'll add that field to my command next. create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server description "Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]" Now theprotocolfield. This has to take the form of a list enclosed in curly braces. I take it from the protocol specified in the Snort rule's header. create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server description "Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]" protocol {tcp} Now thereferencesand reference-links. I took these from the web page announcing the issue the Snort rules address. create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server description "Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]" protocol {tcp} references "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" reference-links "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" Now the service, which is a mandatory field. I infer this is http from the Snort rule header section $HTTP_PORTS and the "HTTP" string in the msg. If you do not specify a service, the "other" service is selected for you. create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server description "Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]" protocol {tcp} references "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" reference-links "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" service http I derive theidfrom the Snort rulesid25888. I'll prepend a 1 to bring it into the 100000+ range used for custom signatures. Because we have the references filled out, this is not critical. In fact, you could preserve the original Snort rulesidin the documentation section and just let the system assign the next available id number. create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server description "Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]" protocol {tcp} references "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" reference-links "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" service http id 125888 Specifying thedirectioncan reduce log spam and misleading stats. For example, if you are interested in requests for http://mysite.example.com/../../etc/passwd but don't care about 404 errors in response, specify thedirectionto-server. That way only traffic to the server will match. In this case, our Snort rule's direction is to-client, which I infer from the Snort header source port being $HTTP_PORTS. create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server description "Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]" protocol {tcp} references "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" reference-links "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" service http id 125888 direction to-client Now we get to the good stuff: the sig field. I add sig " to my signature. sig is a container for pcre and content checks, and the container is delimited by UNESCAPED quotation marks. create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server description "Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]" protocol {tcp} references "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" reference-links "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" service http id 125888 direction to-client sig " I copy the payload detection elements from the Snort rule - all the content and pcre checks - and paste that in. create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server description "Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]" protocol {tcp} references "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" reference-links "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" service http id 125888 direction to-client sig "content:"{\"meta\":{},\"status\":\"OK\",\"saved\":\"1\",\"starttime\":17656184060,\"id\":\"\",\"vims\":{\"dtc\":\""; I add a double-quote character to the end, to identify the end of the sig field. This should NOT be escaped. create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server description "Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]" protocol {tcp} references "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" reference-links "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" service http id 125888 direction to-client sig "content:"{\"meta\":{},\"status\":\"OK\",\"saved\":\"1\",\"starttime\":17656184060,\"id\":\"\",\"vims\":{\"dtc\":\"";" I then go through and escape the quotation marks at the beginning and end of every content and pcre check with a backslash. Note I can ignore quotation marks already escaped inside these content and pcre checks. These added backslashes are in red for slightly easier identification. create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server4 description "Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]" protocol {tcp} references "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" reference-links "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" service http id 125888 direction to-client sig "content:\"{\"meta\":{},\"status\":\"OK\",\"saved\":\"1\",\"starttime\":17656184060,\"id\":\"\",\"vims\":{\"dtc\":\"\";" Now I can hit the 'Enter' key and my custom signature will be added. I can then select and enable it in Protocol Inspection policies. One note: the validation for custom signatures is letting me get away with a lot because I'm using BIG-IP v16.0.0. 14.x will not tolerate a signature definition that includes characters that are used in Snort syntax. It's a good practice to use the hexadecimal representation even in 16x. Here's what that would look like: create Backdoor.HTTP.BEACON.CSBundle_MSOffice_Server4 description "Backdoor.HTTP.BEACON.[CSBundle MSOffice Server]" protocol {tcp} references "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" reference-links "https://www.fireeye.com/blog/threat-research/2020/12/unauthorized-access-of-fireeye-red-team-tools.html" service http id 125888 direction to-client sig "content:\"{|22|meta|22 3a|{},|22|status|22 3a 22|OK|22|,|22|saved|22 3a 22|1|22|,|22|starttime|22 3a|17656184060,|22|id|22 3a 22 22|,|22|vims|22 3a|{|22|dtc|22 3a 22|\";" Copyright 2020 by FireEye, Inc. The 2-Clause BSD License Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. For more information on Protocol Inspection Custom Signatures, see K00322533 Overview of Protocol Inspection Custom Signatures1.3KViews1like2Comments