Changeset 3832856
- Timestamp:
- 11/29/2026 11:10:57 AM (9 hours ago)
- Location:
- hard-guard-security/trunk
- Files:
-
- 6 edited
-
changelog.txt (modified) (1 diff)
-
hard-guard-security.php (modified) (2 diffs)
-
includes/class-wpguard-behavioural-heuristics.php (modified) (1 diff)
-
includes/class-wpguard-scanner-admin.php (modified) (2 diffs)
-
includes/class-wpguard-scanner.php (modified) (30 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hard-guard-security/trunk/changelog.txt
r3832607 r3832856 1 = 1.18.14.38 = 2 * Malware Scanner: Large File Message Clarity Update. Clarify successful memory-efficient windowed analysis of all bytes and verified integrity while retaining the note that some whole-file context checks may be limited. No changes to detection rules, scan status logic or Behavioural Heuristics Engine 3.3.4. 3 4 = 1.18.14.37 = 5 * Malware Scanner: Scan Status & Reporting Clarity Update. Completed with large files identifies successful verified all-byte windowed analysis without other coverage failures. Actual missing, partial or unverified content still reports Completed with limitations; unfinished stages remain Incomplete. Windowed analysis does not guarantee whole-file context. 6 * Separate large-file and actual-limitation details and paginated paths. Preserve metadata-only and legacy history reporting. Behavioural Heuristics Engine 3.3.4 unchanged; no additional file reads, new tables or external dependencies. 7 8 = 1.18.14.36 = 9 * Malware Scanner: Coverage Reporting Precision Update (Behavioural Heuristics Engine 3.3.4 unchanged). Distinguish all-byte windowed analysis, partial/skipped/unverified content, metadata-only, missing and unreadable files. Retain conservative completion status and all existing detection rules. 10 * Show paginated metadata-only file paths from saved scan queues. Exclusions are reported separately from queue totals. Older history is not rewritten; legacy limited entries remain explicitly labelled if evidence is insufficient. No new database tables or schema changes. 11 12 = 1.18.14.35 = 13 * Malware Scanner: Behavioural Heuristics Engine 3.3.4 – Anti-Evasion & Large File Protection. Resume eligible large text files across scan steps using bounded overlapping windows. Preserve limited coverage status even when all bytes were examined; PHP lexical and whole-file context remain approximate. No raw source is retained in checkpoints. 14 * Verify analysed segments and calculate SHA-256 in a separate bounded streaming pass; changed files, memory exhaustion and safety budgets remain visible. Unexamined executable content requires manual review. Binary containers still require whole-file analysis. 15 * Show paginated paths of all limited file queue entries, in addition to bounded size and byte details. No new tables, external APIs or dependencies. Stop any running scan before updating; run a fresh scan on staging. 16 17 = 1.18.14.34 = 18 * Malware Scanner: Behavioural Heuristics Engine 3.3.3 – Scan Coverage Update. Distinguish Completed with limitations (file coverage) from Incomplete (unfinished or failed coverage stages). New scans record root-relative limitation examples, sizes, bytes examined, status totals and database coverage. Older history is retained. 19 * Eligible large text files receive bounded overlapping static-analysis windows (up to 16 MiB per file, subject to memory and time limits). Partial analysis does not replace whole-file context; binary containers still require whole-file analysis. The full-file size setting remains unchanged. No new database tables or remote services. 20 * Apply the existing file exclusion policy before counting size limitations; retain safety checks for media that cannot be verified for exclusion. Report failed file reads and queue accounting. 21 22 = 1.18.14.33 = 23 * Malware Scanner: Behavioural Heuristics Engine 3.3.2. Ambiguous short PHP markers in structurally verified PNG, GIF, JPEG and static WebP raster payload are no longer reported on their own. PNG chunk CRC and container boundaries are checked; metadata, trailing data, malformed/unsupported containers and executable-looking PHP markers retain review. 24 * Bounded static analysis only; no image decoding, external API or new dependencies. Existing scan results are not rewritten. Test on staging before release. 25 1 26 = 1.18.14.32 = 2 27 * Malware Scanner: Behavioural Heuristics Engine 3.3.1 stability update. Database progress now advances past intentionally excluded rows; failed content reads retry twice before marking the affected area incomplete. -
hard-guard-security/trunk/hard-guard-security.php
r3832607 r3832856 4 4 * Plugin URI: https://github.com/endriu7777/WP-Hard-Guard 5 5 * Description: Login protection, 2FA, audit logs, local malware scanning, vulnerability monitoring, antispam, SSL diagnostics, and WordPress hardening. 6 * Version: 1.18.14.3 26 * Version: 1.18.14.38 7 7 * Requires at least: 7.0 8 8 * Requires PHP: 7.4 … … 98 98 } 99 99 100 define( 'WPGUARD_VERSION', '1.18.14.3 2' );100 define( 'WPGUARD_VERSION', '1.18.14.38' ); 101 101 define( 'WPGUARD_FILE', __FILE__ ); 102 102 define( 'WPGUARD_DIR', plugin_dir_path( __FILE__ ) ); -
hard-guard-security/trunk/includes/class-wpguard-behavioural-heuristics.php
r3832607 r3832856 13 13 14 14 final class WPGUARD_Behavioural_Heuristics { 15 public const ENGINE_VERSION = '3.3. 1';15 public const ENGINE_VERSION = '3.3.4'; 16 16 17 17 /** Hide credential-like excerpts before truncation; no raw secret in a clipped window. */ -
hard-guard-security/trunk/includes/class-wpguard-scanner-admin.php
r3832607 r3832856 188 188 </div> 189 189 <label><?php esc_html_e( 'Automatic scan interval (days)', 'hard-guard-security' ); ?><input type="number" min="1" max="365" name="scanner_schedule_days" value="<?php echo esc_attr( (string) ( $settings['scanner_schedule_days'] ?? 7 ) ); ?>"><span class="description"><?php esc_html_e( 'When Automatic mode is enabled, the next Full Scan is scheduled this many days after saving these settings or after the previous automatic scan finishes.', 'hard-guard-security' ); ?></span></label> 190 <label><?php esc_html_e( 'Maximum file size for content analysis (MB)', 'hard-guard-security' ); ?><input type="number" min="1" max="50" name="scanner_max_file_mb" value="<?php echo esc_attr( (string) ( $settings['scanner_max_file_mb'] ?? 5 ) ); ?>"><span class="description"><?php esc_html_e( 'Content signatures are skipped for files above this limit. Strong path-based indicators such as PHP in uploads and double extensions are still checked.', 'hard-guard-security' ); ?></span></label>190 <label><?php esc_html_e( 'Maximum file size for whole-file analysis (MB)', 'hard-guard-security' ); ?><input type="number" min="1" max="50" name="scanner_max_file_mb" value="<?php echo esc_attr( (string) ( $settings['scanner_max_file_mb'] ?? 5 ) ); ?>"><span class="description"><?php esc_html_e( 'Larger eligible text files receive bounded partial analysis when memory permits. Images and other containers require whole-file analysis. Limits are reported separately; path-based checks remain enabled.', 'hard-guard-security' ); ?></span></label> 191 191 <label><?php esc_html_e( 'Quick Scan recent-file period (days)', 'hard-guard-security' ); ?><input type="number" min="1" max="365" name="scanner_quick_recent_days" value="<?php echo esc_attr( (string) ( $settings['scanner_quick_recent_days'] ?? 30 ) ); ?>"></label> 192 192 </div> … … 246 246 <p class="description"><?php esc_html_e( 'File counts cover eligible files skipped by extension outside excluded directories. Descendants of skipped directories are not counted individually.', 'hard-guard-security' ); ?></p></div> 247 247 <?php endif; ?> 248 <?php if ( 'incomplete' === (string) $scan->status ) : ?> 249 <div class="notice notice-warning inline"><p><?php esc_html_e( 'Incomplete scan: some content could not be fully analysed. Results are not a clean bill of health.', 'hard-guard-security' ); ?></p><p><?php echo esc_html( sprintf( __( 'Files above content size limit: %d.', 'hard-guard-security' ), (int) ( $scan_context['oversize_files'] ?? 0 ) ) ); ?></p></div> 248 <?php if ( in_array( (string) $scan->status, array( 'incomplete', 'completed_limited' ), true ) ) : ?> 249 <div class="notice notice-warning inline"><p><strong><?php echo esc_html( WPGUARD_Scanner::scan_status_label( (string) $scan->status ) ); ?>:</strong> <?php esc_html_e( 'Some content could not be fully analysed. Results are not a clean bill of health.', 'hard-guard-security' ); ?></p></div> 250 <?php endif; ?> 251 <?php if ( isset( $scan_context['coverage_file_statuses'] ) || in_array( (string) $scan->status, array( 'incomplete', 'completed_limited', 'completed_large' ), true ) ) : ?> 252 <?php 253 $coverage_counts = (array) ( $scan_context['coverage_counts'] ?? array() ); 254 $coverage_statuses = (array) ( $scan_context['coverage_file_statuses'] ?? array() ); 255 $coverage_details = (array) ( $scan_context['coverage_details'] ?? array() ); 256 $coverage_display = WPGUARD_Scanner::coverage_display_counts( $scan_context ); 257 $coverage_by_path = array_column( $coverage_details, null, 'path' ); 258 $large_details = array(); 259 $limited_details = array(); 260 foreach ( $coverage_details as $detail ) { 261 if ( 'windowed_complete' === ( $detail['reason'] ?? '' ) && isset( $detail['size'], $detail['bytes'] ) && (int) $detail['size'] === (int) $detail['bytes'] ) { $large_details[] = $detail; } 262 else { $limited_details[] = $detail; } 263 } 264 $large_count = (int) ( $coverage_counts['windowed_complete'] ?? 0 ); 265 $limitation_counts = $coverage_counts; 266 unset( $limitation_counts['windowed_complete'] ); 267 $coverage_labels = array( 268 'size_limit' => __( 'Above whole-file size limit (partial or skipped content)', 'hard-guard-security' ), 269 'windowed_complete' => __( 'All bytes successfully analysed using memory-efficient windowed scanning. Some whole-file context checks may be limited.', 'hard-guard-security' ), 270 'stream_budget' => __( 'Resumable analysis safety budget reached; review unexamined content', 'hard-guard-security' ), 271 'memory_limit' => __( 'Limited by available PHP memory', 'hard-guard-security' ), 272 'missing' => __( 'File missing or no longer accessible within the scan scope', 'hard-guard-security' ), 273 'unreadable' => __( 'File unreadable', 'hard-guard-security' ), 274 'read_failed' => __( 'File read or hash failed', 'hard-guard-security' ), 275 'file_changed' => __( 'File changed during analysis', 'hard-guard-security' ), 276 'hash_limit' => __( 'File exceeds bounded hash read limit', 'hard-guard-security' ), 277 'directory_unreadable' => __( 'Directory could not be indexed', 'hard-guard-security' ), 278 ); 279 ?> 280 <details class="wpguard-panel" <?php echo 'completed' === (string) $scan->status ? '' : 'open'; ?>><summary><strong><?php esc_html_e( 'Scan coverage report', 'hard-guard-security' ); ?></strong></summary> 281 <p><?php echo esc_html( sprintf( __( 'Files processed: %1$d / %2$d. Whole-file analysis threshold: %3$s.', 'hard-guard-security' ), (int) $scan->processed_files, (int) $scan->total_files, size_format( (int) ( $scan_context['max_bytes'] ?? 5 * MB_IN_BYTES ) ) ) ); ?></p> 282 <?php if ( ! empty( $scan_context['coverage_version'] ) && isset( $scan_context['coverage_file_statuses'] ) && empty( $scan_context['coverage_count_error'] ) ) : ?> 283 <ul> 284 <?php foreach ( array( 'scanned', 'windowed_complete', 'content_partial', 'content_skipped', 'content_unverified', 'metadata_only', 'missing', 'unreadable', 'pending', 'content_limited' ) as $coverage_key ) : ?> 285 <?php if ( 'content_limited' === $coverage_key && empty( $coverage_display[ $coverage_key ] ) ) { continue; } ?> 286 <li><?php echo esc_html( WPGUARD_Scanner::coverage_file_status_label( $coverage_key ) . ': ' . (int) ( $coverage_display[ $coverage_key ] ?? 0 ) ); ?></li> 287 <?php endforeach; ?> 288 </ul> 289 <?php if ( ! empty( $scan_context['scan_exclusions']['enabled'] ) ) : ?> 290 <p><?php echo esc_html( WPGUARD_Scanner::coverage_file_status_label( 'excluded' ) . ': ' . sprintf( __( '%1$d files skipped; %2$d directories skipped.', 'hard-guard-security' ), (int) ( $scan_context['files_skipped'] ?? 0 ), (int) ( $scan_context['directories_skipped'] ?? 0 ) ) ); ?> <?php esc_html_e( 'Excluded entries are outside the file queue totals; descendants of excluded directories are not counted individually.', 'hard-guard-security' ); ?></p> 291 <?php endif; ?> 292 <?php else : ?><p><?php esc_html_e( 'Detailed whole-file coverage totals are unavailable for this scan. Run a new scan with the updated scanner.', 'hard-guard-security' ); ?></p><?php endif; ?> 293 <p><?php echo esc_html( sprintf( __( 'Large files detected: %d.', 'hard-guard-security' ), (int) ( $scan_context['oversize_files'] ?? 0 ) ) ); ?></p> 294 <?php if ( ! empty( $scan_context['truncated'] ) ) : ?><p><?php esc_html_e( 'The file indexing safety limit was reached.', 'hard-guard-security' ); ?></p><?php endif; ?> 295 <?php if ( ! empty( $scan_context['coverage_count_error'] ) ) : ?><p><?php esc_html_e( 'The final file queue counts could not be verified.', 'hard-guard-security' ); ?></p><?php endif; ?> 296 <p><?php esc_html_e( 'Database content scan:', 'hard-guard-security' ); ?> <?php echo esc_html( empty( $database_scan_state['enabled'] ) ? __( 'Not requested', 'hard-guard-security' ) : ( ! empty( $database_scan_state['completed'] ) && empty( $database_scan_state['incomplete'] ) ? __( 'Completed', 'hard-guard-security' ) : __( 'Incomplete', 'hard-guard-security' ) ) ); ?></p> 297 <?php if ( $limitation_counts ) : ?><ul><?php foreach ( $limitation_counts as $reason => $amount ) : ?><li><?php echo esc_html( ( $coverage_labels[ $reason ] ?? (string) $reason ) . ': ' . (int) $amount ); ?></li><?php endforeach; ?></ul><?php endif; ?> 298 <?php if ( $large_count > 0 ) : ?> 299 <p class="description"><?php esc_html_e( 'Large files were successfully analysed using memory-efficient windowed scanning. All bytes were examined and integrity was verified. Some whole-file context checks may be limited.', 'hard-guard-security' ); ?></p> 300 <?php endif; ?> 301 <?php foreach ( array( 'large' => $large_details, 'limited' => $limited_details ) as $detail_group => $detail_rows ) : if ( ! $detail_rows ) { continue; } ?> 302 <h4><?php echo esc_html( 'large' === $detail_group ? __( 'Large file analysis details', 'hard-guard-security' ) : __( 'Scan limitation details', 'hard-guard-security' ) ); ?></h4> 303 <div class="wpguard-table-wrap"><table class="widefat striped"><thead><tr><th><?php esc_html_e( 'File / directory', 'hard-guard-security' ); ?></th><th><?php esc_html_e( 'Size', 'hard-guard-security' ); ?></th><th><?php esc_html_e( 'Content bytes examined', 'hard-guard-security' ); ?></th><th><?php echo esc_html( 'large' === $detail_group ? __( 'Analysis method', 'hard-guard-security' ) : __( 'Coverage limitation', 'hard-guard-security' ) ); ?></th></tr></thead><tbody> 304 <?php foreach ( $detail_rows as $detail ) : ?><tr><td><code><?php echo esc_html( (string) ( $detail['path'] ?? '' ) ); ?></code></td><td><?php echo esc_html( isset( $detail['size'] ) ? size_format( (int) $detail['size'], 2 ) : '—' ); ?></td><td><?php echo esc_html( size_format( (int) ( $detail['bytes'] ?? 0 ), 2 ) ); ?></td><td><?php echo esc_html( $coverage_labels[ $detail['reason'] ?? '' ] ?? (string) ( $detail['reason'] ?? '' ) ); ?></td></tr><?php endforeach; ?> 305 </tbody></table></div> 306 <p class="description"><?php echo esc_html( sprintf( __( 'Showing %1$d of %2$d recorded entries (up to 100 examples shared across coverage groups). These are coverage notices, not malware findings.', 'hard-guard-security' ), count( $detail_rows ), 'large' === $detail_group ? $large_count : array_sum( $limitation_counts ) ) ); ?></p> 307 <?php endforeach; ?> 308 <?php 309 $coverage_groups = array( 310 'large' => array( 'count' => (int) ( $coverage_statuses['windowed_complete'] ?? 0 ), 'title' => __( 'Large files analysed', 'hard-guard-security' ), 'param' => 'large_page', 'anchor' => 'wpguard-coverage-large' ), 311 'limited' => array( 'count' => array_sum( array_intersect_key( $coverage_statuses, array_flip( array( 'content_limited', 'content_partial', 'content_skipped', 'content_unverified', 'missing', 'unreadable', 'pending' ) ) ) ), 'title' => __( 'Files with actual scan limitations (paginated)', 'hard-guard-security' ), 'param' => 'coverage_page', 'anchor' => 'wpguard-coverage-paths' ), 312 'metadata' => array( 'count' => (int) ( $coverage_statuses['metadata_only'] ?? 0 ), 'title' => __( 'Files checked by metadata and path only', 'hard-guard-security' ), 'param' => 'metadata_page', 'anchor' => 'wpguard-coverage-metadata' ), 313 ); 314 foreach ( $coverage_groups as $coverage_group => $coverage_group_info ) : 315 if ( $coverage_group_info['count'] < 1 ) { continue; } 316 $coverage_page = max( 1, min( 1001, (int) ceil( $coverage_group_info['count'] / 100 ), absint( $_GET[ $coverage_group_info['param'] ] ?? 1 ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended 317 $coverage_paths = WPGUARD_Scanner::coverage_paths( (int) $scan->id, ( $coverage_page - 1 ) * 100, $coverage_group ); 318 ?> 319 <h4 id="<?php echo esc_attr( $coverage_group_info['anchor'] ); ?>"><?php echo esc_html( $coverage_group_info['title'] ); ?></h4> 320 <?php if ( 'limited' === $coverage_group && ! empty( $coverage_statuses['content_limited'] ) ) : ?><p class="description"><?php esc_html_e( 'Legacy records may include fully examined windowed files; their original status is retained.', 'hard-guard-security' ); ?></p><?php endif; ?> 321 <?php if ( 'metadata' === $coverage_group ) : ?><p class="description"><?php esc_html_e( 'These file types were checked by path and metadata, not by content heuristics. This is not a malware finding.', 'hard-guard-security' ); ?></p><?php endif; ?> 322 <?php if ( null === $coverage_paths || empty( $coverage_paths ) ) : ?><p><?php esc_html_e( 'Coverage paths could not be loaded.', 'hard-guard-security' ); ?></p><?php else : ?> 323 <ul><?php foreach ( array_slice( $coverage_paths, 0, 100 ) as $coverage_path ) : ?><li><code><?php echo esc_html( (string) $coverage_path->relative_path ); ?></code> — <?php echo esc_html( WPGUARD_Scanner::coverage_file_status_label( (string) $coverage_path->status, $coverage_by_path[ (string) $coverage_path->relative_path ] ?? array() ) ); ?></li><?php endforeach; ?></ul> 324 <?php foreach ( array( -1, 1 ) as $direction ) : if ( ( $direction < 0 && $coverage_page > 1 ) || ( $direction > 0 && count( $coverage_paths ) > 100 ) ) : ?><a class="button" href="<?php echo esc_url( add_query_arg( array( 'page' => 'wpguard-scanner', 'scan_id' => (int) $scan->id, $coverage_group_info['param'] => $coverage_page + $direction ), admin_url( 'admin.php' ) ) . '#' . $coverage_group_info['anchor'] ); ?>"><?php echo esc_html( $direction < 0 ? __( 'Previous', 'hard-guard-security' ) : __( 'Next', 'hard-guard-security' ) ); ?></a> <?php endif; endforeach; ?> 325 <?php endif; endforeach; ?> 326 </details> 250 327 <?php endif; ?> 251 328 <?php if ( 'failed' === (string) $scan->status && '' !== trim( (string) $scan->error_message ) ) : ?> -
hard-guard-security/trunk/includes/class-wpguard-scanner.php
r3832607 r3832856 15 15 private const DISCOVERY_ENTRIES_BATCH = 350; 16 16 private const SCAN_FILES_BATCH = 10; 17 private const COVERAGE_DETAIL_LIMIT = 100; 18 private const PARTIAL_READ_LIMIT = 16777216; // Existing hash bound for ordinary files. 19 private const RESUMABLE_FILE_LIMIT = 134217728; 20 private const RESUMABLE_STEP_BYTES = 4194304; 21 private const RESUMABLE_MAX_SEGMENTS = 1024; 22 private const PARTIAL_WINDOW_MAX = 1048576; 23 private const PARTIAL_OVERLAP = 65536; 17 24 private const MAX_FINDINGS_PER_SCAN = 2000; 18 25 private const OPTION_IGNORED_HASHES = 'wpguard_scanner_ignored_hashes'; … … 85 92 // and a matching file header. Uncertain files retain the normal scan path. 86 93 $limit = max( MB_IN_BYTES, (int) ( $context['max_bytes'] ?? 5 * MB_IN_BYTES ) ); 87 if ( $size <= 0 || $size > $limit ) { return false; }94 if ( $size <= 0 || $size > $limit || $size > self::content_memory_budget() ) { return false; } 88 95 $content = @file_get_contents( $absolute, false, null, 0, $size + 1 ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 89 96 if ( ! is_string( $content ) || strlen( $content ) !== $size || false !== strpos( $content, '<?' ) ) { return false; } … … 133 140 $context = array( 134 141 'scan_exclusions' => $exclusions, 142 'coverage_version' => 2, 143 'coverage_details' => array(), 144 'coverage_counts' => array(), 135 145 'files_skipped' => 0, 136 146 'directories_skipped' => 0, … … 304 314 } elseif ( 'vulnerabilities' === $stage ) { 305 315 $progress = 96; 306 } elseif ( 'completed' === $stage) {316 } elseif ( in_array( $stage, array( 'completed', 'completed_large', 'completed_limited' ), true ) ) { 307 317 $progress = 100; 308 318 } elseif ( in_array( (string) $scan->status, array( 'stopped', 'failed', 'incomplete' ), true ) ) { … … 347 357 'database_scan_enabled' => ! empty( $database_state['enabled'] ), 348 358 'oversize_files' => (int) ( $context['oversize_files'] ?? 0 ), 359 'coverage_counts' => (array) ( $context['coverage_counts'] ?? array() ), 360 'coverage_details' => (array) ( $context['coverage_details'] ?? array() ), 349 361 'database_incomplete' => ! empty( $database_state['incomplete'] ), 350 362 'database_failed_targets' => array_keys( (array) ( $database_state['failed_targets'] ?? array() ) ), … … 398 410 $limit = max( 1, min( 100, $limit ) ); 399 411 return $wpdb->get_results( $wpdb->prepare( 'SELECT id, scan_type, status, stage, total_files, processed_files, findings_count, critical_count, high_count, suspicious_count, low_count, vulnerability_count, vuln_critical_count, vuln_high_count, vuln_medium_count, vuln_low_count, outdated_count, vulnerability_db_advisories, vulnerability_db_generated, current_file, context, error_message, started_by, started_at, finished_at FROM %i ORDER BY id DESC LIMIT %d', self::scans_table(), $limit ) ); 412 } 413 414 /** Paginated coverage paths from the stored scan queue; never re-read live files. */ 415 public static function coverage_paths( int $scan_id, int $offset = 0, string $group = 'limited' ): ?array { 416 global $wpdb; 417 $filters = array( 418 'metadata' => "status = 'metadata_only'", 419 'large' => "status = 'windowed_complete'", 420 'limited' => "status IN ('content_partial','content_skipped','content_unverified','content_limited','missing','unreadable','pending')", 421 ); 422 if ( ! isset( $filters[ $group ] ) ) { return null; } 423 $filter = $filters[ $group ]; 424 $rows = $wpdb->get_results( $wpdb->prepare( "SELECT relative_path, status FROM %i WHERE scan_id = %d AND {$filter} ORDER BY id ASC LIMIT 101 OFFSET %d", self::scan_files_table(), $scan_id, max( 0, min( self::MAX_FILES, $offset ) ) ) ); 425 return is_array( $rows ) && empty( $wpdb->last_error ) ? $rows : null; 426 } 427 428 /** Classify the recorded evidence, without altering detection or final scan policy. */ 429 private static function limited_file_status( string $reason, int $bytes, int $size, string $hash ): string { 430 if ( 'windowed_complete' === $reason && $bytes === $size && '' !== $hash ) { return 'windowed_complete'; } 431 if ( in_array( $reason, array( 'file_changed', 'hash_limit' ), true ) || ( $size > 0 && $bytes >= $size ) ) { return 'content_unverified'; } 432 return $bytes > 0 ? 'content_partial' : 'content_skipped'; 433 } 434 435 /** Older queue entries lack individual coverage categories. Only use stored evidence. */ 436 public static function coverage_display_counts( array $context ): array { 437 $counts = (array) ( $context['coverage_file_statuses'] ?? array() ); 438 $legacy = max( 0, (int) ( $counts['content_limited'] ?? 0 ) ); 439 if ( (int) ( $context['coverage_version'] ?? 0 ) === 1 && ! isset( $counts['windowed_complete'] ) ) { 440 $windowed = max( 0, (int) ( $context['coverage_counts']['windowed_complete'] ?? 0 ) ); 441 if ( $windowed <= $legacy ) { $counts['windowed_complete'] = $windowed; $legacy -= $windowed; } 442 } 443 $counts['content_limited'] = $legacy; 444 return $counts; 445 } 446 447 public static function coverage_file_status_label( string $status, array $detail = array() ): string { 448 if ( 'content_limited' === $status && 'windowed_complete' === ( $detail['reason'] ?? '' ) && isset( $detail['bytes'], $detail['size'] ) && (int) $detail['bytes'] === (int) $detail['size'] ) { $status = 'windowed_complete'; } 449 $labels = array( 450 'scanned' => __( 'Whole-file analysed', 'hard-guard-security' ), 451 'windowed_complete' => __( 'Windowed analysis – all bytes examined', 'hard-guard-security' ), 452 'content_partial' => __( 'Partial content analysis', 'hard-guard-security' ), 453 'content_skipped' => __( 'Content not analysed', 'hard-guard-security' ), 454 'content_unverified' => __( 'Content not verified', 'hard-guard-security' ), 455 'content_limited' => __( 'Limited content (legacy record)', 'hard-guard-security' ), 456 'metadata_only' => __( 'Metadata only', 'hard-guard-security' ), 457 'missing' => __( 'Missing', 'hard-guard-security' ), 458 'unreadable' => __( 'Unreadable', 'hard-guard-security' ), 459 'pending' => __( 'Pending', 'hard-guard-security' ), 460 'excluded' => __( 'Excluded', 'hard-guard-security' ), 461 ); 462 return $labels[ $status ] ?? __( 'Unknown coverage status', 'hard-guard-security' ); 400 463 } 401 464 … … 873 936 874 937 $current = self::relative_path( $directory ); 875 if ( ( 'custom' === (string) $scan->scan_type && ! self::custom_path_allowed( $directory, $context ) ) || ! self::path_inside_root( $directory ) || ! is_dir( $directory ) ||is_link( $directory ) || self::skip_directory( $directory, (string) $scan->scan_type ) ) {938 if ( ( 'custom' === (string) $scan->scan_type && ! self::custom_path_allowed( $directory, $context ) ) || ! self::path_inside_root( $directory ) || is_link( $directory ) || self::skip_directory( $directory, (string) $scan->scan_type ) ) { 876 939 ++$context['directories_processed']; 877 940 continue; … … 883 946 continue; 884 947 } 885 $items = @scandir( $directory ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged948 $items = is_dir( $directory ) ? @scandir( $directory ) : false; // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 886 949 if ( ! is_array( $items ) ) { 950 self::record_coverage( $context, '' === $current ? '.' : $current, 'directory_unreadable', null, 0 ); 887 951 ++$context['directories_processed']; 888 952 continue; … … 935 999 $size = @filesize( $absolute ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 936 1000 $mtime = @filemtime( $absolute ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 937 if ( false !== $size && (int) $size > max( MB_IN_BYTES, (int) ( $context['max_bytes'] ?? 5 * MB_IN_BYTES ) ) && self::content_scannable( strtolower( $relative ), (int) $size ) ) {938 $context['oversize_files'] = (int) ( $context['oversize_files'] ?? 0 ) + 1;939 }940 1001 if ( ! self::should_queue_actual( $relative, (string) $scan->scan_type, false === $size ? 0 : (int) $size, false === $mtime ? 0 : (int) $mtime, $context ) ) { 941 1002 continue; … … 952 1013 } 953 1014 954 self::enqueue_actual_files_batch( (int) $scan->id, $file_rows );1015 if ( ! self::enqueue_actual_files_batch( (int) $scan->id, $file_rows ) ) { self::fail( (int) $scan->id, __( 'File index could not be saved.', 'hard-guard-security' ) ); return; } 955 1016 956 1017 if ( $end < $total_items ) { … … 965 1026 966 1027 $context['dir_queue'] = array_values( $queue ); 967 $count = (int) $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM %i WHERE scan_id = %d', self::scan_files_table(), (int) $scan->id ) ); 1028 $count_raw = $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM %i WHERE scan_id = %d', self::scan_files_table(), (int) $scan->id ) ); 1029 if ( null === $count_raw || ! empty( $wpdb->last_error ) ) { self::fail( (int) $scan->id, __( 'File index could not be counted.', 'hard-guard-security' ) ); return; } 1030 $count = (int) $count_raw; 968 1031 if ( $count >= self::MAX_FILES ) { 969 1032 $context['truncated'] = true; … … 973 1036 974 1037 if ( empty( $queue ) ) { 975 $total = (int) $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM %i WHERE scan_id = %d', self::scan_files_table(), (int) $scan->id ) );1038 $total = $count; 976 1039 self::update_scan( (int) $scan->id, array( 'stage' => 'scan', 'total_files' => $total, 'context' => wp_json_encode( $context ), 'current_file' => __( 'Local file index completed', 'hard-guard-security' ) ) ); 977 1040 return; … … 999 1062 $processed = 0; 1000 1063 $current = ''; 1064 $context = self::decode_context( $scan ); 1065 $started = microtime( true ); 1001 1066 foreach ( $rows as $row ) { 1002 1067 $current = (string) $row->relative_path; 1003 self::scan_file_row( $scan, $row ); 1068 self::scan_file_row( $scan, $row, $context ); 1069 if ( ! empty( $context['large_file_state'] ) ) { 1070 $progress = $context['large_file_state']; 1071 $current .= ' — ' . size_format( (int) $progress['offset'], 2 ) . ' / ' . size_format( (int) $progress['size'], 2 ); 1072 break; // Persist before another request; do not count a pending file twice. 1073 } 1004 1074 ++$processed; 1005 } 1006 $wpdb->query( $wpdb->prepare( 'UPDATE %i SET processed_files = processed_files + %d, current_file = %s WHERE id = %d', self::scans_table(), $processed, $current, (int) $scan->id ) ); 1075 if ( microtime( true ) - $started >= 3.0 ) { break; } 1076 } 1077 if ( false === $wpdb->query( $wpdb->prepare( 'UPDATE %i SET processed_files = processed_files + %d, current_file = %s, context = %s WHERE id = %d AND status = %s', self::scans_table(), $processed, $current, wp_json_encode( $context ), (int) $scan->id, 'running' ) ) ) { self::fail( (int) $scan->id, __( 'File scan progress could not be saved.', 'hard-guard-security' ) ); } 1007 1078 } 1008 1079 … … 1010 1081 * @param object $row 1011 1082 */ 1012 private static function scan_file_row( $scan, $row ): void {1083 private static function scan_file_row( $scan, $row, array &$context ): void { 1013 1084 global $wpdb; 1014 1085 $absolute = self::absolute_path( (string) $row->relative_path ); 1086 clearstatcache( true, $absolute ); 1015 1087 if ( ( 'custom' === (string) $scan->scan_type && ! self::custom_path_allowed( $absolute, self::decode_context( $scan ) ) ) || ! is_file( $absolute ) || is_link( $absolute ) || ! self::path_inside_root( $absolute ) ) { 1016 1088 // Missing Core files belong to Tools > File Integrity, not Scanner. 1017 $wpdb->update( self::scan_files_table(), array( 'status' => 'missing' ), array( 'id' => (int) $row->id ) ); 1089 unset( $context['large_file_state'] ); 1090 self::record_coverage( $context, (string) $row->relative_path, 'missing', null, 0 ); 1091 self::save_file_status( $row, 'missing', '' ); 1018 1092 return; 1019 1093 } … … 1021 1095 if ( ! is_readable( $absolute ) ) { 1022 1096 // Permission/read failures belong to File Permissions Scan. 1023 $wpdb->update( self::scan_files_table(), array( 'status' => 'unreadable' ), array( 'id' => (int) $row->id ) ); 1097 unset( $context['large_file_state'] ); 1098 self::record_coverage( $context, (string) $row->relative_path, 'unreadable', null, 0 ); 1099 self::save_file_status( $row, 'unreadable', '' ); 1024 1100 return; 1025 1101 } 1026 1102 1027 $size = (int) @filesize( $absolute ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1103 $size_raw = @filesize( $absolute ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1104 if ( false === $size_raw ) { unset( $context['large_file_state'] ); self::record_coverage( $context, (string) $row->relative_path, 'unreadable', null, 0 ); self::save_file_status( $row, 'unreadable', '' ); return; } 1105 $size = (int) $size_raw; // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1028 1106 $mtime = (int) @filemtime( $absolute ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1029 $hash = @hash_file( 'sha256', $absolute ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1030 $hash = is_string( $hash ) ? $hash : ''; 1107 $max_bytes = max( MB_IN_BYTES, (int) ( $context['max_bytes'] ?? 5 * MB_IN_BYTES ) ); 1108 $relative = (string) $row->relative_path; 1109 $scannable = self::content_scannable( strtolower( $relative ), $size ); 1110 $reason = ''; 1111 if ( $scannable && $size > $max_bytes ) { $reason = 'size_limit'; } 1112 elseif ( $scannable && $size > self::content_memory_budget( self::is_code_extension( $relative ) ) ) { $reason = 'memory_limit'; } 1113 $state = (array) ( $context['large_file_state'] ?? array() ); 1114 $resuming = ! empty( $state ) && (int) ( $state['row_id'] ?? 0 ) === (int) $row->id; 1115 if ( ! empty( $state ) && ! $resuming ) { throw new RuntimeException( __( 'Large-file scan checkpoint does not match the pending queue.', 'hard-guard-security' ) ); } 1116 $stream = $resuming || ( '' !== $reason && self::resumable_text_path( $relative ) ); 1117 $hash_allowed = ! $stream && $size <= max( self::PARTIAL_READ_LIMIT, $max_bytes ); 1118 $hash = $hash_allowed ? @hash_file( 'sha256', $absolute ) : false; // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1119 $hash = is_string( $hash ) ? $hash : ''; 1120 if ( $stream ) { 1121 if ( ! $resuming ) { $state = array( 'row_id' => (int) $row->id, 'reason' => $reason ); } 1122 $partial = self::resume_large_file( $absolute, $relative, $size, $max_bytes, $state ); 1123 if ( ! $partial['done'] ) { $context['large_file_state'] = $partial['state']; return; } 1124 unset( $context['large_file_state'] ); 1125 $hash = $partial['hash']; 1126 } 1031 1127 $rules = array(); 1032 1128 $checksum_status = '' !== (string) $row->expected_hash ? 'allowlisted' : 'not_used'; … … 1055 1151 } 1056 1152 1057 $context = self::decode_context( $scan );1058 $max_bytes = max( MB_IN_BYTES, (int) ( $context['max_bytes'] ?? 5 * MB_IN_BYTES ) );1059 1153 $excerpt = ''; 1060 1154 $line = 0; 1061 $file_status = 'scanned'; 1062 if ( $size > $max_bytes && self::content_scannable( $relative_lower, $size ) ) { $file_status = 'content_limited'; } 1063 if ( $size <= $max_bytes && self::content_scannable( $relative_lower, $size ) ) { 1064 $content = @file_get_contents( $absolute, false, null, 0, $max_bytes + 1 ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1155 $file_status = $scannable ? 'scanned' : 'metadata_only'; 1156 $analysed_bytes = 0; 1157 if ( $stream ) { 1158 $file_status = 'content_limited'; 1159 $reason = $partial['reason']; 1160 $analysed_bytes = $partial['bytes']; 1161 $rules = array_merge( $rules, $partial['rules'] ); 1162 $line = $partial['line']; 1163 // Never persist raw excerpts from partial lexical contexts. 1164 if ( ! empty( $partial['rules'] ) ) { $excerpt = __( '[Excerpt omitted: windowed analysis requires manual review.]', 'hard-guard-security' ); } 1165 } elseif ( $scannable && '' !== $reason ) { 1166 $file_status = 'content_limited'; 1167 1168 } elseif ( $scannable ) { 1169 $content = @file_get_contents( $absolute, false, null, 0, min( $max_bytes, $size ) + 1 ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1065 1170 if ( is_string( $content ) && strlen( $content ) <= $max_bytes && strlen( $content ) === $size ) { 1171 $analysed_bytes = strlen( $content ); 1066 1172 $analysis = self::analyse_content( $content, (string) $row->relative_path ); 1067 1173 $rules = array_merge( $rules, $analysis['rules'] ); … … 1079 1185 } 1080 1186 } 1081 } else { $file_status = 'content_limited'; } 1187 } else { $file_status = 'content_limited'; $reason = 'read_failed'; } 1188 } 1189 // Do not describe a changing file or failed hash as fully checked. 1190 clearstatcache( true, $absolute ); 1191 if ( @filesize( $absolute ) !== $size || (int) @filemtime( $absolute ) !== $mtime ) { $file_status = 'content_limited'; $reason = 'file_changed'; $hash = ''; } 1192 elseif ( '' === $hash && 'content_limited' !== $file_status ) { $file_status = 'content_limited'; $reason = $hash_allowed ? 'read_failed' : 'hash_limit'; } 1193 if ( 'content_limited' === $file_status ) { 1194 if ( self::is_executable_path( $relative ) && ( $analysed_bytes < $size || '' === $hash ) ) { $rules[] = array( 'code' => 'executable_content_not_fully_examined', 'label' => __( 'Executable file content was not fully examined. Review its source and integrity manually.', 'hard-guard-security' ), 'score' => 50 ); } 1195 if ( $size > $max_bytes && $scannable ) { $context['oversize_files'] = (int) ( $context['oversize_files'] ?? 0 ) + 1; } 1196 self::record_coverage( $context, (string) $row->relative_path, $reason, $size, $analysed_bytes ); 1197 $file_status = self::limited_file_status( $reason, $analysed_bytes, $size, $hash ); 1082 1198 } 1083 1199 … … 1087 1203 self::add_finding( (int) $scan->id, $score, (string) $row->relative_path, $hash, $size, $mtime, $rules, $excerpt, $checksum_status, $line ); 1088 1204 } 1089 $wpdb->update( self::scan_files_table(), array( 'status' => $file_status, 'actual_hash' => $hash ), array( 'id' => (int) $row->id ) ); 1205 self::save_file_status( $row, $file_status, $hash ); 1206 } 1207 1208 private static function save_file_status( $row, string $status, string $hash ): void { 1209 global $wpdb; 1210 if ( false === $wpdb->update( self::scan_files_table(), array( 'status' => $status, 'actual_hash' => $hash ), array( 'id' => (int) $row->id ) ) ) { 1211 throw new RuntimeException( __( 'File scan result could not be saved.', 'hard-guard-security' ) ); 1212 } 1213 } 1214 1215 /** Store bounded, root-relative examples and exact counters (not malware findings). */ 1216 private static function record_coverage( array &$context, string $path, string $reason, ?int $size, int $bytes ): void { 1217 $context['coverage_counts'][ $reason ] = (int) ( $context['coverage_counts'][ $reason ] ?? 0 ) + 1; 1218 if ( count( (array) ( $context['coverage_details'] ?? array() ) ) < self::COVERAGE_DETAIL_LIMIT ) { 1219 $context['coverage_details'][] = array( 'path' => $path, 'reason' => $reason, 'size' => $size, 'bytes' => $bytes ); 1220 } 1221 } 1222 1223 /** Conservative headroom for tokenization, regexes and the live WP process. */ 1224 private static function content_memory_budget( bool $php = false ): int { 1225 $raw = trim( (string) ini_get( 'memory_limit' ) ); 1226 if ( '-1' === $raw ) { return 50 * MB_IN_BYTES; } 1227 $limit = (int) $raw; 1228 $unit = strtolower( substr( $raw, -1 ) ); 1229 if ( 'g' === $unit ) { $limit *= 1024 * 1024 * 1024; } 1230 elseif ( 'm' === $unit ) { $limit *= 1024 * 1024; } 1231 elseif ( 'k' === $unit ) { $limit *= 1024; } 1232 return max( 0, (int) floor( ( $limit - memory_get_usage( true ) - 16 * MB_IN_BYTES ) / ( $php ? 64 : 12 ) ) ); 1233 } 1234 1235 /** Text only: never window binary containers. */ 1236 private static function resumable_text_path( string $relative ): bool { 1237 $ext = strtolower( pathinfo( $relative, PATHINFO_EXTENSION ) ); 1238 return 'phar' !== $ext && ( self::is_code_extension( $relative ) || in_array( $ext, array( 'js', 'mjs', 'cjs', 'html', 'htm', 'svg' ), true ) ); 1239 } 1240 1241 private static function stream_identity( array $stat ): array { 1242 return array_map( 'intval', array( $stat['dev'], $stat['ino'], $stat['size'], $stat['mtime'], $stat['ctime'], $stat['mode'] ) ); 1243 } 1244 1245 /** A resumable, bounded analysis. Persist only offsets, digests and rule labels, never source bytes. */ 1246 private static function resume_large_file( string $absolute, string $relative, int $size, int $max_bytes, array $state ): array { 1247 $result = array( 'done' => true, 'state' => array(), 'hash' => '', 'rules' => (array) ( $state['rules'] ?? array() ), 'line' => (int) ( $state['line'] ?? 0 ), 'bytes' => (int) ( $state['offset'] ?? 0 ), 'reason' => 'read_failed' ); 1248 $handle = @fopen( $absolute, 'rb' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen,WordPress.PHP.NoSilencedErrors.Discouraged 1249 if ( ! is_resource( $handle ) ) { return $result; } 1250 $started = microtime( true ); 1251 try { 1252 $stat = fstat( $handle ); 1253 clearstatcache( true, $absolute ); 1254 $path_stat = @lstat( $absolute ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1255 if ( ! $stat || ! $path_stat || ( $stat['mode'] & 0170000 ) !== 0100000 || self::stream_identity( $stat ) !== self::stream_identity( $path_stat ) || (int) $stat['size'] !== $size ) { $result['reason'] = 'file_changed'; return $result; } 1256 $identity = self::stream_identity( $stat ); 1257 if ( isset( $state['identity'] ) && $state['identity'] !== $identity ) { $result['reason'] = 'file_changed'; return $result; } 1258 $state['identity'] = $identity; 1259 $state['size'] = $size; 1260 $state['offset'] = $result['bytes']; 1261 $state['lines'] = (int) ( $state['lines'] ?? 0 ); 1262 $state['segments'] = (array) ( $state['segments'] ?? array() ); 1263 $state['rules'] = $result['rules']; 1264 $state['line'] = $result['line']; 1265 $php = self::is_code_extension( $relative ); 1266 $budget = min( $size, self::RESUMABLE_FILE_LIMIT ); 1267 $step_start = $state['offset']; 1268 while ( $state['offset'] < $budget && count( $state['segments'] ) < self::RESUMABLE_MAX_SEGMENTS && $state['offset'] - $step_start < self::RESUMABLE_STEP_BYTES && microtime( true ) - $started < 2.0 ) { 1269 $memory_window = self::content_memory_budget( $php ); 1270 // PHP tokens can cost many times their source size; preserve extra headroom. 1271 if ( $php ) { $memory_window = min( 262144, (int) floor( $memory_window / 3 ) ); } 1272 $window = min( self::PARTIAL_WINDOW_MAX, $max_bytes, $memory_window ); 1273 if ( $window < 65536 ) { $result['reason'] = 'memory_limit'; return $result; } 1274 $offset = $state['offset']; 1275 $overlap = min( $offset, self::PARTIAL_OVERLAP, (int) floor( $window / 4 ) ); 1276 $length = min( $window - $overlap, $budget - $offset, self::RESUMABLE_STEP_BYTES - ( $offset - $step_start ) ); 1277 if ( 0 !== fseek( $handle, $offset - $overlap ) ) { return $result; } 1278 $content = fread( $handle, $length + $overlap ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fread 1279 if ( ! is_string( $content ) || strlen( $content ) !== $length + $overlap ) { return $result; } 1280 $analysis = self::analyse_content( $content, $relative ); 1281 // Keep a conservative additional PHP view for windows without an opening tag. 1282 // This is not a complete lexical parser; findings from partial context require review. 1283 if ( $php && $offset > 0 && ! preg_match( '/<\?(?:php\b|=)/i', $content ) ) { 1284 $extra = self::analyse_content( '<?php ' . $content, $relative ); 1285 if ( empty( $analysis['rules'] ) && ! empty( $extra['rules'] ) ) { $analysis['line'] = $extra['line']; } 1286 $analysis['rules'] = self::deduplicate_rules( array_merge( $analysis['rules'], $extra['rules'] ) ); 1287 unset( $extra ); 1288 } 1289 if ( ! empty( $analysis['rules'] ) ) { 1290 $state['rules'] = self::deduplicate_rules( array_merge( $state['rules'], $analysis['rules'] ) ); 1291 if ( ! $state['line'] ) { $state['line'] = max( 1, $state['lines'] - ( $overlap ? substr_count( $content, "\n", 0, $overlap ) : 0 ) + max( 1, (int) $analysis['line'] ) ); } 1292 } 1293 $unique = substr( $content, $overlap ); 1294 $state['segments'][] = array( $length, hash( 'sha256', $unique ) ); 1295 $state['lines'] += substr_count( $unique, "\n" ); 1296 $state['offset'] += $length; 1297 $result['bytes'] = $state['offset']; $result['rules'] = $state['rules']; $result['line'] = $state['line']; 1298 unset( $content, $unique, $analysis ); 1299 } 1300 clearstatcache( true, $absolute ); 1301 $after = @lstat( $absolute ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1302 $after_handle = fstat( $handle ); 1303 if ( ! $after || ! $after_handle || self::stream_identity( $after ) !== $identity || self::stream_identity( $after_handle ) !== $identity ) { $result['reason'] = 'file_changed'; return $result; } 1304 if ( $state['offset'] < $budget && count( $state['segments'] ) < self::RESUMABLE_MAX_SEGMENTS ) { 1305 if ( $state['offset'] === $step_start ) { $result['reason'] = 'stream_budget'; return $result; } 1306 $result['done'] = false; $result['state'] = $state; return $result; 1307 } 1308 if ( $state['offset'] < $size ) { $result['reason'] = 'stream_budget'; return $result; } 1309 // PHP HashContext cannot be serialized between requests. Perform one bounded 1310 // streaming verification pass, checking every segment against the analysed bytes. 1311 // Defer this pass to a separate cycle rather than stacking it on a slow analysis. 1312 if ( $step_start !== $size ) { $result['done'] = false; $result['state'] = $state; return $result; } 1313 if ( 0 !== fseek( $handle, 0 ) ) { return $result; } 1314 $hash = hash_init( 'sha256' ); 1315 foreach ( $state['segments'] as $segment ) { 1316 if ( microtime( true ) - $started >= 2.0 ) { $result['reason'] = 'hash_limit'; return $result; } 1317 if ( self::content_memory_budget() < (int) $segment[0] ) { $result['reason'] = 'memory_limit'; return $result; } 1318 $bytes = fread( $handle, (int) $segment[0] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fread 1319 if ( ! is_string( $bytes ) || strlen( $bytes ) !== (int) $segment[0] ) { return $result; } 1320 if ( ! hash_equals( (string) $segment[1], hash( 'sha256', $bytes ) ) ) { $result['reason'] = 'file_changed'; return $result; } 1321 hash_update( $hash, $bytes ); unset( $bytes ); 1322 } 1323 clearstatcache( true, $absolute ); 1324 $after = @lstat( $absolute ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1325 $after_handle = fstat( $handle ); 1326 if ( ! $after || ! $after_handle || self::stream_identity( $after ) !== $identity || self::stream_identity( $after_handle ) !== $identity ) { $result['reason'] = 'file_changed'; return $result; } 1327 $result['hash'] = hash_final( $hash ); 1328 $result['reason'] = 'windowed_complete'; // All bytes examined, not all whole-file context. 1329 return $result; 1330 } finally { fclose( $handle ); } // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose 1090 1331 } 1091 1332 … … 1460 1701 $first_offset = $hidden_offset; 1461 1702 } 1462 } elseif ( self::image_extension( $relative_lower ) && false !== strpos( $content, '<?=' ) ) { 1463 $rules[] = array( 'code' => 'binary_image_marker_review', 'label' => __( 'An ambiguous short PHP marker occurs in binary image data; review if the image is unexpected.', 'hard-guard-security' ), 'score' => 5 ); 1464 } 1703 } 1704 // Ambiguous short markers inside validated raster payload are not standalone findings. 1465 1705 1466 1706 /* … … 1992 2232 public static function finding_rule_label( string $code, string $stored_label = '' ): string { 1993 2233 switch ( sanitize_key( $code ) ) { 2234 case 'executable_content_not_fully_examined': 2235 return __( 'Executable file content was not fully examined. Review its source and integrity manually.', 'hard-guard-security' ); 1994 2236 case 'wp_vcd_observed_core_path': 1995 2237 return __( 'File matches a historically reported WP-VCD path. Verify its contents and provenance.', 'hard-guard-security' ); … … 2439 2681 } 2440 2682 2683 private static function coverage_final_status( array $context, array $counts, bool $count_error, int $total, int $processed ): string { 2684 $db = (array) ( $context['database_scan'] ?? array() ); 2685 if ( array_diff( array_keys( $counts ), array( 'scanned', 'metadata_only', 'pending', 'missing', 'unreadable', 'content_limited', 'windowed_complete', 'content_partial', 'content_skipped', 'content_unverified' ) ) ) { return 'incomplete'; } 2686 if ( $count_error || ! empty( $context['large_file_state'] ) || array_sum( $counts ) !== $total || $processed !== $total || ! empty( $counts['pending'] ) || ! empty( $context['truncated'] ) || ! empty( $context['coverage_counts']['directory_unreadable'] ) || ! empty( $db['incomplete'] ) || ! empty( $db['failed_targets'] ) || ! empty( $db['partial_rows'] ) || ! empty( $db['truncated'] ) || ( ! empty( $db['enabled'] ) && empty( $db['completed'] ) ) ) { return 'incomplete'; } 2687 $windowed = (int) ( $counts['windowed_complete'] ?? 0 ); 2688 $reasons = (array) ( $context['coverage_counts'] ?? array() ); 2689 $windowed_recorded = (int) ( $reasons['windowed_complete'] ?? 0 ); 2690 unset( $reasons['windowed_complete'] ); 2691 // Size alone is not a coverage failure. Require consistent, verified windowed results. 2692 if ( (int) ( $context['oversize_files'] ?? 0 ) > $windowed || $windowed !== $windowed_recorded || array_filter( $reasons ) || ! empty( $counts['missing'] ) || ! empty( $counts['unreadable'] ) || ! empty( $counts['content_limited'] ) || ! empty( $counts['content_partial'] ) || ! empty( $counts['content_skipped'] ) || ! empty( $counts['content_unverified'] ) ) { return 'completed_limited'; } 2693 if ( $windowed > 0 ) { return 'completed_large'; } 2694 return 'completed'; 2695 } 2696 2441 2697 private static function finish( int $scan_id ): void { 2442 2698 global $wpdb; … … 2449 2705 } 2450 2706 $context = self::decode_context( $scan ); 2451 $db_state = (array) ( $context['database_scan'] ?? array() ); 2452 $unread_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM %i WHERE scan_id = %d AND status IN ('pending','missing','unreadable','content_limited')", self::scan_files_table(), $scan_id ) ); 2453 $incomplete = null === $unread_count || ! empty( $wpdb->last_error ) || (int) $unread_count > 0 || ! empty( $context['truncated'] ) || ! empty( $context['oversize_files'] ) || ! empty( $db_state['incomplete'] ) || ( ! empty( $db_state['enabled'] ) && empty( $db_state['completed'] ) ); 2454 $final_status = $incomplete ? 'incomplete' : 'completed'; 2455 $wpdb->update( self::scans_table(), array( 'status' => $final_status, 'stage' => $final_status, 'current_file' => '', 'finished_at' => current_time( 'mysql', true ), 'error_message' => $incomplete ? __( 'Some content was not fully analysed. Review scan limits and database coverage.', 'hard-guard-security' ) : '' ), array( 'id' => $scan_id ) ); 2707 $counts = $wpdb->get_results( $wpdb->prepare( "SELECT status, COUNT(*) AS amount FROM %i WHERE scan_id = %d GROUP BY status", self::scan_files_table(), $scan_id ) ); 2708 $count_error = ! is_array( $counts ) || ! empty( $wpdb->last_error ); 2709 $file_counts = array(); 2710 foreach ( is_array( $counts ) ? $counts : array() as $entry ) { $file_counts[ (string) $entry->status ] = (int) $entry->amount; } 2711 $context['coverage_file_statuses'] = $file_counts; 2712 $context['coverage_count_error'] = $count_error; 2713 $final_status = self::coverage_final_status( $context, $file_counts, $count_error, (int) $scan->total_files, (int) $scan->processed_files ); 2714 $incomplete = in_array( $final_status, array( 'incomplete', 'completed_limited' ), true ); 2715 if ( false === $wpdb->update( self::scans_table(), array( 'status' => $final_status, 'stage' => $final_status, 'context' => wp_json_encode( $context ), 'current_file' => '', 'finished_at' => current_time( 'mysql', true ), 'error_message' => $incomplete ? __( 'Some content was not fully analysed. Review scan limits and database coverage.', 'hard-guard-security' ) : '' ), array( 'id' => $scan_id, 'status' => 'running' ) ) ) { throw new RuntimeException( __( 'Final scan coverage could not be saved.', 'hard-guard-security' ) ); } 2456 2716 $scan = self::get_scan( $scan_id ); 2457 2717 $automatic = self::is_automatic_scan( $scan ); … … 2492 2752 /* translators: %d: scan ID. */ 2493 2753 sprintf( __( 'Scan ID: %d', 'hard-guard-security' ), (int) $scan->id ), 2754 __( 'Status:', 'hard-guard-security' ) . ' ' . self::scan_status_label( (string) $scan->status ), 2494 2755 /* translators: %s: scan type. */ 2495 2756 sprintf( __( 'Type: %s', 'hard-guard-security' ), self::scan_display_label( $scan ) ), … … 2585 2846 * @param array<int,array{relative_path:string,source:string,scope:string}> $files 2586 2847 */ 2587 private static function enqueue_actual_files_batch( int $scan_id, array $files ): void{2848 private static function enqueue_actual_files_batch( int $scan_id, array $files ): bool { 2588 2849 global $wpdb; 2589 2850 if ( empty( $files ) ) { 2590 return ;2851 return true; 2591 2852 } 2592 2853 … … 2618 2879 } 2619 2880 $sql = 'INSERT IGNORE INTO %i (scan_id,path_hash,relative_path,expected_hash,checksum_source,scope,status,actual_hash) VALUES ' . implode( ',', $placeholders ); 2620 $wpdb->query( $wpdb->prepare( $sql, $args ) ); 2621 } 2881 if ( false === $wpdb->query( $wpdb->prepare( $sql, $args ) ) ) { return false; } 2882 } 2883 return true; 2622 2884 } 2623 2885 … … 2756 3018 $max_bytes = max( MB_IN_BYTES, (int) ( $context['max_bytes'] ?? 5 * MB_IN_BYTES ) ); 2757 3019 if ( self::is_sc_persistence_candidate_path( $relative ) ) { 2758 return $size <= $max_bytes;3020 return true; 2759 3021 } 2760 3022 if ( self::is_htaccess_path( $relative ) && ( WPGUARD_Settings::get( 'suspicious_htaccess_scanner' ) || self::is_upload_path( $relative ) ) ) { … … 2765 3027 } 2766 3028 if ( in_array( $type, array( 'full', 'custom' ), true ) ) { 2767 return self::is_executable_path( $relative ) || self::is_double_extension( $relative ) || ( $size <= $max_bytes &&self::content_scannable( $relative, $size ) && ( self::hidden_php_target( $relative ) || in_array( strtolower( pathinfo( $relative, PATHINFO_EXTENSION ) ), array( '', 'js', 'mjs', 'cjs', 'html', 'htm', 'bak', 'tmp', 'dat', 'old' ), true ) ) );3029 return self::is_executable_path( $relative ) || self::is_double_extension( $relative ) || ( self::content_scannable( $relative, $size ) && ( self::hidden_php_target( $relative ) || in_array( strtolower( pathinfo( $relative, PATHINFO_EXTENSION ) ), array( '', 'js', 'mjs', 'cjs', 'html', 'htm', 'bak', 'tmp', 'dat', 'old' ), true ) ) ); 2768 3030 } 2769 3031 if ( self::is_upload_path( $relative ) ) { … … 2871 3133 } 2872 3134 3135 /** 3136 * Confirm the complete container structure before discounting an ambiguous 3137 * short PHP marker. Metadata, headers, trailing bytes and unknown formats 3138 * are never classified as raster payload. This is not an image decoder. 3139 */ 2873 3140 private static function raster_payload_at( string $data, int $offset ): bool { 2874 3141 $n = strlen( $data ); 3142 $inside = false; 2875 3143 if ( 0 === strpos( $data, "\x89PNG\r\n\x1a\n" ) ) { 2876 for ( $i = 8; $i + 12 <= $n; $i = $end ) { 3144 $seen_data = false; 3145 for ( $i = 8, $steps = 0; $i + 12 <= $n && ++$steps <= 16384; $i = $end ) { 2877 3146 $len = unpack( 'N', substr( $data, $i, 4 ) )[1]; 2878 $type = substr( $data, $i + 4, 4 ); $end = $i + 12 + $len; 2879 if ( $end > $n || $end <= $i || 'IEND' === $type ) { return false; } 2880 if ( $offset >= $i + 8 && $offset + 3 <= $end - 4 ) { return in_array( $type, array( 'IDAT', 'PLTE' ), true ); } 2881 } 3147 $type = substr( $data, $i + 4, 4 ); 3148 if ( $len < 0 || $len > $n - $i - 12 || ! preg_match( '/^[A-Za-z]{4}$/D', $type ) ) { return false; } 3149 $end = $i + 12 + $len; 3150 if ( hash( 'crc32b', substr( $data, $i + 4, $len + 4 ), true ) !== substr( $data, $end - 4, 4 ) ) { return false; } 3151 if ( 8 === $i && ( 'IHDR' !== $type || 13 !== $len ) ) { return false; } 3152 if ( 8 !== $i && 'IHDR' === $type ) { return false; } 3153 if ( 'IEND' === $type ) { return 0 === $len && $seen_data && $inside; } 3154 if ( 'IDAT' === $type && $len > 0 ) { $seen_data = true; } 3155 if ( in_array( $type, array( 'IDAT', 'PLTE' ), true ) && $offset >= $i + 8 && $offset + 3 <= $end - 4 ) { $inside = true; } 3156 } 3157 return false; 2882 3158 } 2883 3159 if ( in_array( substr( $data, 0, 6 ), array( 'GIF87a', 'GIF89a' ), true ) && $n >= 13 ) { 2884 $i = 13; $packed = ord( $data[10] ); 2885 if ( $packed & 128 ) { $end = $i + 3 * ( 2 << ( $packed & 7 ) ); if ( $end > $n ) { return false; } if ( $offset >= $i && $offset + 3 <= $end ) { return true; } $i = $end; } 2886 while ( $i < $n ) { 3160 $i = 13; $packed = ord( $data[10] ); $seen_image = false; $steps = 0; 3161 if ( $packed & 128 ) { 3162 $end = $i + 3 * ( 2 << ( $packed & 7 ) ); 3163 if ( $end > $n ) { return false; } 3164 $inside = $offset >= $i && $offset + 3 <= $end; 3165 $i = $end; 3166 } 3167 while ( $i < $n && ++$steps <= 100000 ) { 2887 3168 $kind = ord( $data[$i++] ); 2888 if ( 0x3b === $kind ) { return false; }3169 if ( 0x3b === $kind ) { return $inside && $seen_image; } 2889 3170 $image = 0x2c === $kind; 2890 3171 if ( $image ) { 2891 if ( $i + 9 > $n ) { return false; } $packed = ord( $data[$i + 8] ); $i += 9; 2892 if ( $packed & 128 ) { $end = $i + 3 * ( 2 << ( $packed & 7 ) ); if ( $end > $n ) { return false; } if ( $offset >= $i && $offset + 3 <= $end ) { return true; } $i = $end; } 2893 ++$i; 2894 } elseif ( 0x21 === $kind ) { ++$i; } else { return false; } 2895 while ( $i < $n ) { $len = ord( $data[$i++] ); if ( 0 === $len ) { break; } $end = $i + $len; if ( $end > $n ) { return false; } if ( $offset >= $i && $offset + 3 <= $end ) { return $image; } $i = $end; } 2896 } 3172 if ( $i + 9 > $n ) { return false; } 3173 $packed = ord( $data[$i + 8] ); $i += 9; 3174 if ( $packed & 128 ) { 3175 $end = $i + 3 * ( 2 << ( $packed & 7 ) ); 3176 if ( $end > $n ) { return false; } 3177 $inside = $inside || ( $offset >= $i && $offset + 3 <= $end ); $i = $end; 3178 } 3179 if ( $i >= $n || ord( $data[$i] ) < 2 || ord( $data[$i] ) > 8 ) { return false; } 3180 ++$i; $seen_image = true; 3181 } elseif ( 0x21 === $kind && $i < $n ) { ++$i; } else { return false; } 3182 $terminated = false; 3183 while ( $i < $n && ++$steps <= 100000 ) { 3184 $len = ord( $data[$i++] ); 3185 if ( 0 === $len ) { $terminated = true; break; } 3186 $end = $i + $len; 3187 if ( $end > $n ) { return false; } 3188 if ( $image && $offset >= $i && $offset + 3 <= $end ) { $inside = true; } 3189 $i = $end; 3190 } 3191 if ( ! $terminated ) { return false; } 3192 } 3193 return false; 2897 3194 } 2898 3195 if ( 0 === strpos( $data, "\xff\xd8" ) ) { 2899 $i = 2; $scan = false; 2900 while ( $i < $n) {3196 $i = 2; $scan = false; $seen_scan = false; $seen_frame = false; 3197 for ( $steps = 0; $i < $n && ++$steps <= 100000; ) { 2901 3198 if ( $scan ) { 2902 3199 $marker = strpos( $data, "\xff", $i ); 2903 3200 if ( false === $marker || $marker + 1 >= $n ) { return false; } 2904 if ( $offset >= $i && $offset + 3 <= $marker ) { return true; } 2905 $code = ord( $data[$marker + 1] ); 2906 if ( 0 === $code || ( $code >= 0xd0 && $code <= 0xd7 ) ) { $i = $marker + 2; continue; } 3201 if ( $offset >= $i && $offset + 3 <= $marker ) { $inside = true; } 3202 $j = $marker + 1; 3203 while ( $j < $n && "\xff" === $data[$j] ) { ++$j; } 3204 if ( $j >= $n ) { return false; } 3205 $code = ord( $data[$j] ); 3206 if ( 0 === $code || ( $code >= 0xd0 && $code <= 0xd7 ) ) { $i = $j + 1; continue; } 2907 3207 $i = $marker; $scan = false; 2908 3208 } 2909 3209 if ( $i + 1 >= $n || "\xff" !== $data[$i] ) { return false; } 2910 3210 while ( $i < $n && "\xff" === $data[$i] ) { ++$i; } 2911 if ( $i + 2 >= $n ) { return false; } $code = ord( $data[$i++] ); 2912 if ( 0xd9 === $code ) { return false; } 2913 $len = unpack( 'n', substr( $data, $i, 2 ) )[1]; if ( $len < 2 || $i + $len > $n ) { return false; } 2914 $i += $len; $scan = 0xda === $code; 2915 } 3211 if ( $i >= $n ) { return false; } 3212 $code = ord( $data[$i++] ); 3213 if ( 0xd9 === $code ) { return $inside && $seen_scan && $seen_frame; } 3214 if ( $i + 2 > $n || $code < 0xc0 || ( $code >= 0xd0 && $code <= 0xd8 ) ) { return false; } 3215 $len = unpack( 'n', substr( $data, $i, 2 ) )[1]; 3216 if ( $len < 2 || $i + $len > $n ) { return false; } 3217 if ( in_array( $code, array( 0xc0, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, 0xc7, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf ), true ) ) { $seen_frame = $len >= 8; } 3218 $i += $len; $scan = 0xda === $code; $seen_scan = $seen_scan || $scan; 3219 } 3220 return false; 3221 } 3222 if ( $n >= 20 && 'RIFF' === substr( $data, 0, 4 ) && 'WEBP' === substr( $data, 8, 4 ) ) { 3223 $size = unpack( 'V', substr( $data, 4, 4 ) )[1]; 3224 if ( $size < 12 || $size > $n - 8 || $size % 2 ) { return false; } 3225 $limit = $size + 8; $seen_image = false; 3226 for ( $i = 12, $steps = 0; $i + 8 <= $limit && ++$steps <= 16384; $i = $end ) { 3227 $type = substr( $data, $i, 4 ); $len = unpack( 'V', substr( $data, $i + 4, 4 ) )[1]; 3228 if ( $len < 0 || $len > $limit - $i - 8 ) { return false; } 3229 $start = $i + 8; $end = $start + $len + ( $len % 2 ); 3230 if ( $end > $limit ) { return false; } 3231 $header = 0; 3232 if ( 'VP8 ' === $type && $len >= 10 && 0 === ( ord( $data[$start] ) & 1 ) && "\x9d\x01\x2a" === substr( $data, $start + 3, 3 ) ) { $header = 10; } 3233 if ( 'VP8L' === $type && $len >= 5 && "\x2f" === $data[$start] && 0 === ( ord( $data[$start + 4] ) & 0xe0 ) ) { $header = 5; } 3234 if ( 'ANMF' === $type || 'ANIM' === $type ) { return false; } // Unknown/animated layout: retain review. 3235 if ( in_array( $type, array( 'VP8 ', 'VP8L' ), true ) ) { 3236 if ( ! $header || $seen_image ) { return false; } 3237 $seen_image = true; 3238 if ( $offset >= $start + $header && $offset + 3 <= $start + $len ) { $inside = true; } 3239 } 3240 } 3241 return $i === $limit && $seen_image && $inside; 2916 3242 } 2917 3243 return false; … … 2989 3315 'running' => __( 'Running', 'hard-guard-security' ), 2990 3316 'completed' => __( 'Completed', 'hard-guard-security' ), 3317 'completed_large' => __( 'Completed with large files', 'hard-guard-security' ), 3318 'completed_limited' => __( 'Completed with limitations', 'hard-guard-security' ), 2991 3319 'incomplete' => __( 'Incomplete', 'hard-guard-security' ), 2992 3320 'stopped' => __( 'Stopped', 'hard-guard-security' ), … … 3068 3396 'vulnerabilities' => __( 'Checking vulnerabilities and installed versions', 'hard-guard-security' ), 3069 3397 'completed' => __( 'Completed', 'hard-guard-security' ), 3398 'completed_large' => __( 'Completed with large files', 'hard-guard-security' ), 3399 'completed_limited' => __( 'Completed with limitations', 'hard-guard-security' ), 3070 3400 'incomplete' => __( 'Incomplete', 'hard-guard-security' ), 3071 3401 'stopped' => __( 'Stopped', 'hard-guard-security' ), -
hard-guard-security/trunk/readme.txt
r3832607 r3832856 6 6 Tested up to: 7.1 7 7 Requires PHP: 7.4 8 Stable tag: 1.18.14.3 28 Stable tag: 1.18.14.38 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 212 212 213 213 == Changelog == 214 = 1.18.14.38 = 215 * Malware Scanner: Large File Message Clarity Update. Clarify successful memory-efficient windowed analysis of all bytes and verified integrity while retaining the note that some whole-file context checks may be limited. No changes to detection rules, scan status logic or Behavioural Heuristics Engine 3.3.4. 216 217 = 1.18.14.37 = 218 * Malware Scanner: Scan Status & Reporting Clarity Update. Completed with large files identifies successful verified all-byte windowed analysis without other coverage failures. Actual missing, partial or unverified content still reports Completed with limitations; unfinished stages remain Incomplete. Windowed analysis does not guarantee whole-file context. 219 * Separate large-file and actual-limitation details and paginated paths. Preserve metadata-only and legacy history reporting. Behavioural Heuristics Engine 3.3.4 unchanged; no additional file reads, new tables or external dependencies. 220 221 = 1.18.14.36 = 222 * Malware Scanner: Coverage Reporting Precision Update (Behavioural Heuristics Engine 3.3.4 unchanged). Distinguish all-byte windowed analysis, partial/skipped/unverified content, metadata-only, missing and unreadable files. Retain conservative completion status and all existing detection rules. 223 * Show paginated metadata-only file paths from saved scan queues. Exclusions are reported separately from queue totals. Older history is not rewritten; legacy limited entries remain explicitly labelled if evidence is insufficient. No new database tables or schema changes. 224 225 = 1.18.14.35 = 226 * Malware Scanner: Behavioural Heuristics Engine 3.3.4 – Anti-Evasion & Large File Protection. Resume eligible large text files across scan steps using bounded overlapping windows. Preserve limited coverage status even when all bytes were examined; PHP lexical and whole-file context remain approximate. No raw source is retained in checkpoints. 227 * Verify analysed segments and calculate SHA-256 in a separate bounded streaming pass; changed files, memory exhaustion and safety budgets remain visible. Unexamined executable content requires manual review. Binary containers still require whole-file analysis. 228 * Show paginated paths of all limited file queue entries, in addition to bounded size and byte details. No new tables, external APIs or dependencies. Stop any running scan before updating; run a fresh scan on staging. 229 230 = 1.18.14.34 = 231 * Malware Scanner: Behavioural Heuristics Engine 3.3.3 – Scan Coverage Update. Distinguish Completed with limitations (file coverage) from Incomplete (unfinished or failed coverage stages). New scans record root-relative limitation examples, sizes, bytes examined, status totals and database coverage. Older history is retained. 232 * Eligible large text files receive bounded overlapping static-analysis windows (up to 16 MiB per file, subject to memory and time limits). Partial analysis does not replace whole-file context; binary containers still require whole-file analysis. The full-file size setting remains unchanged. No new database tables or remote services. 233 * Apply the existing file exclusion policy before counting size limitations; retain safety checks for media that cannot be verified for exclusion. Report failed file reads and queue accounting. 234 235 = 1.18.14.33 = 236 * Malware Scanner: Behavioural Heuristics Engine 3.3.2. Ambiguous short PHP markers in structurally verified PNG, GIF, JPEG and static WebP raster payload are no longer reported on their own. PNG chunk CRC and container boundaries are checked; metadata, trailing data, malformed/unsupported containers and executable-looking PHP markers retain review. 237 * Bounded static analysis only; no image decoding, external API or new dependencies. Existing scan results are not rewritten. Test on staging before release. 238 214 239 = 1.18.14.32 = 215 240 * Malware Scanner: Behavioural Heuristics Engine 3.3.1 stability update. Database progress now advances past intentionally excluded rows; failed content reads retry twice before marking the affected area incomplete.
Note:
See TracChangeset
for help on using the changeset viewer.