Changeset 3810403
- Timestamp:
- 11/18/2026 11:22:53 PM (less than one hour ago)
- Location:
- sysdoctor
- Files:
-
- 3 edited
- 4 copied
-
tags/1.4.0 (copied) (copied from sysdoctor/trunk )
-
tags/1.4.0/readme.txt (copied) (copied from sysdoctor/trunk/readme.txt ) (5 diffs)
-
tags/1.4.0/sysdoctor.php (copied) (copied from sysdoctor/trunk/sysdoctor.php ) (7 diffs)
-
tags/1.4.0/uninstall.php (copied) (copied from sysdoctor/trunk/uninstall.php ) (1 diff)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/sysdoctor.php (modified) (7 diffs)
-
trunk/uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sysdoctor/tags/1.4.0/readme.txt
r3810319 r3810403 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.2 7 Stable tag: 1. 1.07 Stable tag: 1.4.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 123 123 == Changelog == 124 124 125 = 1.4.0 = 126 * Added a security posture check (XML-RPC, debug flags, registration, file permissions and more) and an administrator audit (admin accounts, last login and detected 2FA plugin). Read-only, metadata only, no outbound call. 127 128 = 1.3.0 = 129 * Added a heuristic malware scan: checks plugin, theme and uploads files for suspicious code signatures (eval, obfuscation, webshell markers, PHP files in uploads) and reports suspects for review. Read-only, bounded, no outbound call. 130 131 = 1.2.0 = 132 * Added a core file integrity check: compares your WordPress core files to the official api.wordpress.org checksums to spot modified or injected files. Gated by a Settings toggle (on by default; turn it off to stay fully outbound-free). 133 * Added reporting of available plugin, theme and core updates (read from WordPress' own update data; no outbound call). 134 125 135 = 1.1.0 = 126 136 * Added a security activity log: records security-relevant events (logins, administrator changes, plugin/theme/option changes) to the plugin's own database table, metadata only, so they appear on your Site Doctor timeline. Removed on uninstall. … … 140 150 == Upgrade Notice == 141 151 152 = 1.4.0 = 153 Adds a security posture check and an administrator audit (read-only, metadata only). 154 155 = 1.3.0 = 156 Adds a heuristic malware scan of plugin, theme and uploads files (read-only, no outbound call). 157 158 = 1.2.0 = 159 Adds a core file integrity check (optional, api.wordpress.org, on by default) and available-updates reporting. 160 142 161 = 1.1.0 = 143 162 Adds a security activity log (own table, metadata only) so your security events reach your Site Doctor timeline. … … 156 175 This plugin connects to the **Site Doctor** monitoring service at https://sitedoctor.syswp.pro. The service is required for the plugin to do anything useful: you opt in by creating a Site Doctor account and pasting the connection key it gives you under **Settings → SysDoctor**. This is the same model as Akismet and other service-connected plugins. 157 176 158 This read-only edition makes **no outbound calls of its own.** It runs no background tasks and never contacts the service on a schedule or on a page load — it only **responds** when the Site Doctorservice sends it an authenticated request.177 This edition makes **no outbound calls of its own**, with one optional exception: the core file integrity check (see "WordPress.org core checksums" below). It runs no background tasks and never contacts the Site Doctor service on a schedule or on a page load — it only **responds** to the Site Doctor service when that service sends it an authenticated request. 159 178 160 179 = Monitoring reads (the service requests, your site responds) = … … 165 184 * **Legal basis:** legitimate interest in site monitoring and security (LGPD Art. 7º IX / GDPR Art. 6(1)(f)). The site owner is the data controller; disclosure guidance is at https://sitedoctor.syswp.pro. 166 185 186 = WordPress.org core checksums (optional, on by default) = 187 188 * **Service:** api.wordpress.org — the official WordPress.org service, the same one WordPress core uses for updates and checksums. 189 * **When:** only when the Site Doctor service requests a core integrity check, and only while the **"Check core file integrity against WordPress.org"** option is enabled under Settings → SysDoctor. It is on by default; turn it off to keep this site fully outbound-free. 190 * **What is sent:** your WordPress version and locale, to fetch the official core file checksums. No site data, credentials or content is sent. The plugin then compares your core files locally and reports which ones differ from the official release. 191 * Terms: https://wordpress.org/about/privacy/ (WordPress.org). 192 167 193 = Service links = 168 194 -
sysdoctor/tags/1.4.0/sysdoctor.php
r3810319 r3810403 4 4 * Plugin URI: https://sitedoctor.syswp.pro 5 5 * Description: Read-only WordPress monitoring: uptime, vulnerable plugins, performance and security changes. Connects to the Site Doctor service — it never writes to your site. 6 * Version: 1. 1.06 * Version: 1.4.0 7 7 * Requires at least: 5.6 8 8 * Requires PHP: 7.2 … … 61 61 62 62 // Keep this in sync with the "Version:" plugin header above on every release. 63 if (!defined('SYSWP_SITE_DOCTOR_VERSION')) define('SYSWP_SITE_DOCTOR_VERSION', '1. 1.0');63 if (!defined('SYSWP_SITE_DOCTOR_VERSION')) define('SYSWP_SITE_DOCTOR_VERSION', '1.4.0'); 64 64 65 65 const SYSWP_SITE_DOCTOR_MAX_BODY = 1048576; // 1 MB max request body … … 207 207 case 'ah_events': return self::op_ah_events($params); 208 208 case 'ah_pagespeed': return self::op_ah_pagespeed(); 209 // ── R2: core integrity (toggle) + available updates ───────────── 210 case 'core_integrity': return self::op_core_integrity(); 211 case 'updates': return self::op_updates(); 212 // ── R3: heuristic malware signature scan ──────────────────────── 213 case 'files_scan': return self::op_files_scan($params); 214 // ── R4: security posture + administrator audit ────────────────── 215 case 'security_posture': return self::op_security_posture(); 216 case 'user_audit': return self::op_user_audit(); 209 217 default: 210 218 throw new \RuntimeException('unknown_op: ' . esc_html($op)); … … 1387 1395 // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.SlowDBQuery.slow_db_query_meta_key, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, PluginCheck.Security.DirectDB.UnescapedDBParameter 1388 1396 1397 // ─── core_integrity (R2-A) ─────────────────────────────────────────── 1398 /** 1399 * Compare WordPress core files to the official checksums. This is the ONE 1400 * operation that reaches outside the site: it asks api.wordpress.org (the 1401 * same service WordPress core itself uses) for the release checksums. It is 1402 * gated by a per-site toggle (default on) that the admin can switch off to 1403 * keep the site fully outbound-free. It reads core files to hash them and 1404 * changes nothing. 1405 */ 1406 private static function op_core_integrity(): array 1407 { 1408 if (get_option('syswp_site_doctor_core_check', '1') !== '1') { 1409 return ['enabled' => false, 'note' => "Core integrity check is turned off in this site's SysDoctor settings."]; 1410 } 1411 global $wp_version; 1412 require_once ABSPATH . 'wp-admin/includes/update.php'; 1413 if (! function_exists('get_core_checksums')) { 1414 return ['enabled' => true, 'error' => 'checksums_unavailable']; 1415 } 1416 $locale = function_exists('get_locale') ? get_locale() : 'en_US'; 1417 // Silence any HTTP/SSL notice from the remote call so it can never pollute the 1418 // JSON probe response on a site that has WP_DEBUG_DISPLAY on. 1419 $checksums = @get_core_checksums($wp_version, $locale); 1420 if (! is_array($checksums) && $locale !== 'en_US') { 1421 $checksums = @get_core_checksums($wp_version, 'en_US'); // some locales ship no manifest 1422 } 1423 if (! is_array($checksums) || ! $checksums) { 1424 return ['enabled' => true, 'error' => 'checksums_fetch_failed', 'wp_version' => $wp_version, 'locale' => $locale, 1425 'note' => 'Could not reach api.wordpress.org for this version/locale.']; 1426 } 1427 $cap = 500; 1428 $modified = []; $missing = []; $modCount = 0; $missCount = 0; 1429 foreach ($checksums as $file => $md5) { 1430 $path = ABSPATH . $file; 1431 if (! file_exists($path)) { 1432 $missCount++; 1433 if (count($missing) < $cap) { $missing[] = $file; } 1434 continue; 1435 } 1436 if (@md5_file($path) !== $md5) { 1437 $modCount++; 1438 if (count($modified) < $cap) { $modified[] = $file; } 1439 } 1440 } 1441 return [ 1442 'enabled' => true, 1443 'wp_version' => $wp_version, 1444 'locale' => $locale, 1445 'files_checked' => count($checksums), 1446 'modified' => $modified, 1447 'modified_count' => $modCount, 1448 'missing' => $missing, 1449 'missing_count' => $missCount, 1450 'truncated' => ($modCount > $cap || $missCount > $cap), 1451 'source' => 'api.wordpress.org', 1452 'note' => 'Core files whose MD5 differs from the official WordPress release (modified) or are absent (missing). Checksums from api.wordpress.org.', 1453 ]; 1454 } 1455 1456 // ─── updates (R2-B) ────────────────────────────────────────────────── 1457 /** Available plugin/theme/core updates, read from WordPress' own update transients. No outbound call. */ 1458 private static function op_updates(): array 1459 { 1460 $plugins = function_exists('get_site_transient') ? get_site_transient('update_plugins') : null; 1461 $themes = function_exists('get_site_transient') ? get_site_transient('update_themes') : null; 1462 $core = function_exists('get_site_transient') ? get_site_transient('update_core') : null; 1463 1464 $pluginUpdates = []; 1465 if (is_object($plugins) && ! empty($plugins->response) && is_array($plugins->response)) { 1466 if (! function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } 1467 $all = get_plugins(); 1468 foreach ($plugins->response as $file => $data) { 1469 $pluginUpdates[] = [ 1470 'file' => (string) $file, 1471 'name' => $all[$file]['Name'] ?? (string) $file, 1472 'current' => $all[$file]['Version'] ?? '', 1473 'new_version' => is_object($data) ? (string) ($data->new_version ?? '') : '', 1474 ]; 1475 } 1476 } 1477 $themeUpdates = []; 1478 if (is_object($themes) && ! empty($themes->response) && is_array($themes->response)) { 1479 foreach ($themes->response as $slug => $data) { 1480 $new = is_array($data) ? ($data['new_version'] ?? '') : (is_object($data) ? ($data->new_version ?? '') : ''); 1481 $themeUpdates[] = ['slug' => (string) $slug, 'new_version' => (string) $new]; 1482 } 1483 } 1484 $coreUpdate = null; 1485 if (is_object($core) && ! empty($core->updates) && is_array($core->updates)) { 1486 $u = $core->updates[0] ?? null; 1487 if (is_object($u) && ($u->response ?? '') === 'upgrade') { 1488 $coreUpdate = [ 1489 'current' => (string) ($GLOBALS['wp_version'] ?? get_bloginfo('version')), 1490 'new_version' => (string) ($u->current ?? ''), 1491 ]; 1492 } 1493 } 1494 return [ 1495 'plugins' => $pluginUpdates, 1496 'plugin_count' => count($pluginUpdates), 1497 'themes' => $themeUpdates, 1498 'theme_count' => count($themeUpdates), 1499 'core' => $coreUpdate, 1500 'last_checked' => is_object($plugins) ? ($plugins->last_checked ?? null) : null, 1501 'note' => "Read from WordPress' own update transients (no outbound call). current vs new_version.", 1502 ]; 1503 } 1504 1505 // ─── files_scan (R3) ───────────────────────────────────────────────── 1506 /** 1507 * Heuristic malware signature scan of plugins, themes and uploads — the 1508 * same idea as a security scanner. Read-only: it reads files to match known 1509 * patterns and reports suspects + the signature; it changes nothing. Bounded 1510 * by file count and wall-clock so the Site Doctor service can trigger it 1511 * without hanging the request. Snippets returned are the matched code only; 1512 * no wp-config, credentials or content is returned. 1513 */ 1514 private static function op_files_scan(array $p): array 1515 { 1516 $started = microtime(true); 1517 $maxFiles = min(20000, max(100, (int) ($p['max_files'] ?? 8000))); 1518 $maxSeconds = min(25, max(3, (int) ($p['max_seconds'] ?? 15))); 1519 $maxBytes = 2 * 1024 * 1024; // skip files larger than 2 MB 1520 $hitCap = 300; 1521 1522 $roots = []; 1523 if (defined('WP_PLUGIN_DIR')) { $roots['plugins'] = WP_PLUGIN_DIR; } 1524 if (function_exists('get_theme_root')) { $roots['themes'] = get_theme_root(); } 1525 $up = function_exists('wp_upload_dir') ? wp_upload_dir(null, false) : null; 1526 if (is_array($up) && ! empty($up['basedir'])) { $roots['uploads'] = $up['basedir']; } 1527 if (! empty($p['root']) && isset($roots[(string) $p['root']])) { 1528 $roots = [(string) $p['root'] => $roots[(string) $p['root']]]; 1529 } 1530 1531 // Malware signatures (name => case-insensitive regex). Curated, scanner-style. 1532 $sigs = [ 1533 'eval_encoded' => 'eval\s*\(\s*(base64_decode|gzinflate|gzuncompress|str_rot13|rawurldecode)', 1534 'eval_request' => 'eval\s*\(\s*\$_(POST|GET|REQUEST|COOKIE|SERVER)', 1535 'eval' => '\beval\s*\(', 1536 'assert_dynamic' => '\bassert\s*\(\s*[\'"$]', 1537 'create_function' => '\bcreate_function\s*\(', 1538 'system_exec' => '\b(shell_exec|passthru|proc_open|popen|pcntl_exec)\s*\(', 1539 'preg_replace_e' => 'preg_replace\s*\(\s*[\'"][^\'"]*/[a-z]*e[a-z]*[\'"]', 1540 'request_callback' => '\$_(POST|GET|REQUEST|COOKIE)\s*\[[^\]]{1,40}\]\s*\(', 1541 'webshell_marker' => '(c99shell|r57shell|b374k|FilesMan|phpspy|wso\.?shell|\bWSO\b\s*[0-9.]|GIF89a\s*<\?php)', 1542 'obfuscation_hex' => '(\\\\x[0-9a-f]{2}){10,}', 1543 'long_base64' => '[\'"][A-Za-z0-9+/]{300,}={0,2}[\'"]', 1544 'suspicious_tld' => 'https?://[^\'"\s]+\.(lol|icu|xyz|top|click|rest|cyou)\b', 1545 ]; 1546 1547 $hits = []; $scanned = 0; $capped = false; 1548 foreach ($roots as $label => $dir) { 1549 if (! is_dir($dir)) { continue; } 1550 $isUpload = ($label === 'uploads'); 1551 try { 1552 $it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS)); 1553 foreach ($it as $f) { 1554 if (! $f->isFile()) { continue; } 1555 $ext = strtolower($f->getExtension()); 1556 $phpish = in_array($ext, ['php', 'php5', 'php7', 'phtml', 'phar', 'pht', 'inc'], true); 1557 // plugins/themes: only PHP files. uploads: only PHP-ish files (should not exist there). 1558 if (! $phpish) { continue; } 1559 if (++$scanned > $maxFiles || (microtime(true) - $started) > $maxSeconds) { $capped = true; break 2; } 1560 // A PHP file living in uploads is itself a finding. 1561 if ($isUpload) { 1562 $hits[] = ['type' => 'php_in_uploads', 'root' => $label, 'file' => self::relpath($f->getPathname()), 'line' => 0, 'snippet' => '']; 1563 if (count($hits) >= $hitCap) { $capped = true; break 2; } 1564 } 1565 if ($f->getSize() > $maxBytes) { continue; } 1566 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- reading a local plugin/theme/upload file to match malware signatures (read-only scan) 1567 $code = @file_get_contents($f->getPathname()); 1568 if ($code === false) { continue; } 1569 foreach ($sigs as $sname => $re) { 1570 if (preg_match('#' . $re . '#i', $code, $m, PREG_OFFSET_CAPTURE)) { 1571 $off = $m[0][1]; 1572 $line = substr_count(substr($code, 0, $off), "\n") + 1; 1573 $hits[] = [ 1574 'type' => $sname, 1575 'root' => $label, 1576 'file' => self::relpath($f->getPathname()), 1577 'line' => $line, 1578 'snippet' => trim(substr($code, max(0, $off - 8), 80)), 1579 ]; 1580 if (count($hits) >= $hitCap) { $capped = true; break 3; } 1581 } 1582 } 1583 } 1584 } catch (\Throwable $e) { /* best-effort traversal */ } 1585 } 1586 1587 $byType = []; 1588 foreach ($hits as $h) { $byType[$h['type']] = ($byType[$h['type']] ?? 0) + 1; } 1589 arsort($byType); 1590 1591 return [ 1592 'roots' => array_keys($roots), 1593 'files_scanned' => $scanned, 1594 'elapsed_ms' => (int) round((microtime(true) - $started) * 1000), 1595 'capped' => $capped, 1596 'hit_count' => count($hits), 1597 'by_type' => $byType, 1598 'hits' => $hits, 1599 'note' => 'Heuristic signature scan of plugins/themes/uploads. Hits are suspicious patterns (eval, obfuscation, webshell markers, PHP files in uploads), not confirmed malware — review each. Snippets are the matched code context only; no wp-config, credentials or content is returned.', 1600 ]; 1601 } 1602 1603 // ─── security_posture (R4-D) ───────────────────────────────────────── 1604 /** Read-only security posture: config flags, options and file permissions that affect hardening. */ 1605 private static function op_security_posture(): array 1606 { 1607 $siteurl = (string) get_option('siteurl'); 1608 $up = function_exists('wp_upload_dir') ? wp_upload_dir(null, false) : null; 1609 $upbase = (is_array($up) && ! empty($up['basedir'])) ? $up['basedir'] : ''; 1610 $wpconfig = ABSPATH . 'wp-config.php'; 1611 $htaccess = ABSPATH . '.htaccess'; 1612 $cfgPerms = file_exists($wpconfig) ? (int) @fileperms($wpconfig) : null; 1613 1614 $checks = [ 1615 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- reading WordPress core's own 'xmlrpc_enabled' filter to report its state, not defining a custom hook 1616 'xmlrpc_enabled' => function_exists('apply_filters') ? (bool) apply_filters('xmlrpc_enabled', true) : true, 1617 'users_can_register' => (bool) get_option('users_can_register'), 1618 'default_role' => (string) get_option('default_role'), 1619 'wp_debug' => defined('WP_DEBUG') && WP_DEBUG, 1620 'wp_debug_display' => defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY, 1621 'disallow_file_edit' => defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT, 1622 'disallow_file_mods' => defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS, 1623 'force_ssl_admin' => function_exists('force_ssl_admin') ? (bool) force_ssl_admin() : (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN), 1624 'site_is_https' => strpos($siteurl, 'https://') === 0, 1625 'wp_config_perms' => $cfgPerms !== null ? substr(sprintf('%o', $cfgPerms), -4) : null, 1626 'wp_config_world_readable' => $cfgPerms !== null ? (bool) ($cfgPerms & 0x0004) : null, 1627 'htaccess_present' => file_exists($htaccess), 1628 'uploads_exec_guard' => $upbase !== '' ? (file_exists($upbase . '/index.php') || file_exists($upbase . '/.htaccess')) : null, 1629 'admin_user_exists' => function_exists('get_user_by') ? (bool) get_user_by('login', 'admin') : null, 1630 ]; 1631 1632 $concerns = []; 1633 if ($checks['users_can_register'] && in_array(strtolower($checks['default_role']), ['administrator', 'editor'], true)) { 1634 $concerns[] = 'open_registration_privileged_role'; 1635 } 1636 if ($checks['wp_debug_display']) { $concerns[] = 'debug_display_on'; } 1637 if ($checks['wp_config_world_readable'] === true) { $concerns[] = 'wp_config_world_readable'; } 1638 if (! $checks['site_is_https']) { $concerns[] = 'site_not_https'; } 1639 if ($checks['admin_user_exists'] === true) { $concerns[] = 'default_admin_username'; } 1640 1641 return [ 1642 'checks' => $checks, 1643 'concerns' => $concerns, 1644 'note' => "Read-only posture from this site's config, options and file permissions. REST user-enumeration, directory listing and XML-RPC reachability are best confirmed by Site Doctor's external scan.", 1645 ]; 1646 } 1647 1648 // ─── user_audit (R4-E) ─────────────────────────────────────────────── 1649 /** Administrator roster: logins, email domains, registration, last login and 2FA where a known plugin exposes it. Metadata only. */ 1650 private static function op_user_audit(): array 1651 { 1652 if (! function_exists('get_users')) { 1653 return ['error' => 'users_unavailable']; 1654 } 1655 $active = (array) get_option('active_plugins', []); 1656 $twofa = null; 1657 foreach ([ 1658 'two-factor/two-factor.php' => 'two-factor', 1659 'wordfence-login-security/wordfence-login-security.php' => 'wordfence-login-security', 1660 'wordfence/wordfence.php' => 'wordfence', 1661 'miniorange-2-factor-authentication/miniorange_2_factor_settings.php' => 'miniorange-2fa', 1662 'google-authenticator/google-authenticator.php' => 'google-authenticator', 1663 ] as $file => $name) { 1664 if (in_array($file, $active, true)) { $twofa = $name; break; } 1665 } 1666 1667 $admins = get_users(['role' => 'administrator', 'number' => 500, 'fields' => ['ID', 'user_login', 'user_email', 'user_registered']]); 1668 $list = []; 1669 foreach ($admins as $u) { 1670 $last = null; 1671 foreach (['last_login', 'wfls-last-login', 'last_active', '_last_login'] as $k) { 1672 $v = function_exists('get_user_meta') ? get_user_meta($u->ID, $k, true) : ''; 1673 if ($v !== '' && is_numeric($v)) { $last = gmdate('Y-m-d H:i:s', (int) $v); break; } 1674 } 1675 $list[] = [ 1676 'id' => (int) $u->ID, 1677 'login' => $u->user_login, 1678 'email_domain' => ltrim((string) strrchr((string) $u->user_email, '@'), '@'), 1679 'registered' => $u->user_registered, 1680 'last_login' => $last, 1681 ]; 1682 } 1683 return [ 1684 'admin_count' => count($list), 1685 'admins' => $list, 1686 '2fa_plugin' => $twofa, 1687 'note' => 'Administrator accounts, metadata only (login, email DOMAIN, registration, last login if a plugin records it). 2fa_plugin names a detected active 2FA plugin; per-user 2FA status is not uniformly exposed.', 1688 ]; 1689 } 1690 1389 1691 // ════════════════════════════════════════════════════════════════════ 1390 1692 // HMAC AUTH … … 1682 1984 } 1683 1985 wp_safe_redirect(admin_url('options-general.php?page=syswp-site-doctor&m=disc')); 1986 exit; 1987 }); 1988 1989 // Save the per-site settings (currently: the core-integrity outbound toggle). 1990 add_action('admin_post_syswp_site_doctor_settings', function () { 1991 if (!current_user_can('manage_options') || !check_admin_referer('syswp_site_doctor_settings')) { 1992 wp_die('Not allowed'); 1993 } 1994 update_option('syswp_site_doctor_core_check', isset($_POST['core_check']) ? '1' : '0', false); 1995 wp_safe_redirect(admin_url('options-general.php?page=syswp-site-doctor&m=saved')); 1684 1996 exit; 1685 1997 }); … … 1785 2097 if ($m === 'bad') echo '<div class="notice notice-error is-dismissible"><p>Invalid key. Copy it again from Site Doctor.</p></div>'; 1786 2098 if ($m === 'disc') echo '<div class="notice notice-warning is-dismissible"><p>Disconnected. This site no longer responds to Site Doctor.</p></div>'; 2099 if ($m === 'saved') echo '<div class="notice notice-success is-dismissible"><p>Settings saved.</p></div>'; 1787 2100 1788 2101 if ($connected) { … … 1795 2108 echo '<p style="margin:8px 0 0;color:#777;font-size:12px">Version <code>' . esc_html(SYSWP_SITE_DOCTOR_VERSION) . '</code> · read-only monitoring. Your connection key is stored securely and does not need to be shown again. Updates arrive through WordPress.org.</p>'; 1796 2109 echo '</div>'; 2110 // Core-integrity toggle (R2-A): the only feature that makes an outbound call (to api.wordpress.org). 2111 $coreCheck = get_option('syswp_site_doctor_core_check', '1') === '1'; 2112 echo '<form method="post" action="' . esc_url(admin_url('admin-post.php')) . '" style="max-width:640px;margin:0 0 18px">'; 2113 wp_nonce_field('syswp_site_doctor_settings'); 2114 echo '<input type="hidden" name="action" value="syswp_site_doctor_settings">'; 2115 echo '<label style="display:flex;align-items:flex-start;gap:8px">'; 2116 echo '<input type="checkbox" name="core_check" value="1"' . checked($coreCheck, true, false) . ' style="margin-top:3px">'; 2117 echo '<span><strong>Check core file integrity against WordPress.org</strong><br><span style="color:#777;font-size:12.5px">When on, Site Doctor can compare your WordPress core files to the official checksums from <code>api.wordpress.org</code> to spot modified or injected files. Turn this off to keep this site fully outbound-free.</span></span></label>'; 2118 echo '<p style="margin:8px 0 0"><button class="button">Save settings</button></p></form>'; 1797 2119 // Disconnect 1798 2120 echo '<form id="sysdoctor-disconnect-form" method="post" action="' . esc_url(admin_url('admin-post.php')) . '" style="display:inline-block;margin:0 0 20px">'; -
sysdoctor/tags/1.4.0/uninstall.php
r3810319 r3810403 21 21 'syswp_site_doctor_group_name', 22 22 'syswp_site_doctor_db_version', 23 'syswp_site_doctor_core_check', 23 24 ]; 24 25 -
sysdoctor/trunk/readme.txt
r3810319 r3810403 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.2 7 Stable tag: 1. 1.07 Stable tag: 1.4.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 123 123 == Changelog == 124 124 125 = 1.4.0 = 126 * Added a security posture check (XML-RPC, debug flags, registration, file permissions and more) and an administrator audit (admin accounts, last login and detected 2FA plugin). Read-only, metadata only, no outbound call. 127 128 = 1.3.0 = 129 * Added a heuristic malware scan: checks plugin, theme and uploads files for suspicious code signatures (eval, obfuscation, webshell markers, PHP files in uploads) and reports suspects for review. Read-only, bounded, no outbound call. 130 131 = 1.2.0 = 132 * Added a core file integrity check: compares your WordPress core files to the official api.wordpress.org checksums to spot modified or injected files. Gated by a Settings toggle (on by default; turn it off to stay fully outbound-free). 133 * Added reporting of available plugin, theme and core updates (read from WordPress' own update data; no outbound call). 134 125 135 = 1.1.0 = 126 136 * Added a security activity log: records security-relevant events (logins, administrator changes, plugin/theme/option changes) to the plugin's own database table, metadata only, so they appear on your Site Doctor timeline. Removed on uninstall. … … 140 150 == Upgrade Notice == 141 151 152 = 1.4.0 = 153 Adds a security posture check and an administrator audit (read-only, metadata only). 154 155 = 1.3.0 = 156 Adds a heuristic malware scan of plugin, theme and uploads files (read-only, no outbound call). 157 158 = 1.2.0 = 159 Adds a core file integrity check (optional, api.wordpress.org, on by default) and available-updates reporting. 160 142 161 = 1.1.0 = 143 162 Adds a security activity log (own table, metadata only) so your security events reach your Site Doctor timeline. … … 156 175 This plugin connects to the **Site Doctor** monitoring service at https://sitedoctor.syswp.pro. The service is required for the plugin to do anything useful: you opt in by creating a Site Doctor account and pasting the connection key it gives you under **Settings → SysDoctor**. This is the same model as Akismet and other service-connected plugins. 157 176 158 This read-only edition makes **no outbound calls of its own.** It runs no background tasks and never contacts the service on a schedule or on a page load — it only **responds** when the Site Doctorservice sends it an authenticated request.177 This edition makes **no outbound calls of its own**, with one optional exception: the core file integrity check (see "WordPress.org core checksums" below). It runs no background tasks and never contacts the Site Doctor service on a schedule or on a page load — it only **responds** to the Site Doctor service when that service sends it an authenticated request. 159 178 160 179 = Monitoring reads (the service requests, your site responds) = … … 165 184 * **Legal basis:** legitimate interest in site monitoring and security (LGPD Art. 7º IX / GDPR Art. 6(1)(f)). The site owner is the data controller; disclosure guidance is at https://sitedoctor.syswp.pro. 166 185 186 = WordPress.org core checksums (optional, on by default) = 187 188 * **Service:** api.wordpress.org — the official WordPress.org service, the same one WordPress core uses for updates and checksums. 189 * **When:** only when the Site Doctor service requests a core integrity check, and only while the **"Check core file integrity against WordPress.org"** option is enabled under Settings → SysDoctor. It is on by default; turn it off to keep this site fully outbound-free. 190 * **What is sent:** your WordPress version and locale, to fetch the official core file checksums. No site data, credentials or content is sent. The plugin then compares your core files locally and reports which ones differ from the official release. 191 * Terms: https://wordpress.org/about/privacy/ (WordPress.org). 192 167 193 = Service links = 168 194 -
sysdoctor/trunk/sysdoctor.php
r3810319 r3810403 4 4 * Plugin URI: https://sitedoctor.syswp.pro 5 5 * Description: Read-only WordPress monitoring: uptime, vulnerable plugins, performance and security changes. Connects to the Site Doctor service — it never writes to your site. 6 * Version: 1. 1.06 * Version: 1.4.0 7 7 * Requires at least: 5.6 8 8 * Requires PHP: 7.2 … … 61 61 62 62 // Keep this in sync with the "Version:" plugin header above on every release. 63 if (!defined('SYSWP_SITE_DOCTOR_VERSION')) define('SYSWP_SITE_DOCTOR_VERSION', '1. 1.0');63 if (!defined('SYSWP_SITE_DOCTOR_VERSION')) define('SYSWP_SITE_DOCTOR_VERSION', '1.4.0'); 64 64 65 65 const SYSWP_SITE_DOCTOR_MAX_BODY = 1048576; // 1 MB max request body … … 207 207 case 'ah_events': return self::op_ah_events($params); 208 208 case 'ah_pagespeed': return self::op_ah_pagespeed(); 209 // ── R2: core integrity (toggle) + available updates ───────────── 210 case 'core_integrity': return self::op_core_integrity(); 211 case 'updates': return self::op_updates(); 212 // ── R3: heuristic malware signature scan ──────────────────────── 213 case 'files_scan': return self::op_files_scan($params); 214 // ── R4: security posture + administrator audit ────────────────── 215 case 'security_posture': return self::op_security_posture(); 216 case 'user_audit': return self::op_user_audit(); 209 217 default: 210 218 throw new \RuntimeException('unknown_op: ' . esc_html($op)); … … 1387 1395 // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.SlowDBQuery.slow_db_query_meta_key, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, PluginCheck.Security.DirectDB.UnescapedDBParameter 1388 1396 1397 // ─── core_integrity (R2-A) ─────────────────────────────────────────── 1398 /** 1399 * Compare WordPress core files to the official checksums. This is the ONE 1400 * operation that reaches outside the site: it asks api.wordpress.org (the 1401 * same service WordPress core itself uses) for the release checksums. It is 1402 * gated by a per-site toggle (default on) that the admin can switch off to 1403 * keep the site fully outbound-free. It reads core files to hash them and 1404 * changes nothing. 1405 */ 1406 private static function op_core_integrity(): array 1407 { 1408 if (get_option('syswp_site_doctor_core_check', '1') !== '1') { 1409 return ['enabled' => false, 'note' => "Core integrity check is turned off in this site's SysDoctor settings."]; 1410 } 1411 global $wp_version; 1412 require_once ABSPATH . 'wp-admin/includes/update.php'; 1413 if (! function_exists('get_core_checksums')) { 1414 return ['enabled' => true, 'error' => 'checksums_unavailable']; 1415 } 1416 $locale = function_exists('get_locale') ? get_locale() : 'en_US'; 1417 // Silence any HTTP/SSL notice from the remote call so it can never pollute the 1418 // JSON probe response on a site that has WP_DEBUG_DISPLAY on. 1419 $checksums = @get_core_checksums($wp_version, $locale); 1420 if (! is_array($checksums) && $locale !== 'en_US') { 1421 $checksums = @get_core_checksums($wp_version, 'en_US'); // some locales ship no manifest 1422 } 1423 if (! is_array($checksums) || ! $checksums) { 1424 return ['enabled' => true, 'error' => 'checksums_fetch_failed', 'wp_version' => $wp_version, 'locale' => $locale, 1425 'note' => 'Could not reach api.wordpress.org for this version/locale.']; 1426 } 1427 $cap = 500; 1428 $modified = []; $missing = []; $modCount = 0; $missCount = 0; 1429 foreach ($checksums as $file => $md5) { 1430 $path = ABSPATH . $file; 1431 if (! file_exists($path)) { 1432 $missCount++; 1433 if (count($missing) < $cap) { $missing[] = $file; } 1434 continue; 1435 } 1436 if (@md5_file($path) !== $md5) { 1437 $modCount++; 1438 if (count($modified) < $cap) { $modified[] = $file; } 1439 } 1440 } 1441 return [ 1442 'enabled' => true, 1443 'wp_version' => $wp_version, 1444 'locale' => $locale, 1445 'files_checked' => count($checksums), 1446 'modified' => $modified, 1447 'modified_count' => $modCount, 1448 'missing' => $missing, 1449 'missing_count' => $missCount, 1450 'truncated' => ($modCount > $cap || $missCount > $cap), 1451 'source' => 'api.wordpress.org', 1452 'note' => 'Core files whose MD5 differs from the official WordPress release (modified) or are absent (missing). Checksums from api.wordpress.org.', 1453 ]; 1454 } 1455 1456 // ─── updates (R2-B) ────────────────────────────────────────────────── 1457 /** Available plugin/theme/core updates, read from WordPress' own update transients. No outbound call. */ 1458 private static function op_updates(): array 1459 { 1460 $plugins = function_exists('get_site_transient') ? get_site_transient('update_plugins') : null; 1461 $themes = function_exists('get_site_transient') ? get_site_transient('update_themes') : null; 1462 $core = function_exists('get_site_transient') ? get_site_transient('update_core') : null; 1463 1464 $pluginUpdates = []; 1465 if (is_object($plugins) && ! empty($plugins->response) && is_array($plugins->response)) { 1466 if (! function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } 1467 $all = get_plugins(); 1468 foreach ($plugins->response as $file => $data) { 1469 $pluginUpdates[] = [ 1470 'file' => (string) $file, 1471 'name' => $all[$file]['Name'] ?? (string) $file, 1472 'current' => $all[$file]['Version'] ?? '', 1473 'new_version' => is_object($data) ? (string) ($data->new_version ?? '') : '', 1474 ]; 1475 } 1476 } 1477 $themeUpdates = []; 1478 if (is_object($themes) && ! empty($themes->response) && is_array($themes->response)) { 1479 foreach ($themes->response as $slug => $data) { 1480 $new = is_array($data) ? ($data['new_version'] ?? '') : (is_object($data) ? ($data->new_version ?? '') : ''); 1481 $themeUpdates[] = ['slug' => (string) $slug, 'new_version' => (string) $new]; 1482 } 1483 } 1484 $coreUpdate = null; 1485 if (is_object($core) && ! empty($core->updates) && is_array($core->updates)) { 1486 $u = $core->updates[0] ?? null; 1487 if (is_object($u) && ($u->response ?? '') === 'upgrade') { 1488 $coreUpdate = [ 1489 'current' => (string) ($GLOBALS['wp_version'] ?? get_bloginfo('version')), 1490 'new_version' => (string) ($u->current ?? ''), 1491 ]; 1492 } 1493 } 1494 return [ 1495 'plugins' => $pluginUpdates, 1496 'plugin_count' => count($pluginUpdates), 1497 'themes' => $themeUpdates, 1498 'theme_count' => count($themeUpdates), 1499 'core' => $coreUpdate, 1500 'last_checked' => is_object($plugins) ? ($plugins->last_checked ?? null) : null, 1501 'note' => "Read from WordPress' own update transients (no outbound call). current vs new_version.", 1502 ]; 1503 } 1504 1505 // ─── files_scan (R3) ───────────────────────────────────────────────── 1506 /** 1507 * Heuristic malware signature scan of plugins, themes and uploads — the 1508 * same idea as a security scanner. Read-only: it reads files to match known 1509 * patterns and reports suspects + the signature; it changes nothing. Bounded 1510 * by file count and wall-clock so the Site Doctor service can trigger it 1511 * without hanging the request. Snippets returned are the matched code only; 1512 * no wp-config, credentials or content is returned. 1513 */ 1514 private static function op_files_scan(array $p): array 1515 { 1516 $started = microtime(true); 1517 $maxFiles = min(20000, max(100, (int) ($p['max_files'] ?? 8000))); 1518 $maxSeconds = min(25, max(3, (int) ($p['max_seconds'] ?? 15))); 1519 $maxBytes = 2 * 1024 * 1024; // skip files larger than 2 MB 1520 $hitCap = 300; 1521 1522 $roots = []; 1523 if (defined('WP_PLUGIN_DIR')) { $roots['plugins'] = WP_PLUGIN_DIR; } 1524 if (function_exists('get_theme_root')) { $roots['themes'] = get_theme_root(); } 1525 $up = function_exists('wp_upload_dir') ? wp_upload_dir(null, false) : null; 1526 if (is_array($up) && ! empty($up['basedir'])) { $roots['uploads'] = $up['basedir']; } 1527 if (! empty($p['root']) && isset($roots[(string) $p['root']])) { 1528 $roots = [(string) $p['root'] => $roots[(string) $p['root']]]; 1529 } 1530 1531 // Malware signatures (name => case-insensitive regex). Curated, scanner-style. 1532 $sigs = [ 1533 'eval_encoded' => 'eval\s*\(\s*(base64_decode|gzinflate|gzuncompress|str_rot13|rawurldecode)', 1534 'eval_request' => 'eval\s*\(\s*\$_(POST|GET|REQUEST|COOKIE|SERVER)', 1535 'eval' => '\beval\s*\(', 1536 'assert_dynamic' => '\bassert\s*\(\s*[\'"$]', 1537 'create_function' => '\bcreate_function\s*\(', 1538 'system_exec' => '\b(shell_exec|passthru|proc_open|popen|pcntl_exec)\s*\(', 1539 'preg_replace_e' => 'preg_replace\s*\(\s*[\'"][^\'"]*/[a-z]*e[a-z]*[\'"]', 1540 'request_callback' => '\$_(POST|GET|REQUEST|COOKIE)\s*\[[^\]]{1,40}\]\s*\(', 1541 'webshell_marker' => '(c99shell|r57shell|b374k|FilesMan|phpspy|wso\.?shell|\bWSO\b\s*[0-9.]|GIF89a\s*<\?php)', 1542 'obfuscation_hex' => '(\\\\x[0-9a-f]{2}){10,}', 1543 'long_base64' => '[\'"][A-Za-z0-9+/]{300,}={0,2}[\'"]', 1544 'suspicious_tld' => 'https?://[^\'"\s]+\.(lol|icu|xyz|top|click|rest|cyou)\b', 1545 ]; 1546 1547 $hits = []; $scanned = 0; $capped = false; 1548 foreach ($roots as $label => $dir) { 1549 if (! is_dir($dir)) { continue; } 1550 $isUpload = ($label === 'uploads'); 1551 try { 1552 $it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS)); 1553 foreach ($it as $f) { 1554 if (! $f->isFile()) { continue; } 1555 $ext = strtolower($f->getExtension()); 1556 $phpish = in_array($ext, ['php', 'php5', 'php7', 'phtml', 'phar', 'pht', 'inc'], true); 1557 // plugins/themes: only PHP files. uploads: only PHP-ish files (should not exist there). 1558 if (! $phpish) { continue; } 1559 if (++$scanned > $maxFiles || (microtime(true) - $started) > $maxSeconds) { $capped = true; break 2; } 1560 // A PHP file living in uploads is itself a finding. 1561 if ($isUpload) { 1562 $hits[] = ['type' => 'php_in_uploads', 'root' => $label, 'file' => self::relpath($f->getPathname()), 'line' => 0, 'snippet' => '']; 1563 if (count($hits) >= $hitCap) { $capped = true; break 2; } 1564 } 1565 if ($f->getSize() > $maxBytes) { continue; } 1566 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- reading a local plugin/theme/upload file to match malware signatures (read-only scan) 1567 $code = @file_get_contents($f->getPathname()); 1568 if ($code === false) { continue; } 1569 foreach ($sigs as $sname => $re) { 1570 if (preg_match('#' . $re . '#i', $code, $m, PREG_OFFSET_CAPTURE)) { 1571 $off = $m[0][1]; 1572 $line = substr_count(substr($code, 0, $off), "\n") + 1; 1573 $hits[] = [ 1574 'type' => $sname, 1575 'root' => $label, 1576 'file' => self::relpath($f->getPathname()), 1577 'line' => $line, 1578 'snippet' => trim(substr($code, max(0, $off - 8), 80)), 1579 ]; 1580 if (count($hits) >= $hitCap) { $capped = true; break 3; } 1581 } 1582 } 1583 } 1584 } catch (\Throwable $e) { /* best-effort traversal */ } 1585 } 1586 1587 $byType = []; 1588 foreach ($hits as $h) { $byType[$h['type']] = ($byType[$h['type']] ?? 0) + 1; } 1589 arsort($byType); 1590 1591 return [ 1592 'roots' => array_keys($roots), 1593 'files_scanned' => $scanned, 1594 'elapsed_ms' => (int) round((microtime(true) - $started) * 1000), 1595 'capped' => $capped, 1596 'hit_count' => count($hits), 1597 'by_type' => $byType, 1598 'hits' => $hits, 1599 'note' => 'Heuristic signature scan of plugins/themes/uploads. Hits are suspicious patterns (eval, obfuscation, webshell markers, PHP files in uploads), not confirmed malware — review each. Snippets are the matched code context only; no wp-config, credentials or content is returned.', 1600 ]; 1601 } 1602 1603 // ─── security_posture (R4-D) ───────────────────────────────────────── 1604 /** Read-only security posture: config flags, options and file permissions that affect hardening. */ 1605 private static function op_security_posture(): array 1606 { 1607 $siteurl = (string) get_option('siteurl'); 1608 $up = function_exists('wp_upload_dir') ? wp_upload_dir(null, false) : null; 1609 $upbase = (is_array($up) && ! empty($up['basedir'])) ? $up['basedir'] : ''; 1610 $wpconfig = ABSPATH . 'wp-config.php'; 1611 $htaccess = ABSPATH . '.htaccess'; 1612 $cfgPerms = file_exists($wpconfig) ? (int) @fileperms($wpconfig) : null; 1613 1614 $checks = [ 1615 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- reading WordPress core's own 'xmlrpc_enabled' filter to report its state, not defining a custom hook 1616 'xmlrpc_enabled' => function_exists('apply_filters') ? (bool) apply_filters('xmlrpc_enabled', true) : true, 1617 'users_can_register' => (bool) get_option('users_can_register'), 1618 'default_role' => (string) get_option('default_role'), 1619 'wp_debug' => defined('WP_DEBUG') && WP_DEBUG, 1620 'wp_debug_display' => defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY, 1621 'disallow_file_edit' => defined('DISALLOW_FILE_EDIT') && DISALLOW_FILE_EDIT, 1622 'disallow_file_mods' => defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS, 1623 'force_ssl_admin' => function_exists('force_ssl_admin') ? (bool) force_ssl_admin() : (defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN), 1624 'site_is_https' => strpos($siteurl, 'https://') === 0, 1625 'wp_config_perms' => $cfgPerms !== null ? substr(sprintf('%o', $cfgPerms), -4) : null, 1626 'wp_config_world_readable' => $cfgPerms !== null ? (bool) ($cfgPerms & 0x0004) : null, 1627 'htaccess_present' => file_exists($htaccess), 1628 'uploads_exec_guard' => $upbase !== '' ? (file_exists($upbase . '/index.php') || file_exists($upbase . '/.htaccess')) : null, 1629 'admin_user_exists' => function_exists('get_user_by') ? (bool) get_user_by('login', 'admin') : null, 1630 ]; 1631 1632 $concerns = []; 1633 if ($checks['users_can_register'] && in_array(strtolower($checks['default_role']), ['administrator', 'editor'], true)) { 1634 $concerns[] = 'open_registration_privileged_role'; 1635 } 1636 if ($checks['wp_debug_display']) { $concerns[] = 'debug_display_on'; } 1637 if ($checks['wp_config_world_readable'] === true) { $concerns[] = 'wp_config_world_readable'; } 1638 if (! $checks['site_is_https']) { $concerns[] = 'site_not_https'; } 1639 if ($checks['admin_user_exists'] === true) { $concerns[] = 'default_admin_username'; } 1640 1641 return [ 1642 'checks' => $checks, 1643 'concerns' => $concerns, 1644 'note' => "Read-only posture from this site's config, options and file permissions. REST user-enumeration, directory listing and XML-RPC reachability are best confirmed by Site Doctor's external scan.", 1645 ]; 1646 } 1647 1648 // ─── user_audit (R4-E) ─────────────────────────────────────────────── 1649 /** Administrator roster: logins, email domains, registration, last login and 2FA where a known plugin exposes it. Metadata only. */ 1650 private static function op_user_audit(): array 1651 { 1652 if (! function_exists('get_users')) { 1653 return ['error' => 'users_unavailable']; 1654 } 1655 $active = (array) get_option('active_plugins', []); 1656 $twofa = null; 1657 foreach ([ 1658 'two-factor/two-factor.php' => 'two-factor', 1659 'wordfence-login-security/wordfence-login-security.php' => 'wordfence-login-security', 1660 'wordfence/wordfence.php' => 'wordfence', 1661 'miniorange-2-factor-authentication/miniorange_2_factor_settings.php' => 'miniorange-2fa', 1662 'google-authenticator/google-authenticator.php' => 'google-authenticator', 1663 ] as $file => $name) { 1664 if (in_array($file, $active, true)) { $twofa = $name; break; } 1665 } 1666 1667 $admins = get_users(['role' => 'administrator', 'number' => 500, 'fields' => ['ID', 'user_login', 'user_email', 'user_registered']]); 1668 $list = []; 1669 foreach ($admins as $u) { 1670 $last = null; 1671 foreach (['last_login', 'wfls-last-login', 'last_active', '_last_login'] as $k) { 1672 $v = function_exists('get_user_meta') ? get_user_meta($u->ID, $k, true) : ''; 1673 if ($v !== '' && is_numeric($v)) { $last = gmdate('Y-m-d H:i:s', (int) $v); break; } 1674 } 1675 $list[] = [ 1676 'id' => (int) $u->ID, 1677 'login' => $u->user_login, 1678 'email_domain' => ltrim((string) strrchr((string) $u->user_email, '@'), '@'), 1679 'registered' => $u->user_registered, 1680 'last_login' => $last, 1681 ]; 1682 } 1683 return [ 1684 'admin_count' => count($list), 1685 'admins' => $list, 1686 '2fa_plugin' => $twofa, 1687 'note' => 'Administrator accounts, metadata only (login, email DOMAIN, registration, last login if a plugin records it). 2fa_plugin names a detected active 2FA plugin; per-user 2FA status is not uniformly exposed.', 1688 ]; 1689 } 1690 1389 1691 // ════════════════════════════════════════════════════════════════════ 1390 1692 // HMAC AUTH … … 1682 1984 } 1683 1985 wp_safe_redirect(admin_url('options-general.php?page=syswp-site-doctor&m=disc')); 1986 exit; 1987 }); 1988 1989 // Save the per-site settings (currently: the core-integrity outbound toggle). 1990 add_action('admin_post_syswp_site_doctor_settings', function () { 1991 if (!current_user_can('manage_options') || !check_admin_referer('syswp_site_doctor_settings')) { 1992 wp_die('Not allowed'); 1993 } 1994 update_option('syswp_site_doctor_core_check', isset($_POST['core_check']) ? '1' : '0', false); 1995 wp_safe_redirect(admin_url('options-general.php?page=syswp-site-doctor&m=saved')); 1684 1996 exit; 1685 1997 }); … … 1785 2097 if ($m === 'bad') echo '<div class="notice notice-error is-dismissible"><p>Invalid key. Copy it again from Site Doctor.</p></div>'; 1786 2098 if ($m === 'disc') echo '<div class="notice notice-warning is-dismissible"><p>Disconnected. This site no longer responds to Site Doctor.</p></div>'; 2099 if ($m === 'saved') echo '<div class="notice notice-success is-dismissible"><p>Settings saved.</p></div>'; 1787 2100 1788 2101 if ($connected) { … … 1795 2108 echo '<p style="margin:8px 0 0;color:#777;font-size:12px">Version <code>' . esc_html(SYSWP_SITE_DOCTOR_VERSION) . '</code> · read-only monitoring. Your connection key is stored securely and does not need to be shown again. Updates arrive through WordPress.org.</p>'; 1796 2109 echo '</div>'; 2110 // Core-integrity toggle (R2-A): the only feature that makes an outbound call (to api.wordpress.org). 2111 $coreCheck = get_option('syswp_site_doctor_core_check', '1') === '1'; 2112 echo '<form method="post" action="' . esc_url(admin_url('admin-post.php')) . '" style="max-width:640px;margin:0 0 18px">'; 2113 wp_nonce_field('syswp_site_doctor_settings'); 2114 echo '<input type="hidden" name="action" value="syswp_site_doctor_settings">'; 2115 echo '<label style="display:flex;align-items:flex-start;gap:8px">'; 2116 echo '<input type="checkbox" name="core_check" value="1"' . checked($coreCheck, true, false) . ' style="margin-top:3px">'; 2117 echo '<span><strong>Check core file integrity against WordPress.org</strong><br><span style="color:#777;font-size:12.5px">When on, Site Doctor can compare your WordPress core files to the official checksums from <code>api.wordpress.org</code> to spot modified or injected files. Turn this off to keep this site fully outbound-free.</span></span></label>'; 2118 echo '<p style="margin:8px 0 0"><button class="button">Save settings</button></p></form>'; 1797 2119 // Disconnect 1798 2120 echo '<form id="sysdoctor-disconnect-form" method="post" action="' . esc_url(admin_url('admin-post.php')) . '" style="display:inline-block;margin:0 0 20px">'; -
sysdoctor/trunk/uninstall.php
r3810319 r3810403 21 21 'syswp_site_doctor_group_name', 22 22 'syswp_site_doctor_db_version', 23 'syswp_site_doctor_core_check', 23 24 ]; 24 25
Note:
See TracChangeset
for help on using the changeset viewer.