⛔ Critical Security Advisory Voting for a photo · WordPress.org · 1.2 Disclosed 2026-07-11 · 13:00 UTC
Full technical detail published. The 45-day coordinated-disclosure window (vendor notified 2026-07-11) has passed; the exact code location and analysis are shown below. No weaponised exploit is published.
Advisory · CLR-2026-3029

Unauthenticated SQL Injection in the WordPress plugin Voting for a photo (1.2)

Voting for a photo (WordPress.org, version 1.2) Voting for a photo (1.2) registers a public, unauthenticated admin-ajax.php action whose handler concatenates a POST parameter directly into a SQL query with no sanitisation, integer cast, or prepared statement. An unauthenticated visitor can inject SQL and read arbitrary database contents (WordPress user password hashes, secrets). The plugin has been unmaintained since December 2018; no fixed release exists — remove it.

CriticalSQL InjectionUnauthenticatedWordPressVerified in source
Summary

Voting for a photo 1.2 (WordPress.org) contains an unauthenticated sql injection. The plugin registers a handler reachable by visitors who are not logged in, and it concatenates a request parameter straight into a live SQL statement.

The unauthenticated AJAX handler takes a POST parameter and concatenates it directly into a SQL query with no sanitisation, integer cast, or prepared statement, so the value reaches the database unaltered. The result is a blind/time-based SQL-injection channel through which the full database (user password hashes, secrets) can be extracted.

Voting for a photo was surfaced automatically by the codelake WordPress static-analysis pipeline (source-to-sink taint) · AI false-positive triage · manual source verification, and then verified by hand against the shipped 1.2 artifact. The plugin has not been updated since 2018-12-11; because no patched release exists, the correct remediation is to remove it.

Impact

Class: SQL Injection (CWE-89). Privilege required: none — the injectable endpoint is registered for logged-out visitors. Effect: read access to the entire database via blind SQL injection (credential hashes, secrets, tokens); depending on database privileges, write access.

A second variant with the same flaw exists in the same file. The precise locations and code are withheld below until the disclosure deadline.

Vulnerable code
voting-for-a-photo/src/Admin/Admin.php ⛔ unauthenticated sql injection
35add_action('wp_ajax_calculate_votes', [$this, 'addVote']);
36add_action('wp_ajax_nopriv_calculate_votes', [$this, 'addVote']); // unauthenticated
152$attachment_id = $_POST['attachment_id']; // raw, no intval/sanitise
164$countquery = "SELECT COUNT(`id`) FROM `".$wpdb->prefix."galleryvotes` WHERE `attachment_id` = '".$attachment_id."'";
165$count = $wpdb->get_var($countquery);
Technical detail

Because the action carries the wp_ajax_nopriv_ prefix it is reachable without a session. The tainted value lands in the query with no parameterisation.

Related: the same handler is also registered as the authenticated wp_ajax_calculate_votes.

Further unparameterised queries: $_POST['gallery_id'] is likewise concatenated (via checkIp, ~line 215); the $_SERVER['REMOTE_ADDR'] sinks Groq also flagged are NOT attacker-controllable and are not exploitable.

A working proof-of-concept is intentionally not published; the exact reproduction was shared privately with WordPress Plugin Security Team.

Timeline
Published
Voting for a photo listed on WordPress.org; last updated 2018-12-11, unmaintained since.
2026-07-11
Automatic detection
codelake WordPress static-analysis pipeline (source-to-sink taint) flags a request-to-database taint flow with no prepared statement; AI-triage marks it a real finding.
2026-07-11
Manual verification
Confirmed against the shipped 1.2 artifact — unauthenticated reachability verified in source.
2026-07-11
3:00 UTC
WordPress Plugin Security Team notified
Coordinated disclosure opened with full technical detail; a 45-day window begins.
2026-08-25
Technical-detail reveal
The exact code location and reproduction are published automatically after the 45-day window.
Indicators & characteristics
PKGVoting for a photo 1.2 (WordPress.org) — wordpress.org/plugins/voting-for-a-photo
SHA25661d8da69c8ad4a7a9f7be6a920da9be9c564e066512ba63e76e6c0845b7098e0 (artifact)
CLASSCWE-89 SQL Injection · sanitize_text_field() used as an (ineffective) SQL neutraliser
AUTHZNo authentication required · no nonce · no capability check
SINKexact file:line of the injectable sink
ENTRYexact endpoint / action name
Remediation
#ActionPriority
01 Deactivate and delete Voting for a photo. No patched release exists and it is abandoned; sites should not run version 1.2. Critical
02 Patch: replace every concatenated query with $wpdb->prepare() and typed placeholders (%d/%s). High
03 Add nonce + capability checks (check_ajax_referer(), current_user_can()) to state-changing AJAX handlers and remove any unintended nopriv registration. High
04 Check access logs for requests with SQL metacharacters in parameters during the exposure window. Recommended

Detected by codelake Research · codelake WordPress static-analysis pipeline (source-to-sink taint) · AI false-positive triage · manual source verification · disclosed to WordPress Plugin Security Team before publication.

This is a coordinated vulnerability disclosure. The affected package, version and class are published immediately so defenders can act; the exact code location and reproduction are withheld until the deadline, and no weaponised proof-of-concept is published. The archived artifact is available to verified security researchers on request.