Hallo
Ich habe auf meinem Debian System den apache2 mit mod_security installiert. Es wird geladen. Soweit keine Probleme.
Folgendes Ruleset nutze ich:
Die Filterdatei wird eingeladen:
Eigentlich sollte der Apache ja nun Eingaben wie http://tld.de/index.php?cmd=wget selber abfangen und blocken.
Nur leider passiert gar nichts.
Muss ich da vieleicht noch was in der vhost - Datei vov Confixx (Premium Ed. von S4Y) einstellen, damit die Rules auf die einzelnen Kunden angewendet werden?
Bin für jeden Tipp dankbar.
Ich habe auf meinem Debian System den apache2 mit mod_security installiert. Es wird geladen. Soweit keine Probleme.
Folgendes Ruleset nutze ich:
# Only inspect dynamic requests
# (YOU MUST TEST TO MAKE SURE IT WORKS AS EXPECTED)
# SecFilterEngine DynamicOnly
# Turn the filtering engine On or Off
SecFilterEngine On
# Reject requests with status 404
SecFilterDefaultAction "deny,log,status:403"
# Some sane defaults
SecServerResponseToken Off
SecFilterScanPOST Off
SecFilterCheckURLEncoding On
SecFilterCheckCookieFormat On
SecFilterCheckUnicodeEncoding Off
# If you want to scan the output, uncomment these
# SecFilterScanOutput On
# SecFilterOutputMimeTypes "(null) text/html text/plain"
# Accept almost all byte values
SecFilterForceByteRange 1 255
# Only record the interesting stuff
SecAuditEngine RelevantOnly
SecAuditLog /etc/apache2/logs/audit_log
# You normally won't need debug logging
SecFilterDebugLevel 0
SecFilterDebugLog /etc/apache2/logs/modsec_debug_log
# Include rules
Include /etc/apache2/modsecurity/filter.conf
</IfModule>
Die Filterdatei wird eingeladen:
# Start Rules (Gerneric)
# -----------------------------------------------------------------------------
# Enforce proper HTTP requests
SecFilterSelective THE_REQUEST "!HTTP\/(0\.9|1\.0|1\.1)$"
# check for bad meta characters in User-Agent field
SecFilterSelective HTTP_USER_AGENT ".*\'"
# Require Content-Length to be provided with every POST request
SecFilterSelective REQUEST_METHOD "^POST$" chain
SecFilterSelective HTTP_Content-Length "^$"
# Don't accept transfer encodings we know we don't handle (and you don't need it anyway)
SecFilterSelective HTTP_Transfer-Encoding "!^$"
# Don't accept chunked encodings
SecFilterSelective HTTP_Transfer-Encoding "chunked"
# must have a useragent string
SecFilterSelective "HTTP_USER_AGENT|HTTP_HOST" "^$"
# Again, this is better protected by removing these functions in php.ini
SecFilterSelective ARGS "(system|exec|passthru|popen|shell_exec|proc_open|fopen|fwrite)\s*\("
# Prevent path traversal (..) attacks
SecFilter "\.\./"
# generic recursion signature
SecFilterSelective THE_REQUEST "\.\./\.\./"
# generic attack sig
SecFilterSelective THE_REQUEST "cd\x20*\;(cd|\;|echo|perl|python|rpm|yum|apt-get|emerge|lynx|links|mkdir|elinks|cmd|pwd|wget|id|uname|
# generic recursion signature
SecFilterSelective THE_REQUEST "\.\./\.\./"
# generic attack sig
SecFilterSelective THE_REQUEST "cd\x20*\;(cd|\;|echo|perl|python|rpm|yum|apt-get|emerge|lynx|links|mkdir|elinks|cmd|pwd|wget|id|uname|
# generic filter to prevent SQL injection attacks
SecFilter "[[:space:]]+(select|grant|delete|insert|drop|alter|replace|truncate|update|create|rename|describe)[[:space:]]+[A-Z|a-z|0-9|
# generic PHP remote file inclusion attack
SecFilter "\.php\?" chain
SecFilter "(http|https|ftp)\:/" chain
SecFilter "cmd=(cd|\;|perl|python|rpm|yum|apt-get|emerge|lynx|links|mkdir|elinks|cmd|pwd|wget|id|uname|cvs|svn|(s|r)(cp|sh)|rexec|smbc
# generic sig for more bad PHP functions
SecFilterSelective THE_REQUEST "chr\(([0-9]{1,3})\)"
SecFilterSelective THE_REQUEST "chr\([0-9a-fA-Fx]+\)"
# SQL injection attacks
SecFilter "delete[[:space:]]+from"
SecFilter "insert[[:space:]]+into"
#SecFilter "select.+from"
# SQL injection in cookies
SecFilterSelective COOKIE_sessionid ".*(select|grant|delete|insert|drop|do|alter|replace|truncate|update|create|rename|describe)[[:spa
Eigentlich sollte der Apache ja nun Eingaben wie http://tld.de/index.php?cmd=wget selber abfangen und blocken.
Nur leider passiert gar nichts.
Muss ich da vieleicht noch was in der vhost - Datei vov Confixx (Premium Ed. von S4Y) einstellen, damit die Rules auf die einzelnen Kunden angewendet werden?
Bin für jeden Tipp dankbar.