1. Overview
Understanding MTS WP Security Shield at a technical level
MTS WP Security Shield is a production-grade WordPress security plugin built on a Detect → Harden → Monitor → Respond architecture. Unlike basic security plugins that rely on a single layer of protection, this plugin implements a multi-layered security platform that addresses the full threat lifecycle.
Core Architecture Principles
Scan files, configurations, login attempts, and user behavior to identify vulnerabilities and active threats.
Apply security configurations: disable XML-RPC, restrict REST API, add security headers, enforce 2FA.
Continuous file integrity checks, login monitoring, session tracking, and real-time activity logging.
Automated IP blocking, brute-force lockouts, email/webhook alerts, and incident response logging.
2. Technical Architecture
System design, module structure, and data flow
Module Architecture
The plugin uses a modular architecture with PSR-4 autoloading. Each security domain is encapsulated in its own namespace and can be independently enabled or disabled.
| Module | Namespace | Responsibility | Files |
|---|---|---|---|
| Core | MtsSs\Core |
Orchestration, database, activity log, risk engine | 5 |
| Scanner | MtsSs\Scanner |
7 specialized security scanners | 8 |
| Login | MtsSs\Login |
Authentication, 2FA, sessions, brute force | 5 |
| Firewall | MtsSs\Firewall |
IP management, request filtering, headers | 2 |
| Alerts | MtsSs\Alerts |
Email and webhook notifications | 3 |
| Admin | MtsSs\Admin |
Dashboard UI, settings pages | 1 |
| API | MtsSs\Api |
REST API endpoints | 1 |
| CLI | MtsSs\Cli |
WP-CLI commands | 1 |
File Structure
3. Technical Features
Complete feature inventory with technical specifications
3.1 Security Scanner Engine
The scanner engine orchestrates 7 specialized modules, each targeting a specific security domain. The engine runs scans on-demand, via cron, or through REST API/WP-CLI.
| Scanner Module | Checks Performed | Risk Levels |
|---|---|---|
| File Integrity | SHA-256 hash comparison, modified file detection, unknown file detection, permission checks | High Medium |
| Login Security | Default admin check, XML-RPC status, REST API enumeration, user enum protection | High Medium Low |
| User Security | Admin count audit, password age tracking, inactive user detection | Medium Low Info |
| Configuration | DISALLOW_FILE_EDIT, table prefix, debug mode, auto-updates, file editing | Medium Low |
| Security Headers | X-Content-Type-Options, X-Frame-Options, CSP, HSTS, Referrer-Policy, Permissions-Policy | Medium Low |
| Plugins/Themes | Update availability, abandoned plugin detection, inactive plugin audit | Medium Low Info |
| Database | Admin account security, charset verification, table size monitoring | Low Info |
3.2 Risk Engine
Every finding is classified into one of five severity levels with associated scoring:
| Severity | Score Weight | Description | Response Time |
|---|---|---|---|
| Critical | 100 | Immediate security risk, active exploitation possible | Immediate |
| High | 75 | Significant vulnerability, likely attack vector | Within 24 hours |
| Medium | 50 | Moderate risk, should be addressed soon | Within 7 days |
| Low | 25 | Minor issue, best practice recommendation | Within 30 days |
| Informational | 10 | Information only, no immediate risk | When convenient |
3.3 Login Protection System
IP-based tracking of failed login attempts with configurable thresholds and automatic lockout. Uses WordPress transients for storage.
- Configurable max attempts (default: 5)
- Configurable lockout duration (default: 900s)
- Per-IP + per-username tracking
- Automatic lockout with activity logging
TOTP-based 2FA compatible with Google Authenticator, Authy, and other TOTP apps. Includes QR code generation.
- RFC 6238 TOTP implementation
- Per-user enable/disable
- QR code for easy setup
- Time-window verification (±1 step)
HTTP request rate limiting per IP address with configurable window and threshold. Returns proper 429 status codes.
- Requests per window (default: 60/60s)
- Retry-After header support
- X-RateLimit-Limit headers
- Admin-ajax and REST API support
Track and manage user sessions with configurable limits and timeout. Admins can terminate sessions remotely.
- Max active sessions per user
- Session timeout enforcement
- Session listing and termination
- IP and user-agent tracking
3.4 Firewall & Hardening
- XML-RPC Control: Disable or restrict xmlrpc.php to prevent brute-force amplification and DDoS attacks
- REST API Security: Block anonymous access to /wp/v2/users and other enumeration endpoints
- Security Headers: Automatically send X-Content-Type-Options, X-Frame-Options, X-XSS-Protection, Referrer-Policy, Permissions-Policy, HSTS
- User Enumeration Protection: Block author archive pages and feed-based username discovery
- IP Allow/Deny Lists: Granular IP-based access control with permanent and temporary blocks
- File Editing Disable: Enforce DISALLOW_FILE_EDIT to prevent dashboard code editing
3.5 Alert System
| Channel | Features | Format |
|---|---|---|
| Email Alerts | HTML formatted, severity-based subject lines, critical finding details, scan summary reports | HTML multipart |
| Webhook Alerts | Slack/Discord compatible, Block Kit formatting, severity emoji indicators, real-time delivery | JSON payload |
4. Database Schema
Custom tables and data storage architecture
The plugin creates 5 custom tables on activation, all prefixed with the WordPress table prefix. All queries use prepared statements via $wpdb->prepare().
| Table | Purpose | Key Columns | Indexes |
|---|---|---|---|
wp_mts_ss_activity_log |
Security event logging | event_type, severity, message, user_id, ip_address, created_at | event_type, severity, user_id, created_at |
wp_mts_ss_user_sessions |
Active session tracking | user_id, session_token, ip_address, last_activity, expired | user_id, session_token, expired |
wp_mts_ss_file_hashes |
File integrity baseline | file_path, file_hash, file_size, last_modified, scan_batch | file_path, scan_batch |
wp_mts_ss_blocked_ips |
IP blocking records | ip_address, reason, blocked_by, expires_at | ip_address, expires_at |
wp_mts_ss_scans |
Scan history and results | scan_type, status, results, findings_count, critical_count, high_count | scan_type, status, started_at |
Mts_Ss_Database::cleanup_old_data() method.
5. REST API
Authenticated API endpoints for programmatic access
All endpoints require manage_options capability and use WordPress nonce authentication. Base URL: /wp-json/mts-ss/v1/
| Method | Endpoint | Description | Parameters |
|---|---|---|---|
| POST | /scan |
Run full security scan | — |
| POST | /scan/{module} |
Run specific module scan | module: file_integrity, login_security, etc. |
| GET | /activity |
Retrieve activity logs | limit, offset |
| GET | /blocked-ips |
List blocked IPs | — |
| POST | /block-ip |
Block an IP address | ip_address, reason |
| DELETE | /unblock-ip/{id} |
Unblock an IP | id (path) |
| GET | /settings |
Get plugin settings | — |
| POST | /settings |
Update plugin settings | JSON body with settings |
Example API Usage
6. WP-CLI Commands
Command-line interface for server administrators
| Command | Description | Options |
|---|---|---|
wp mts-security scan |
Run full security scan | --format=table|json |
wp mts-security status |
Show current security status | — |
wp mts-security users |
Show user security status | — |
wp mts-security integrity |
Run file integrity check | — |
wp mts-security harden |
Apply hardening fixes | --fix=xmlrpc|rest-api|security-headers|all |
7. Security Model
How the plugin protects itself and your WordPress site
WordPress Security Best Practices
| Practice | Implementation |
|---|---|
| Nonces | All AJAX actions use wp_create_nonce('mts_ss_nonce') and verify with check_ajax_referer() |
| Capabilities | All admin actions require manage_options capability check |
| Sanitization | All inputs sanitized via sanitize_text_field(), wp_unslash(), absint() |
| Escaping | All outputs escaped via esc_html(), esc_attr(), esc_url(), esc_js() |
| Prepared Queries | All database queries use $wpdb->prepare() with parameterized statements |
| REST Authentication | REST API uses WordPress nonce authentication or Application Passwords |
| Password Storage | Never stores plaintext passwords. 2FA secrets stored via wp_hash() |
| Data Minimization | Only collects necessary security data. No personal information collection. |
Capabilities Required
manage_options— Required for all admin pages, AJAX actions, and REST API endpointsedit_users— Required for user session management and 2FA settingscreate_users— Not required (plugin does not create users)
8. System Requirements
Server and WordPress requirements
| Requirement | Minimum | Recommended |
|---|---|---|
| PHP Version | 8.2 | 8.3+ |
| WordPress Version | 6.4 | 6.7+ |
| MySQL Version | 5.7 | 8.0+ |
| Memory Limit | 128MB | 256MB+ |
| PHP Extensions | json, mbstring, hash | openssl, curl |
| Disk Space | 5MB | 10MB+ (for logs) |
Database Impact
The plugin creates 5 custom tables with minimal storage footprint. Expected database overhead:
- Activity Log: ~1KB per entry, auto-cleanup after 90 days
- User Sessions: ~0.5KB per session, auto-expire based on timeout
- File Hashes: ~0.3KB per file, updated on each scan
- Blocked IPs: ~0.2KB per entry, auto-expire for temporary blocks
- Scans: ~5KB per scan (JSON results), retained for history