CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. Learn More

CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Announcing ModSecurity v2.8.0


12366_e747a9a8-5321-4584-a0dd-62c8d3769a30

The ModSecurity Project team is pleased to announce the availability of v2.8.0. To see the full release notes or download the the source packages, see the ModSecurity GitHub project release tab:

https://github.com/SpiderLabs/ModSecurity/releases

 

New Features

Version 2.8.0 comes with five important new features:

  • Status Reporting
  • JSON Request body Parser
  • @detectXSS Operator
  • SecConnReadStateLimit and SecConnWriteStateLimit Directives
  • FULL_REQUEST and FULL_REQUEST_LENGTH Variables

In addition to great new functionality, we have also improved the following:

  • Debug and Troubleshooting Documentation
  • Testing Platforms
  • Project Development Metrics

 

ModSecurity Status

See our previous blog post entitled "Introducing ModSecurity Status Reporting". Status Reporting simply provides the project team with some basic community usage data including the # of users, OS and web server platforms and software versions in use. This functionality is not enabled by default in ModSecurity, however we have activated it as part of our Recommended Base config file.

12376_e7bd7689-d19b-413d-a26f-353212df3986

 

The information that will be sent to the modsecurity.org server is also shared with the community through the website: http://status.modsecurity.org/.

8912_411ad24b-5e58-4812-bd54-ab0c1784bd3f

 

For the full list information that is sent to the ModSecurity website, check the ModSecurity Reference Manual.

 

JSON Parser

ModSecurity will automatically parse request body content when the Content-Type headers are:

  • www-x-form-urlencoded, or
  • multipart/form-data

If the request body Content-Type is something else, such as XML, then a SecRule is used to dynamically trigger libxml2 using the "requestBodyProcessor" parser.

10959_a169aed5-de54-4f4c-917e-7b6b26285854

 

Similarly, we have extended the request body parser support to now handle JSON content using yajl (Yet Another JSON Library).

10959_a169aed5-de54-4f4c-917e-7b6b26285854

When this configuration is used, ModSecurity will parse the JSON contents and populate the standard ARGS collection. We will be releasing a full blog post soon outlining the new JSON request body parsing feature. More information on the JSON Parser is available at: ModSecurity Reference Manual.

 

@detectXSS Operator

The new @detectXSS operator uses the most recent libinjection code that identifies possible XSS attacks. The new operator is active within both of our live demos:

More information about libinjection XSS detection: https://speakerdeck.com/ngalbreath/libinjection-from-sqli-to-xss

 

SecConnReadStateLimit and SecConnWriteStateLimit Directives

In previous versions of ModSecurity we introduced two directives to help combat Slow HTTP DoS Attacks:

  • SecReadStateLimit
  • SecWriteStateLimit

While these directives are helpful to mitigate attacks, they lacked the capability to correlate client IP address data. With ModSecurity v2.8.0, we have deprecated the previous directives for two new ones:

These directives establish a per-IP address limit of how many connections are allowed to be in SERVER_BUSY_READ or SERVER_BUSY_WRITE state. The big difference is that they are now able to accept optional parameters: @ipMatch, @ipMatchFromFile and @ipMatchF to allow for white-listing exceptions of these thresholds.

Note: This functionality is only available to Apache users.

 

FULL_REQUEST and FULL_REQUEST_LENGTH Variables

As a ModSecurity rule writer, I have found occasions where I would like to analyze the entire HTTP request content all within one single variable, rather than parsed into separate individual variables. This is now possible with FULL_REQUEST which contains the full request content including: request URI, headers and the request body. The format is essentially the same as what the browser sends across the wire with headers and the request body separated by a "blank line". In this release there is also available the FULL_REQUEST_LENGTH, which contains the amount of bytes that will be used when FULL_REQUEST is requested.

 

Debug and Trouble-Shooting Documentation

We have published documentation to aid the community in reporting bugs and steps for troubleshooting problems. Sometimes due to very specific configurations and/or dependency versions it is not possible for our development team to reproduce, in a timely manner way, an error reported by our users. In order to reduce the time to respond to these kinds of problems, we created the following documentation: Debugging ModSecurity. This is not a developer guide or debugging utility, but rather simple documentation that can provide enough information to the users to eventually debug and report (with rich and detailed information) a problem whenever a crash is detected. In addition, we have published the IIS-Troubleshooting guide. It provides very important information those who are facing problems with the ModSecurity for IIS version.

 

Testing Platforms

We have updated our continuous integration platform to use ARM. Besides the support for Linux (32 and 64 bits), Windows with different versions of Visual Studio - our Buildbots - can now compile our code inside a BeagleBone Black.

8772_39304283-deb6-47a9-9eff-c30a31264741

 

Our BeagleBone black is running Ubuntu 13.10 for ARM with all the developer tools installed, a build with all the regression tests is taking about 16 minutes for Apache and 14 minutes for Nginx. So far our Beagle made 182 builds of a total of 1610 made by all the slaves combined.

10561_8fa1de6b-228c-4be1-b270-1fe73acbe972

 

Project Development Metrics

A useful site for analyzing open source projects is Ohlo. There is a bunch useful tools and analysis graphs that show the health of the project. Here is an overview of the ModSecurity project:

10506_8ce98723-931c-416d-a74b-cb1a95143a16

 

GitHub also provides many interesting project development tools including "Graphs". With Graphs it is possible to figure out project metrics such as: what time of day or day of week does the project receive commits from the community? This question can be answered by reviewing the GitHub ModSecurity punch card.

7874_0ccde223-5ff6-46fe-a83f-828b656ae2cb

 

The balls diameter represents the amount of commits. The time is represented in the "X" axis and the day of the week on the "Y" axis.

 

Bug Fixes

In this release, 18 bugs were also fixed. The complete list of bug is listed below:

  • Correctly handling inet_pton in IIS version;
  • Nginx was missing a terminator while the charset string was mounted (Ref: #148);
  • Added mod_extract_forwarded.c to run before mod_security2.c (Ref: #594);
  • Added missing environment variables to regression tests;
  • Build system is now more flexible by looking at liblua at: /usr/local/lib;
  • Fixed typo in README file;
  • Removed the non standard compliant HTTP response status code 44 from modsecurity recommended file (Ref: #665);
  • Fixed segmentation fault if it fails to write on the audit log (Ref: #668);
  • Not rejecting a larger request with ProcessPartial. Regression tests were also added (Ref: #597);
  • Fixed UF8 to unicode conversion. Regression tests were also added (Ref: #672);
  • Avoiding segmentation fault by checking if a structure is null before access its members;
  • Removed double charset-header that used to happen due a hardcoded charset in Nginx implementation (Ref: #650);
  • Now alerting the users that there is no memory to proceed loading the configuration instead of just die;
  • If SecRuleEngine is set to Off and SecRequestBodyAccess On Nginx returns error 500. Standalone is now capable to identify whenever ModSecurity is enabled or disabled, independently of ModSecurity core (Ref: #645);
  • Fixed missing headers on Nginx whenever SecResponseBodyAccess was set to On and happens to be a filter on phase equals or over 3. (Ref #634);
  • IIS is now picking the correct version of AppCmd while uninstalling or installing ModSecurityISS. (Ref#632).

 

What's next?

Besides new features, for the next release we are aiming to do the following:

  • Solaris and FreeBSD Support on our regression test platform.
  • Better documentation on how to build ModSecurity in different platforms.
  • Documentation on how to contribute to the project including: how to use git, how to request a merge, how to edit and test our code, how to create new regression tests.

Submitted by Felipe Costa and Ryan Barnett

Latest SpiderLabs Blogs

EDR – The Multi-Tool of Security Defenses

This is Part 8 in my ongoing project to cover 30 cybersecurity topics in 30 weekly blog posts. The full series can be found here.

Read More

The Invisible Battleground: Essentials of EASM

Know your enemy – inside and out. External Attack Surface Management tools are an effective way to understand externally facing threats and help plan cyber defenses accordingly. Let’s discuss what...

Read More

Fake Dialog Boxes to Make Malware More Convincing

Let’s explore how SpiderLabs created and incorporated user prompts, specifically Windows dialog boxes into its malware loader to make it more convincing to phishing targets during a Red Team...

Read More