Skip to content

pmFromFile and matching problems #1167

Closed
@quenenni

Description

@quenenni

Server: Debian Wheezy
libapache2-mod-security2: v2.8.0-2~bpo70+1
modsec rules: last from git


A simple test.php file including this code:

test
<img src="wp-content/themes/expound/screenshot.png">

I have a rule to catch all static files and for them skip my next custom rules.
This one works:

SecRule REQUEST_FILENAME "\.(ico|png|jpg|jpeg|gif|tiff|ods|fods|odt|fodt|odp|fodp|odg|doc|docx|xls|xlsx|rtf|csv|ppt|pptx|pps|ppsx|pdf|txt|css|js|ogg|ogm|mp4|flac|ape|wav|mkv|mpg|mpeg|swf|flv|mov|avi|wma)$"  "phase:1,id:2100,log,pass,skipAfter:END_CUSTOM_MARKER"

This one doesn't:

SecRule REQUEST_FILENAME "@pmFromFile /etc/modsecurity/liste_extensions.txt"    "phase:1,id:2100,nolog,pass,skipAfter:END_CUSTOM_MARKER"

Well, it works only when I put the complete filename in it (screenshot.png), but doesn't work when I try to put only file extensions:

png
or
.png
or
.*.png
or
png/
or
.png/

From what I read in the reference manual (https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#pmFromFile -> point 4), it should be able to match all files finishing by png.. or am I mistaken.

Thanks

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions