SQL injection vulnerability: search query not escaped (patch posted)
-
With the 2.0.2 version of ACF Better Search I’m getting an SQL error returned on the search results page when I include an apostrophe in the search query.
Seems like this could be exploited – please fix ASAP!
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘%’) AND (b.meta_id = a.meta_id + 1) AND (c.post_name = b.meta_value)) OR ((wp_po’ at line 1]
SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_postmeta AS a ON (a.post_id = wp_posts.ID) LEFT JOIN wp_postmeta AS b ON (b.post_id = wp_posts.ID) LEFT JOIN wp_posts AS c ON ((c.post_type = ‘acf-field’) AND ((c.post_content LIKE ‘%:”text”%’) OR (c.post_content LIKE ‘%:”textarea”%’) OR (c.post_content LIKE ‘%:”number”%’) OR (c.post_content LIKE ‘%:”email”%’) OR (c.post_content LIKE ‘%:”url”%’) OR (c.post_content LIKE ‘%:”wysiwyg”%’) OR (c.post_content LIKE ‘%:”select”%’) OR (c.post_content LIKE ‘%:”checkbox”%’) OR (c.post_content LIKE ‘%:”radio”%’))) WHERE 1=1 AND (((a.meta_value LIKE ‘%test’%’) AND (b.meta_id = a.meta_id + 1) AND (c.post_name = b.meta_value)) OR ((wp_posts.post_title LIKE ‘%test’%’) OR (wp_posts.post_content LIKE ‘%test’%’) OR (wp_posts.post_excerpt LIKE ‘%test’%’))) AND wp_posts.post_type IN (‘post’, ‘page’, ‘attachment’, ‘listing’) AND (wp_posts.post_status = ‘publish’ OR wp_posts.post_status = ‘acf-disabled’ OR wp_posts.post_author = 1 AND wp_posts.post_status = ‘private’) ORDER BY wp_posts.post_title LIKE ‘%test%’ DESC, wp_posts.post_date DESC LIMIT 0, 999
- The topic ‘SQL injection vulnerability: search query not escaped (patch posted)’ is closed to new replies.