CVE-2022-1281

9.8 CRITICAL

📋 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

Products:
  • Photo Gallery WordPress Plugin
Versions: All versions through 1.6.3
Operating Systems: All operating systems running WordPress
Default Config Vulnerable: ⚠️ Yes
Notes: Any WordPress installation with Photo Gallery plugin ≤1.6.3 is vulnerable regardless of configuration.

📦 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.

🌐 Internet-Facing: HIGH - WordPress sites are typically internet-facing and the vulnerability requires no authentication.
🏢 Internal Only: MEDIUM - Internal WordPress sites could still be exploited by internal threat actors or through compromised accounts.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

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

Vendor Advisory: 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

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

all

Temporarily disable the vulnerable plugin until patching is possible.

wp plugin deactivate photo-gallery

Web Application Firewall Rule

all

Block 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

📤 Share & Export