Skip to content
November 1, 2026
  • Bluesky
  • Facebook
  • Linkedin
  • Mastodon
  • RSS
  • Twitter
  • Youtube

Daily CyberSecurity

Zero-hour alerts. Unmatched analysis.

Primary Menu
  • Home
  • CVE Data
    • CVE Watchtower
    • Top Exploited CVEs
    • CVE Stats by Vendor
    • Q2 2026 Report
    • CVE Alerts
    • CVE Alert Settings
    • Pricing
  • Cyber Criminals
  • Data Leak
  • Free Tools
    • CVSS 3.1 Calculator
    • Certificate Viewer
    • DNS Lookup
    • Encoder & Hash Generator
    • IP / Subnet Calculator
    • Whois Lookup
  • Linux
  • Malware
  • Vulnerability
  • Submit Press Release
  • Weekly Recap
Light/Dark Button
  • Home
  • Technique
  • APACHE PROTECTION WITH MODSECURITY
  • Technique

APACHE PROTECTION WITH MODSECURITY

Do Son July 8, 2017 4 minutes read

There are so many ways to protect Web-server. On this post, I’m going to guide how to use ModSecurity WAF to protect Apache webserver. 

ModSecurity is an open source, cross-platform web application firewall (WAF) developed by Trustwave’s SpiderLabs. It has a robust event-based programming language which provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring, logging, and real-time analysis. With over 10,000 deployments world-wide, ModSecurity is the most widely deployed WAF in existence. ModSecurity – this firewall is designed as a module for the Apache, which allows it easily install and use. Protection using ModSecurity can prevent:

  • SQL-injection;
  • XSS;
  • Trojans;
  • bots;
  • capture session;
  • and many other attacks and break-ins.

Install ModSecurity

apt-get install libapache2-mod-security2

and turn it on:

a2enmod security2

By default filtering rules are not included, and the rules themselves have the extension .conf and loaded from the directory /etc/ModSecurity/ (rules specified location in the /etc/apache2/mods-available/security2.conf  file) and is as follows:

IncludeOptional /etc/modsecurity/*.conf

The list can be several directories from which the rules are loaded.

Add a new directory, which will be based on our rules.

crs – for a basic set of rules;
custom – to its rules.

Add a directory for further expansion of the list of rules:

IncludeOptional /etc/modsecurity/rules/crs/*.conf
IncludeOptional /etc/modsecurity/rules/custom/*.conf

and create the required directories:

mkdir /etc/modsecurity/rules/crs
mkdir /etc/modsecurity/rules/custom

Thereafter including basic configuration. To do this, copy or rename the default configuration file (located in the directory /etc/ModSecurity/) modsecurity.conf-recommended file modsecurity.conf

cp /etc/modsecurity/modsecurity.conf{-recommended,}

little change it:

replace the first Directive SecRuleEngine DetectionOnly on

SecRuleEngine On

including blocking, available options:  On, Off, DetectionOnly.

Allowed to scan the contents of the request body:

SecRequestBodyAccess On

Limit the size of POST query parameter SecRequestBodyLimit. If there is no file download mechanism on the server, you can severely limit the transmitted data. We are limited to 15MB. The number of bytes it will be 1024 * 1024 * 15 = 15728640

SecRequestBodyLimit 15728640

Restrict stored in memory POST request when sending the file (except the file size), the surplus will swap to disk, which slows things down a little but does not overwhelm the memory under any circumstances. This is done in parameter SecRequestBodyInMemoryLimit . Restrict 128Kb.

SecRequestBodyInMemoryLimit 131072

The basic rules are set, and an advanced set can be downloaded from the official page of OWASP ModSecurity Core Rule Set and put *.conf files in the previously specified directory /etc/ModSecurity/rules/crs , where our additional rules.

In Debian additional rules are already included in the package and is located at /usr /share/ModSecurity-crs/ .
Turn them into a folder by creating symlinks crs :

ln -s /usr/share/modsecurity-crs/modsecurity_crs_10_setup.conf /etc/modsecurity/rules/crs/modsecurity_crs_10_setup.conf

It is also required for some sets of rules *.data files. Therefore, they also need to make symlinks.
I’ve included a basic setting modsecurity_crs_10_setup.conf and some of the rules in the folder base_rules.
It is not necessary to include all the rules at once. With great probability, it will block the Web server.

It now remains only to exclude directories that ModSecurity well or need to interfere.
This is done by exclusion from the list of monitored hosts to configure Apache Web-server . To exclude the entire virtual host use the following code:

<ifmodule security2_module>
SecRuleEngine Off
</ifmodule>

this code can be used to exclude specific directories:

<directory “/var/www/noModSecurity”>
<ifmodule security2_module>
SecRuleEngine Off
</ifmodule>
</directory>

Now a few words about the proper implementation. Many of the rules can cause a denial of work Web applications. Due to the fact that ModSecurity deemed malicious requests. Therefore it is better to include only first detection mode ( SecRuleEngine DetectionOnly ) and see which rules apply and when.
See what rules can be practiced in the log file. By default it is at /var/log/apache2/modsec_audit.log . This file is written all information about the work of ModSecurity.

 

Tags: apache modsecurity

Search

CVE ALERTS
📈

EPSS Spike Alerts
Catch risk spikes before they make headlines.

🎯

Custom EPSS/CVSS
Set score thresholds to effectively filter noise.

🛡️

Exploit Intel
Real-world exploit signals beyond the KEV catalog.

🐙

GitHub Issues
Auto-create alert tickets without duplication.

📬

Weekly Digest
Clean summaries, eliminating email spam.

🏷️

Watchlist Groups
Tag vulnerabilities by team (Infra/AppSec/SOC).

🔀

Smart Routing
Route chat channels based on severity levels.

🚨

RBP Tracker
Early warning detection and tracking system.

Subscribe – $7/mo or try free for 14 days →

🚨 Active Exploits in the Wild

  • CVE-2010-20125CVSS 8.7
    DedeCMS before 5.7 contains a file inclusion vulnerability in plus/carbuyaction.php that allows remote unauthenticated attackers to control the...
    Watchtower Verified📅 Updated: Oct 30, 2026
  • CVE-2015-20130CVSS 5.1
    Netsweeper before 4.0.11 and 4.1.0 before 4.1.5 contains a reflected cross-site scripting vulnerability in webadmin/reporter/view_server_log.php that allows remote...
    Watchtower Verified📅 Updated: Oct 30, 2026
  • CVE-2026-111357CVSS 7.0
    Ivanti Connect Secure 22.8R2.4 mishandles the manner in which the dsinvoked broker trusts DSCache configuration data, leading to...
    CISA KEV📅 Added to KEV: Oct 30, 2026
  • CVE-2026-118527CVSS 4.3
    Use of predictable filenames in Ivanti Connect Secure before versions 25.1.1.3 and 22.8R2.6 allows a remote authenticated attacker...
    CISA KEV📅 Added to KEV: Oct 30, 2026
  • CVE-2026-118539
    This module enables you to sell goods and services to customers through an included shopping cart and checkout...
    Admin intel📅 Updated: Oct 29, 2026
  • CVE-2022-31034CVSS 8.3
    Impact All versions of Argo CD starting with v0.11.0 are vulnerable to a variety of attacks when an...
    Watchtower Verified📅 Updated: Oct 29, 2026
  • CVE-2026-112353CVSS 6.2
    GFI KerioConnect (Kerio Connect) before 10.0.8 Patch 2 contains a stored cross-site scripting vulnerability in the Webmail component...
    Watchtower Verified📅 Updated: Oct 29, 2026
  • CVE-2026-116779CVSS 9.8
    Summary `sofia_presence_handle_sip_i_message()` splits the To user of an inbound SIP MESSAGE on `+` and treats the left half...
    Admin intel📅 Updated: Oct 29, 2026
Powered by CVE Watchtower

Critical Vulnerabilities

  • CVE-2026-120198CVSS 10.0
    A vulnerability has been found in WAVLINK WL-WN530BE1-A V251117. Affected is the function con_check_read_finish of the file /protocol.csp....
    📅 Updated: Nov 1, 2026
  • CVE-2026-120197CVSS 9.4
    A flaw has been found in WAVLINK WL-WN530HG4B M_V260724. This impacts the function port_forward of the file /cgi-bin/wapi.cgi....
    📅 Updated: Nov 1, 2026
  • CVE-2026-120196CVSS 9.4
    A vulnerability was detected in WAVLINK WN579X3-D V250402. This affects the function port_forward of the file /cgi-bin/wapi.cgi. The...
    📅 Updated: Nov 1, 2026
  • CVE-2026-120195CVSS 10.0
    A security vulnerability has been detected in WAVLINK WL-WN579A3-A 2026-03-10-94f93d4. The impacted element is the function set_wzdgwMesh of...
    📅 Updated: Nov 1, 2026
  • CVE-2026-10579CVSS 9.8
    A flaw was found in Picketlink Federation SAML; the unsolcited response handler would accept forged assertions with no...
    📅 Updated: Nov 1, 2026
  • CVE-2025-32911CVSS 9.0
    A use-after-free type vulnerability was found in libsoup, in the soup_message_headers_get_content_disposition() function. This flaw allows a malicious HTTP...
    📅 Updated: Nov 1, 2026
  • CVE-2026-120189CVSS 10.0
    A vulnerability was identified in D-Link DIR-505 1.10B02. Affected is the function save_upload_file/mp_upload_file of the file /usr/bin/tftpd of...
    📅 Updated: Nov 1, 2026
  • CVE-2026-98432CVSS 9.8
    In the Linux kernel, the following vulnerability has been resolved: ipv4: free inet_opt and ireq_opt after an RCU...
    📅 Updated: Oct 31, 2026
Powered by CVE Watchtower

Daily CyberSecurity

  • About SecurityOnline.info
  • Advertise with us
  • Announcement
  • Contact
  • Contributor Register
  • Login
  • Disclaimer
  • DCMA
  • Privacy Policy
  • About SecurityOnline.info
  • Advertise on SecurityOnline.info
  • Contact Us

When you purchase through links on our site, we may earn an affiliate commission. Here’s how it works

  • CVE Watchtower
  • CVE Statistics by Vendor 2026
  • Q3 2026 Report
  • Top Exploited CVEs
  • Bluesky
  • Facebook
  • Linkedin
  • Mastodon
  • RSS
  • Twitter
  • Youtube
© 2017 - 2026 Daily CyberSecurity. All Rights Reserved.