| Server IP : 45.130.228.180 / Your IP : 216.73.217.162 Web Server : LiteSpeed System : Linux sg-nme-web1519.main-hosting.eu 5.14.0-611.16.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Dec 22 03:40:39 EST 2025 x86_64 User : u174041621 ( 174041621) PHP Version : 8.2.33 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python35/share/imunify360/scripts/ |
Upload File : |
#!/usr/bin/bash
# FIXME: workaround for bug https://cloudlinux.atlassian.net/browse/DEF-2271
# enable_scan_modsec lives in the (world-readable) nonprivileged config now;
# fall back to the privileged file if the key isn't there yet (upgrade window).
config=/etc/sysconfig/imunify360/imunify360-merged-nonprivileged.config
grep -q 'enable_scan_modsec:' "$config" 2>/dev/null \
|| config=/etc/sysconfig/imunify360/imunify360-merged.config
# Fail closed: skip the scan only when the config is readable AND scanning is
# explicitly off. An unreadable config means scan anyway, never silently pass.
if [ -r "$config" ] && ! grep -q 'enable_scan_modsec:\s*true' "$config"; then
echo "1 OK"
exit 1
fi
out=($(/usr/share/imunify360/scripts/modsec_scan_real.py "$@"))
echo "${out[@]}"
# Script prints one of two possible lines:
# '1 OK' - when malware is not found in the file
# '0 Attempt to upload malware' - when malware has been found in the file
# At the moment, Coraza does not handle script output properly:
# https://github.com/corazawaf/coraza/pull/1311
# Thus we exit with code 1 to make Coraza pass the file and with code 0 to block the file.
# The original modsec 2.x don't care about exit code either, so it should handle it fine.
code=${out[0]}
[[ "$code" =~ ^[0-9]+$ ]] || code=1
exit $code