PolyUtilities For PerfexCRM

10-Layer File Security, Image CDR & Anti-Malware for Perfex CRM

Live chat and omnichannel webhooks accept untrusted files directly from anonymous portal visitors, social channels, and multi-staff browsers. Without deep inspection, a single polyglot JPEG, RTLO-spoofed filename, Zip Bomb, or scripted PDF can compromise storage or execute payloads across support sessions.

PolyUtilities v3.7.0 protects both staff uploads and inbound channel media using Poly_omnichat_file_security: a 10-layer pure-PHP defense pipeline featuring 25MP GD Image CDR, active-content PDF/ZIP scanning, optional ClamAV socket scanning, and strict multi-session governance.

Review module prerequisites and folder permissions in the Guide to Install and Use PolyUtilities for Perfex CRM first.

Security LayerInspection MechanismBlocked Threat Vector
Layers 1 to 3: BinaryBiDi/RTLO strip, magic bytes + finfo, PE/ELF/PHP scanSpoofed shell.php.jpg, U+202E, embedded webshells
Layer 4: GD Image CDRPHP GD pixel re-encoding with 25MP (8192px) capDecompression bombs, EXIF/GPS leaks, polyglots
Layers 5 & 6: PDF & ZIPPDF token scan + ZipArchive ratio/macro checkPDF /JavaScript, Zip Bombs (>50MB / 100:1), Zip Slip, VBA
Layer 7: ClamAV DaemonPure-PHP TCP/Unix socket zINSTREAM (optional)Known malware signatures on VPS hosts
Layers 8 to 10: Storage.htaccess lock, send_message() Firewall, rate limitPHP execution in uploads, LFI paths, disk flood

1. Enforce 10-Layer File Security and GD Image CDR

Every upload from staff or inbound media from Facebook Messenger, Instagram DM, and Telegram Bot API passes all validation layers before writing to uploads/poly_utilities/omnichat/. Because the pipeline uses standard PHP extensions (fileinfo, gd, zip) with zero shell_exec, it works on locked-down shared hosting.

  • Keep Image CDR Re-encoding ON in Settings > File Security to rebuild JPEG, PNG, and WebP pixels, stripping EXIF/GPS and polyglot code.
  • Leave PDF and Archive Scanning ON to block /JavaScript or /Launch PDFs, Zip Bombs (>500 files / 50MB / 100:1), ../ traversal, and vbaProject.bin macros.
  • Set the Upload Rate Limit (20 files/min/staff) and enable ClamAV zINSTREAM via 127.0.0.1:3310 or Unix socket on VPS hosts running clamav-daemon.

2. Harden Multi-Session Governance and Access Boundaries

Storage hardening alone is incomplete if authorization endpoints leak messages or attachment paths across user roles. PolyUtilities pairs .htaccess locks (php_flag engine off, nosniff, CSP sandbox, 128-bit filenames) with strict server-side BOLA/IDOR checks across Admin, Group, and Client Portal sessions.

  • Rely on sanitize_outbound_attachments() inside send_message() to block javascript:, data:, external links, and realpath escapes (max 5 attachments per message).
  • Enforce last_message_id + 1 group join isolation so new members only read messages sent after joining.
  • Maintain atomic LOCK_EX cache version bumps and OWASP API3 non-admin payload minimization on bootstrap().

Common Pitfalls and Quick Fixes

  • Valid Office or PDF files rejected on upload: Documents with embedded VBA macros (vbaProject.bin) or PDF /OpenAction scripts are blocked by design; re-export without macros.
  • ClamAV scan timeouts on shared hosting: Disable the optional ClamAV toggle unless your VPS runs an active clamd listener on port 3310 or Unix socket.
  • High-resolution photos exceed CDR cap: Images over 8192 px or 25MP trigger the decompression-bomb guard; resize camera exports before uploading.

Frequently Asked Questions

Does 10-layer file security require ClamAV or Node.js to work?

No. Layers 1 through 6 and 8 through 10 execute in 100 percent pure PHP using standard fileinfo, gd, and zip extensions with zero Node.js or shell execution. ClamAV zINSTREAM socket scanning is simply an optional extra layer for VPS environments.

How does GD Image CDR sanitize uploaded customer screenshots?

Content Disarm and Reconstruction verifies image dimensions against the 25-megapixel decompression-bomb cap, decodes raw pixels into memory via PHP GD, and writes a fresh JPEG, PNG, or WebP file. This removes EXIF/GPS tags and destroys appended PHP or script polyglots.

What prevents attackers from forging attachment URLs in send_message()?

The server-side Attachment Firewall strips client-supplied absolute paths, rejects javascript:, data:, or unverified external links, validates every path via realpath() inside uploads/poly_utilities/omnichat/, re-verifies MIME types through finfo, and reconstructs canonical local URLs safely on the server.

How is chat history isolated when staff join or leave mixed groups?

Multi-session governance tracks membership state with last_message_id + 1 join boundaries and strict owner or admin checks on manage_group_members(). Newly added members cannot query pre-join chat messages, and non-participants receive HTTP 403 immediately on unauthorized cross-session BOLA or IDOR API requests.


Comments

Leave a Reply

Your email address will not be published.Required fields are marked *