- Details
- Written by: Brent Bransom
- Category: Tutorials
- Hits: 21
How to Fix EasyStore Product Image Deletion 403 Errors Caused by ModSecurity
If you're running Joomla with EasyStore and OWASP ModSecurity CRS enabled, you may encounter an unexpected HTTP 403 Forbidden error when attempting to delete product images from the EasyStore administration panel.
The issue occurs because EasyStore uses an HTTP DELETE request when removing product images. Some default OWASP Core Rule Set (CRS) configurations do not permit the DELETE method, causing ModSecurity to block the request before Joomla can process it.
This tutorial explains how to identify the offending security rule and implement a targeted exception that allows EasyStore to delete product images without disabling ModSecurity or weakening security across your hosted websites.
Symptoms
You may experience the following symptoms:
-
Product images cannot be deleted from EasyStore.
-
The administration interface returns a 403 Forbidden error.
-
Other EasyStore functions continue working normally.
-
ModSecurity audit logs show blocking events.
-
The browser's developer tools show failed DELETE requests.
The Apache error log may contain messages similar to:
ModSecurity: Access denied with code 403 (phase 2) REQUEST-949-BLOCKING-EVALUATION.conf RESPONSE-980-CORRELATION.conf
These messages indicate that ModSecurity's anomaly scoring system has blocked the request. However, they do not necessarily identify the original rule responsible for the block.
Step 1: Locate the ModSecurity Audit Log
Connect to your web server using SSH.
The location of the ModSecurity audit log depends on your operating system, web server configuration, and hosting environment.
Common locations include:
/var/log/modsec_audit.log /var/log/apache2/modsec_audit.log /var/log/httpd/modsec_audit.log
If you're unsure where your audit log is located, run:
sudo find /var/log -type f \( -iname '*modsec*' -o -iname '*audit*' \) 2>/dev/null
Once you locate the audit log, search for your affected domain:
sudo grep -i -B 10 -A 25 "yourdomain.com" /path/to/modsec_audit.log | tail -150
Replace yourdomain.com with your actual domain name and /path/to/modsec_audit.log with the location of your audit log.
Step 2: Identify the Offending ModSecurity Rule
When examining the audit log, look for the original rule violation.
In our investigation, we identified the following entry:
[id "911100"] [msg "Method is not allowed by policy"] [data "DELETE"]
The offending rule was:
REQUEST-911-METHOD-ENFORCEMENT.conf
Rule ID:
911100
The rule belongs to the OWASP Core Rule Set and enforces permitted HTTP request methods.
Why Does This Happen?
EasyStore uses an HTTP DELETE request to remove product images.
An example request generated by EasyStore looks similar to:
DELETE /easystore/administrator/index.php?option=com_easystore&task=/api.media&product_id=35&ids=464&_method=delete
The request is legitimate, but ModSecurity's default allowed-method configuration does not include DELETE.
Consequently, ModSecurity assigns the request an anomaly score of 5.
The blocking evaluation rule then triggers:
[id "949110"] [msg "Inbound Anomaly Score Exceeded (Total Score: 5)"]
The RESPONSE-980-CORRELATION.conf entry is simply reporting the accumulated security score. It is not the original cause of the problem.
Step 3: Locate the CRS Exclusion Configuration
Instead of modifying the original OWASP rule, we will create a targeted exclusion.
OWASP CRS provides a dedicated configuration file for exclusions that need to be evaluated before the core rules.
Depending on your installation, the file may be named:
REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf
Its location depends on how ModSecurity and OWASP CRS were installed.
Common locations include:
/etc/modsecurity//etc/apache2/modsecurity.d/rules//etc/httpd/modsecurity.d/
You can search for the configuration file using:
sudo find /etc -name 'REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf' 2>/dev/null
Before making changes, create a backup of the file.
For example:
sudo cp /path/to/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf \ /path/to/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.bak
Replace both paths with the actual location of your configuration file.
Open the file using your preferred text editor.
For example:
sudo nano /path/to/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf
Step 4: Add a Targeted EasyStore Exception
Add the following configuration to the bottom of the file:
# EasyStore - Allow product media deletion # Only applies to downmadisonavenue.com # Restricted to EasyStore's product media DELETE endpoint. SecRule REQUEST_HEADERS:Host "@streq downmadisonavenue.com" \ "id:1001001,phase:1,pass,nolog,chain" SecRule REQUEST_METHOD "@streq DELETE" \ "t:none,chain" SecRule REQUEST_URI "@beginsWith /easystore/administrator/index.php" \ "t:none,chain" SecRule ARGS:option "@streq com_easystore" \ "t:none,chain" SecRule ARGS:task "@streq /api.media" \ "t:none,ctl:ruleRemoveById=911100"
Important: Replace downmadisonavenue.com with your own domain.
Also ensure that the custom rule ID 1001001 is not already being used by another custom ModSecurity rule on your server.
How This Exception Works
The exception only activates when all five conditions match:
| Condition | Required value |
|---|---|
| Host | downmadisonavenue.com |
| HTTP Method | DELETE |
| Request URI | /easystore/administrator/index.php |
| Joomla Component | com_easystore |
| EasyStore Task | /api.media |
When all conditions match, ModSecurity removes rule 911100 from the current transaction. This is important because we are not disabling HTTP method enforcement globally. Other websites and applications hosted on the same server continue receiving the normal ModSecurity protections.
Step 5: Validate the Web Server Configuration
After saving the file, check your Apache configuration for syntax errors.
On Apache installations, run:
sudo apachectl configtest
On some systems, the command may instead be:
sudo httpd -t
A successful result should look like:
Syntax OK
If the configuration passes, reload Apache:
sudo systemctl reload apache2
On systems using the httpd service:
sudo systemctl reload httpd
If the configuration reports an error, do not reload until the problem has been corrected.
Note: If you are using Nginx with ModSecurity, the configuration validation and reload commands will differ. Make sure you are editing the configuration file actually loaded by your ModSecurity installation.
Step 6: Test EasyStore Product Image Deletion
Log in to your Joomla administrator panel.
Navigate to:
-
Components → EasyStore.
-
Open Products.
-
Edit a product containing multiple images.
-
Attempt to delete one of the product images.
The image should now delete successfully.
You can also inspect the ModSecurity audit log again:
sudo grep -i -B 3 -A 8 "downmadisonavenue.com" /path/to/modsec_audit.log | tail -80
You should no longer see rule 911100 blocking the matching EasyStore DELETE request.
Security Considerations
It is important not to solve ModSecurity problems by simply disabling the firewall or excluding an entire website from inspection. The approach demonstrated here is more restrictive. We are allowing one specific HTTP method for one specific application endpoint on one specific domain.
The following protections remain in place:
-
OWASP Core Rule Set continues inspecting other requests.
-
SQL injection protections remain enabled.
-
Cross-site scripting protections remain enabled.
-
Other HTTP method enforcement remains enabled.
-
Other hosted domains are unaffected by this exception.
Joomla authentication, authorization, and CSRF protections must also remain enabled.
Note: This configuration addresses the specific rule violation identified in our EasyStore installation. Other installations may encounter different ModSecurity rules or use different application paths. Always inspect your own audit logs before implementing an exclusion.
Conclusion
ModSecurity is an important part of securing a web hosting environment, but occasionally legitimate application requests can trigger security rules. EasyStore's use of HTTP DELETE for product image management is one example. Rather than disabling ModSecurity or weakening server-wide protections, a targeted CRS exclusion allows the application to perform its intended operation while preserving the remaining security protections. This approach is useful for administrators running Joomla and EasyStore on a variety of hosting environments who want to maintain security without interfering with legitimate application functionality.
AGG Town Tech
Practical Technology. Real Solutions.
Website: https://agg-town-tech.com
- Details
- Written by: Brent Bransom
- Category: Tutorials
- Hits: 38
How to Fix Roundcube Webmail 403 Errors Caused by ModSecurity in Plesk
If you manage a Plesk server running multiple websites and email accounts, you may eventually encounter an issue where Roundcube webmail suddenly returns a 403 Forbidden error. In our case, users could access the webmail login page, but clicking certain folders, opening messages, or navigating through Roundcube caused ModSecurity to block the request. The problem wasn't Roundcube, Postfix, or Dovecot. It was a false positive generated by the OWASP Core Rule Set (CRS) running under ModSecurity.
This tutorial explains how to identify the problem and implement a targeted fix without disabling ModSecurity.
1. Understanding the Problem
The affected webmail installations included:
-
webmail.downmadisonavenue.com
-
webmail.agg-town-tech.com
When navigating through Roundcube, Apache's error log showed messages similar to:
ModSecurity: Warning. Pattern match at REQUEST_HEADERS:Referer.
[id "932239"]
[msg "Remote Command Execution:
Unix Command Injection found in user-agent or referer header"]
The request was being flagged because the Referer header contained a normal Roundcube URL:
https://webmail.agg-town-tech.com/roundcube/?_task=mail&_mbox=INBOX.Sent
The CRS rule incorrectly interpreted part of the URL as a potential command-injection attempt. The next rule, 949110, evaluated the anomaly score and blocked the request:
ModSecurity: Access denied with code 403 (phase 2).
[id "949110"]
[msg "Inbound Anomaly Score Exceeded (Total Score: 5)"]
This confirmed that ModSecurity was responsible for the 403 response.
2. Identify the ModSecurity Rule
The two important rule IDs were:
| Rule ID | Purpose |
|---|---|
| 932239 | Detects potential Unix command injection |
| 949110 | Blocks requests when the anomaly score exceeds the configured threshold |
Rule 932239 generated a false positive because it inspected the Referer header. Rather than disabling either rule globally, we needed to tell ModSecurity to ignore only the Referer header when evaluating rule 932239 for Roundcube requests.
3. Locate the Correct ModSecurity Configuration File
On our Plesk server, the correct location for this exception was:
/etc/apache2/modsecurity.d/rules/owasp_modsecurity_crs_4-plesk/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf
This file is important because it is processed before the OWASP Core Rule Set rules. Adding an exclusion here allows ModSecurity to apply the exception before rule 932239 evaluates the request.
Important: Adding the exception to a configuration file loaded after the CRS rules may not work as intended.
4. Back Up the Configuration
Before making changes, create a backup:
sudo cp -a \ /etc/apache2/modsecurity.d/rules/owasp_modsecurity_crs_4-plesk/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf \ /etc/apache2/modsecurity.d/rules/owasp_modsecurity_crs_4-plesk/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.backup
This lets you restore the original configuration if something goes wrong.
5. Add the Roundcube ModSecurity Exception
Initially, we used individual exceptions for each affected hostname.
For example, the Down Madison Avenue exception was:
SecRule REQUEST_HEADERS:Referer "@rx ^https?://webmail\.downmadisonavenue\.com/" \ "id:1001001,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932239;REQUEST_HEADERS:Referer"
The AGG Town Tech exception was:
SecRule REQUEST_HEADERS:Referer "@rx ^https?://webmail\.agg-town-tech\.com/" \ "id:1001004,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932239;REQUEST_HEADERS:Referer"
Both exceptions worked, but maintaining a separate rule for every domain would become inconvenient as additional websites and email domains were added.
A Better Solution: One Global Roundcube Exception
For a server hosting multiple domains, we can use a single hostname-independent exception:
# Roundcube global false-positive exception. # Exclude Referer from CRS rule 932239 for all Roundcube requests. SecRule REQUEST_URI "@beginsWith /roundcube/" \ "id:1001005,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932239;REQUEST_HEADERS:Referer"
This rule applies to requests whose URI begins with /roundcube/, regardless of the hostname. It eliminates the need to add another exception every time a new domain is configured.
Important: This global rule is the proposed consolidated configuration. Before enabling it, remove the two hostname-specific exceptions to avoid redundant rules. Keep unrelated custom exceptions in the file.
6. Validate the Apache Configuration
After saving the changes, run:
sudo apache2ctl configtest
You should receive:
Syntax OK
If Apache reports an error, correct it before proceeding.
7. Reload Apache
Once the configuration passes validation, reload Apache:
sudo systemctl reload apache2
A reload applies the configuration changes without requiring a full server reboot.
8. Test Roundcube Webmail
Open the webmail address for each affected domain.
Test the following:
-
Log in to Roundcube.
-
Open the Inbox.
-
Open the Sent folder.
-
Open an individual email.
-
Send a test email.
-
Verify that incoming email is received.
Also inspect the Apache error log:
sudo grep -E '932239|949110' /var/log/apache2/error.log | tail -20
Look for new entries associated with your Roundcube requests.
9. Why This Fix Is Better Than Disabling ModSecurity
One possible workaround would be to disable ModSecurity for the entire webmail installation or turn off rule 932239 globally.
Neither is recommended.
Our approach is more targeted:
-
ModSecurity remains enabled.
-
OWASP CRS protections remain active.
-
Rule 932239 continues inspecting other request data.
-
Only the Referer header is excluded from that particular rule.
-
Other security rules continue operating normally.
-
The global exception can cover existing and future Roundcube installations.
This preserves the majority of the server's existing web application firewall protection.
Conclusion
The Roundcube 403 problem was caused by a false positive in OWASP CRS rule 932239. The solution was to create a targeted ModSecurity exclusion in the CRS pre-exclusion configuration file. We first implemented individual exceptions for Down Madison Avenue and AGG Town Tech, verified that users could access Roundcube, and successfully tested sending and receiving email. For a multi-domain Plesk server, consolidating these exceptions into one global Roundcube rule is a cleaner long-term approach.
The key takeaway: When ModSecurity blocks legitimate application traffic, identify the exact rule responsible and create a narrowly scoped exception instead of disabling the firewall.
- Details
- Written by: Brent Bransom
- Category: Tutorials
- Hits: 134
I will be placing all my web development tutorials here. This tutorial section will mainly focus on the software you will need; lamp, wamp, linux setup to host a working website on your own and to create a good test environment. I plan on having a programing section dedicated to web programing ie, php, mysql, python, java, java script and frameworks.