LykanShield protection layer
MimeType Filter
Trust file contents, not the MIME type claimed by the browser.
Overview
Server-side content identification
The filter reads the temporary upload with PHP Fileinfo and compares the detected MIME type with the current LykanShield allowlist. Client-provided MIME metadata is retained only for diagnostics and never drives the security decision.
Request lifecycle
How it works
-
01
Read safely
LykanShield verifies that the temporary upload exists and is readable.
-
02
Detect MIME
finfo with FILEINFO_MIME_TYPE identifies the content on the server.
-
03
Apply allowlist
Unknown or disallowed types are blocked and recorded as MIME_FILE_UPLOAD.
Implementation
Technical details
- Requires the PHP Fileinfo extension.
- Normalizes detected and configured MIME values to lowercase.
- Supports monitor or block behavior when the remote allowlist is unavailable.
- Reports both the detected type and the client claim for investigation.
Relevant configuration
<?php
lykan_config::$config['filter_active']['mime_types'] = true;
lykan_config::$config['rules_unavailable_action'] = 'monitor';
require __DIR__ . '/includes/lykan.class.php';
lykan::run(__DIR__);