CVE-2022-1281
📋 TL;DR
This CVE describes an SQL injection vulnerability in the Photo Gallery WordPress plugin. Attackers can exploit this by sending malicious input through the filter_tag parameter, potentially allowing them to read, modify, or delete database content. All WordPress sites running Photo Gallery plugin version 1.6.3 or earlier are affected.
💻 Affected Systems
- Photo Gallery WordPress Plugin
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Complete database compromise leading to data theft, privilege escalation, remote code execution, or site takeover.
Likely Case
Data extraction from the WordPress database including user credentials, sensitive content, or plugin-specific data.
If Mitigated
Limited impact with proper input validation and database user permissions restricting write operations.
🎯 Exploit Status
SQL injection vulnerabilities in WordPress plugins are commonly exploited in the wild. The vulnerability requires no authentication and has simple exploitation vectors.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 1.6.4 or later
Restart Required: No
Instructions:
1. Log into WordPress admin panel. 2. Navigate to Plugins → Installed Plugins. 3. Find 'Photo Gallery' plugin. 4. Click 'Update Now' if available. 5. If no update appears, manually download version 1.6.4+ from WordPress.org and replace the plugin files.
🔧 Temporary Workarounds
Disable Photo Gallery Plugin
allTemporarily disable the vulnerable plugin until patching is possible.
wp plugin deactivate photo-gallery
Web Application Firewall Rule
allBlock SQL injection patterns targeting the filter_tag parameter.
ModSecurity rule: SecRule ARGS_POST:filter_tag "@detectSQLi" "id:1001,phase:2,deny,status:403"
🧯 If You Can't Patch
- Implement a web application firewall (WAF) with SQL injection protection rules
- Restrict database user permissions to read-only for the WordPress database user
🔍 How to Verify
Check if Vulnerable:
Check WordPress admin panel → Plugins → Photo Gallery → Version. If version is 1.6.3 or lower, you are vulnerable.
Check Version:
wp plugin get photo-gallery --field=version
Verify Fix Applied:
Verify Photo Gallery plugin version is 1.6.4 or higher in WordPress admin panel.
📡 Detection & Monitoring
Log Indicators:
- Unusual SQL queries in WordPress or database logs
- Multiple POST requests to gallery endpoints with filter_tag parameter containing SQL syntax
Network Indicators:
- HTTP POST requests containing SQL keywords (UNION, SELECT, INSERT, etc.) in filter_tag parameter
SIEM Query:
source="wordpress.log" AND "filter_tag" AND ("UNION" OR "SELECT" OR "INSERT" OR "DELETE")
🔗 References
- https://plugins.trac.wordpress.org/changeset/2706797/photo-gallery/trunk/frontend/models/BWGModelGalleryBox.php?old=2587758&old_path=photo-gallery%2Ftrunk%2Ffrontend%2Fmodels%2FBWGModelGalleryBox.php
- https://wpscan.com/vulnerability/2b4866f2-f511-41c6-8135-cf1e0263d8de
- https://plugins.trac.wordpress.org/changeset/2706797/photo-gallery/trunk/frontend/models/BWGModelGalleryBox.php?old=2587758&old_path=photo-gallery%2Ftrunk%2Ffrontend%2Fmodels%2FBWGModelGalleryBox.php
- https://wpscan.com/vulnerability/2b4866f2-f511-41c6-8135-cf1e0263d8de