Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XSS in location plugin #517

Open
Xavier59 opened this issue Nov 4, 2024 · 0 comments
Open

XSS in location plugin #517

Xavier59 opened this issue Nov 4, 2024 · 0 comments

Comments

@Xavier59
Copy link

Xavier59 commented Nov 4, 2024

var label = urlParam("label");

function showMap(latLng, label)
{
var mymap = L.map('mapid').setView(latLng, 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(mymap);
var radius = latLng.accuracy / 2;
L.marker(latLng).addTo(mymap).bindPopup(label + "\n is within " + radius + " meters from here").openPopup();
L.circle(latLng, radius).addTo(mymap);

L19 introduce XSS. Html content coming from the label query parameter will be inserted in insecure way.

https://github.com/Leaflet/Leaflet/blob/142f94a9ba5757f7e7180ffa6cbed2b3a9bc73c9/src/layer/Popup.js#L393-L406

Fast forward, this will call _updateContent which will set the div popup innerHTML to content which in our case is going to be label.
https://github.com/Leaflet/Leaflet/blob/142f94a9ba5757f7e7180ffa6cbed2b3a9bc73c9/src/layer/DivOverlay.js#L273-L281

Example label query param: <img%20src=x%20onerror=alert(document.cookie)>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant