Lightweight PHP scanner for suspicious patterns in WordPress databases, focused on wp_options. This tool does not clean malwareβit flags risky patterns so you can investigate safely.
- Scope: Reads selected option values (default:
wp_options) and matches curated regex rules. - Threat model: Detects common webshell/obfuscation signatures, not complete malware eradication.
- Safety: Read-only access; no writes or deletions.
- Run locally or on staging with read-only DB credentials.
- Export results (JSON/table) for review.
- Delete the scanner immediately after use.
β Strict guidance: remove the scanner files after every scan. Never keep this tool deployed.
- CLI (recommended): predictable output, exit codes, JSON export.
- Web UI (temporary): local-only page for one-off scans.
- PHP 8.1+ with PDO MySQL
- Composer
- WordPress database credentials (read-only)
composer install
cp .env.example .envEdit .env with your DB credentials.
β οΈ Safety reminder: this scanner is intended for local or staging use only. Avoid deploying with real credentials unless you have a secure, isolated environment.
Minimal structure for a Vercel PHP deploy:
project/
βββ api/
β βββ index.php
βββ composer.json
βββ vercel.json
βββ .vercelignore
vercel.json should point Vercel at the community PHP runtime:
{
"version": 2,
"functions": {
"api/*.php": {
"runtime": "vercel-php@0.7.4"
}
}
}.vercelignore keeps vendor/ out of the upload so Vercel installs dependencies during build:
/vendor
The sample api/index.php in this repo returns a JSON status response so you can validate the runtime is working.
Key settings:
DB_HOST,DB_PORT,DB_USER,DB_PASS,DB_NAMEWP_TABLE(default:wp_options)OPTION_NAMES(comma-separated)OUTPUT_FORMAT(tableorjson)WEB_ALLOW_REMOTE(default:false)
php bin/scan.phpExamples:
php bin/scan.php --format=json --output=scan.json
php bin/scan.php --format=tableExit codes:
0no suspicious patterns1suspicious patterns found2execution error
php -S 0.0.0.0:8080 -t publicThen open http://127.0.0.1:8080. Remote access is blocked unless WEB_ALLOW_REMOTE=true.
For a simpler startup (and for containerized screenshot tools), use:
bin/serve-ui.shRemove the
public/directory (or the whole project) after scanning.
- Table: human-readable ASCII table
- JSON: structured export for incident response
β
Scans suspicious patterns (e.g., eval, <script>, base64_decode) in known option keys.
β Does not disinfect files, detect every attack, or fix WordPress.
- No results but still compromised? Add option names or broaden rules.
- DB errors: verify
.env, confirm DB user has read-only access. - Remote UI blocked: expected for safetyβuse CLI or localhost.
This tool identifies suspicious patterns only. Always perform a full incident response and restore from clean backups when in doubt.
Delete the scanner files immediately after scanning:
rm -rf wp-malware-scannerMIT License