Security release. All users should upgrade, especially instances that allow new registrations (the default).
Security fix: SSRF in pin creation
v2.1.14 and earlier downloaded any URL given when creating a pin from a URL. Any signed-in user could make the server request localhost, hosts on its private network or cloud metadata services, tell from the response which of them answer, and save any image they serve as a pin.
Now image downloads:
- accept only
httpandhttpsURLs; - refuse host names that resolve to loopback, private, link-local, shared (CGNAT) or other non-public IPv4/IPv6 addresses;
- check every redirect and the address actually connected to (DNS rebinding);
- stop after 20 seconds and 50 MB.
Public image URLs, including ones that redirect to a CDN, work as before, from the web UI, the bookmarklet, browser extensions and the API. A refused or failed download now answers HTTP 400 {"url": "Cannot fetch image from this URL."} instead of a server error; the server log says why.
Thanks to Buse Berren ÜNAL (@busolbuse) for reporting this issue privately.
Upgrading
No database migration.
- Docker: pull
getpinry/pinry:2.1.15(orlatest) and restart. - Without Docker: update the code and restart.
If you create pins from images on your own network (for example a NAS), allow that network in local_settings.py (Docker: /data/local_settings.py) and restart:
IMAGE_FETCH_ALLOWED_NETWORKS = ["192.168.1.0/24"]New settings: IMAGE_FETCH_ALLOWED_NETWORKS (default []), IMAGE_FETCH_TIMEOUT (default 20), IMAGE_FETCH_MAX_BYTES (default 50 MB). If you run Pinry behind HTTP_PROXY/HTTPS_PROXY, Pinry now needs working DNS itself. If you cannot upgrade yet, set ALLOW_NEW_REGISTRATIONS = False.
See the upgrade guide.
Other changes since v2.1.14
- Docker image: keep setuptools below 81 so source builds on armv7 work.
pyproject.tomlversion now matches the release (it still said 2.1.9).
Docker images: getpinry/pinry:2.1.15, getpinry/pinry:latest (linux/amd64, linux/arm64, linux/arm/v7).