ARGUS WordPress Defence 7.23.0
Real changes since 1.0.0, all live-verified before this release: - Firewall: rule corpus expanded 19 -> 43 rules, real OWASP-CRS-equivalent coverage (XXE, SSRF, session fixation, Log4Shell/JNDI, scanner-tool detection, deeper SQL injection/XSS/PHP-injection). - Fixed a real bug: a quarantined file's severity badge and its content analysis score could disagree with no explanation (e.g. a benign file showing CRITICAL next to Score 0); both are now derived consistently and shown together. - ARGUS now always keeps itself updated, and can optionally do the same for every other installed plugin and theme (Settings, on by default) -- uses WordPress's own native update system, nothing custom. - Global Threat Intelligence is now opt-in, not automatic -- a single click on its own page, with an honest, specific description of exactly what's shared (an IP address, a reason code, a confidence score, a country). Previously connected automatically on activation. - New first-run Welcome screen after activation: confirms what's already protecting the site, and surfaces the few real optional choices in one place. - Dashboard: running version now visible in the header; new "IPs Tracked" and "ANIS Protections" metrics. - Full WordPress.org Plugin Directory readiness audit performed against this codebase. Two real compliance issues found and fixed (see above: Global Threat Intelligence's default, and the self-update mechanism, which is excluded from this build entirely -- WordPress.org prohibits a plugin from using any update channel other than its own, even an inert one). This release is still self-distributed, not a WordPress.org submission -- that remains a future step. Verified before publishing: this exact ZIP was installed, activated (14 admin pages loaded clean, zero PHP errors/warnings), and uninstalled (zero leftover database tables or options) in a fresh, disposable WordPress + MySQL environment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -141,36 +141,68 @@ class Argus_Malware_Scanner {
|
||||
$rel = str_replace( wp_normalize_path( ABSPATH ), '', wp_normalize_path( $path ) );
|
||||
|
||||
if ( self::is_restored_trusted( $rel, hash_file( 'sha256', $path ) ) ) {
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
$size = filesize( $path );
|
||||
$mtime = gmdate( 'Y-m-d H:i:s', filemtime( $path ) );
|
||||
|
||||
// The detection rule itself ("a PHP file exists inside uploads") is
|
||||
// location-based and unconditional -- WordPress never executes PHP
|
||||
// there by design, so any match is quarantined regardless of content.
|
||||
// The content heuristic score is a SEPARATE signal layered on top,
|
||||
// used only to set an honest severity/verdict -- never to skip
|
||||
// quarantining. This keeps "rule matched" (always true here),
|
||||
// "analysis score" (score_content()'s real number), and "verdict"
|
||||
// (the severity below) from contradicting each other in the UI, e.g.
|
||||
// a benign defensive stub scoring 0 must never be labeled CRITICAL.
|
||||
$content = is_readable( $path ) ? file_get_contents( $path ) : false; // phpcs:ignore WordPress.WP.AlternativeFunctions
|
||||
list( $content_score, $matched ) = false !== $content ? self::score_content( $content ) : array( 0, array() );
|
||||
|
||||
if ( $content_score >= self::THRESHOLD_HIGH ) {
|
||||
$final_severity = 'critical';
|
||||
$verdict = 'Its content strongly matches known webshell/backdoor patterns.';
|
||||
} elseif ( $content_score >= self::THRESHOLD_MEDIUM ) {
|
||||
$final_severity = 'high';
|
||||
$verdict = 'Its content contains some patterns also seen in malicious files, though less conclusively.';
|
||||
} else {
|
||||
$final_severity = 'medium';
|
||||
$verdict = 'No suspicious code patterns were found in its content -- it has been quarantined as a precaution because a PHP file in uploads is itself unusual, not because of what it contains.';
|
||||
}
|
||||
|
||||
$result = Argus_Quarantine::quarantine_file(
|
||||
$path,
|
||||
$rel,
|
||||
array(
|
||||
'engine' => 'Argus_Malware_Scanner',
|
||||
'rule' => 'php-in-uploads',
|
||||
'type' => 'signature',
|
||||
'severity' => 'critical',
|
||||
'engine' => 'Argus_Malware_Scanner',
|
||||
'rule' => 'php-in-uploads',
|
||||
'type' => 'signature',
|
||||
'severity' => $final_severity,
|
||||
'content_score' => $content_score,
|
||||
'matched_rules' => wp_list_pluck( $matched, 'id' ),
|
||||
)
|
||||
);
|
||||
$neutralized = false !== $result;
|
||||
|
||||
$finding_id = Argus_Findings::record(
|
||||
'malware',
|
||||
'critical',
|
||||
$final_severity,
|
||||
array(
|
||||
'what_happened' => 'A PHP file was found inside the uploads directory: ' . $rel,
|
||||
'why_it_matters' => 'WordPress does not execute PHP inside wp-content/uploads by design -- a legitimate install should never have PHP files there.',
|
||||
'what_argus_found' => sprintf( 'File: %s, size %s bytes, last modified %s.', $rel, $size, $mtime ),
|
||||
'what_argus_found' => sprintf(
|
||||
'File: %1$s, size %2$s bytes, last modified %3$s. Detection rule "php-in-uploads" matched (location-based, always fires on any .php file here). Content analysis score: %4$d/100%5$s.',
|
||||
$rel,
|
||||
$size,
|
||||
$mtime,
|
||||
$content_score,
|
||||
$matched ? ' (matched: ' . implode( ', ', wp_list_pluck( $matched, 'id' ) ) . ')' : ' (no heuristic patterns matched)'
|
||||
),
|
||||
'when_it_happened' => current_time( 'mysql' ),
|
||||
'why_suspicious' => 'This is one of the most common webshell placement techniques -- uploads directories are usually writable by the web application, unlike wp-admin/wp-includes.',
|
||||
'why_suspicious' => 'This is one of the most common webshell placement techniques -- uploads directories are usually writable by the web application, unlike wp-admin/wp-includes. ' . $verdict,
|
||||
'what_could_be_affected' => 'A PHP file here can be executed directly by visiting its URL, potentially giving an attacker full code execution on your server.',
|
||||
'what_should_you_do' => $neutralized
|
||||
? 'This file has been quarantined -- moved to a protected, non-web-accessible store. Review it on the Quarantine page and decide whether to restore or permanently delete it.'
|
||||
? 'This file has been quarantined -- moved to a protected, non-web-accessible store. Review it on the Quarantine page (its content analysis score is shown there) and decide whether to restore or permanently delete it.'
|
||||
: 'ARGUS detected this file but could not quarantine it (the uploads directory is not writable by PHP on this host, or it is a symlink ARGUS refuses to move automatically). Remove it manually and investigate how it got there.',
|
||||
),
|
||||
array(
|
||||
@@ -178,6 +210,7 @@ class Argus_Malware_Scanner {
|
||||
'file_path' => $rel,
|
||||
'file_mtime' => $mtime,
|
||||
'neutralized' => $neutralized,
|
||||
'content_score' => $content_score,
|
||||
),
|
||||
Argus_Findings::STATUS_OPEN
|
||||
);
|
||||
@@ -196,7 +229,8 @@ class Argus_Malware_Scanner {
|
||||
}
|
||||
|
||||
protected static function scan_recently_changed() {
|
||||
$since = (int) get_option( self::SCAN_WATERMARK_OPTION, time() - HOUR_IN_SECONDS );
|
||||
$since = (int) get_option( self::SCAN_WATERMARK_OPTION, time() - HOUR_IN_SECONDS );
|
||||
$own_dir = wp_normalize_path( ARGUS_WPD_DIR );
|
||||
|
||||
foreach ( array( WP_PLUGIN_DIR, get_theme_root(), ABSPATH . 'wp-admin', ABSPATH . WPINC ) as $dir ) {
|
||||
if ( ! is_dir( $dir ) ) {
|
||||
@@ -210,6 +244,21 @@ class Argus_Malware_Scanner {
|
||||
if ( ! $file->isFile() || 'php' !== strtolower( $file->getExtension() ) ) {
|
||||
continue;
|
||||
}
|
||||
$path = wp_normalize_path( $file->getPathname() );
|
||||
|
||||
// ARGUS never treats its own installed files as a finding about
|
||||
// themselves -- its test fixtures legitimately contain literal
|
||||
// attack-pattern strings (e.g. eval(base64_decode(...)) samples),
|
||||
// and its own WAF/scanner rule definitions legitimately contain
|
||||
// the same keywords as regex source. Genuine tampering with
|
||||
// ARGUS's own code is a different threat model (an already-
|
||||
// compromised server) that a self-scan wouldn't meaningfully
|
||||
// catch anyway. Its own supply-chain integrity is covered by
|
||||
// WordPress.org's review/signing and its own forced self-update.
|
||||
if ( 0 === strpos( $path, $own_dir ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $file->getMTime() < $since ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user