SSRF in Pinry pin creation (fixed in v2.1.15)
Pinry’s “create a pin from a URL” feature fetched the user-supplied address server-side with no validation
at all. Any signed-in user — and, because registration is open by default, effectively anyone — could make
the Pinry server send requests to localhost, hosts on its private network, or cloud metadata services.
This was a Server-Side Request Forgery (SSRF). I reported it privately and the project fixed it in
v2.1.15.
Summary
| Project | pinry/pinry |
| Affected versions | <= 2.1.14 |
| Fixed version | 2.1.15 |
| Type | CWE-918 Server-Side Request Forgery |
| Severity | Medium (CVSS 3.1 ~4.3) |
| Fix | commit e2acdb6, new core/fetch.py |
| Advisory | v2.1.15 release notes |
What is Pinry, and what does this feature do?
Pinry is a self-hosted image board (Pinterest-like). You can add a pin either by uploading a file or by giving a URL. In the second case the server downloads the image from that address itself. That is where the bug lived.
Root cause
Pin creation passed the url field straight into an HTTP request. The relevant code (core/models.py):
def create_for_url(self, url, referer=None, owner=None):
file_name = url.split("/")[-1].split('#')[0].split('?')[0]
buf = BytesIO()
headers = dict(self._default_ua)
if referer is not None:
headers["Referer"] = referer
response = requests.get(url, headers=headers) # <-- no validation
...
The call path was:
POST /api/v2/pins/ (PinViewSet)
-> PinSerializer.create() url = validated_data['url']
-> Image.objects.create_for_url(url, ...)
-> requests.get(url) # SINK
requests.get() was called with defaults, which means:
- no check on the scheme or the target IP;
requestsfollows redirects by default.
If the response wasn’t a valid image, no pin was created, so the issue was blind in the classic sense: the attacker couldn’t read the response body directly. But the difference between “image returned” and “error” is observable, which is enough to probe internal services and ports (semi-blind).
One detail widened the impact: Pinry ships with registration open by default
(ALLOW_NEW_REGISTRATIONS = True) and PUBLIC = True. So the attacker needs no special role — they can
register their own account and trigger the flow.
Verification (local only)
I tested this only against a Pinry instance running on my own machine, with a listener also on my own machine. No third-party system was touched.
Creating a pin as a test user with the url field pointing at my listener produced a request whose
User-Agent matched the hardcoded value in Pinry’s code exactly:
HIT ... path=/ssrf-probe.png ua=Mozilla/5.0 (Windows NT 5.1) ...
That proved the request came from the Pinry server process, not from my test client.
I then checked redirect behaviour: my listener returned a 302 to a second local endpoint, and Pinry,
having received only the first address, followed the redirect and requested the second one too. This
matters, because a fix that validated only the user-submitted URL would not have been enough.
The fix
The maintainer (winkidney) confirmed it quickly and shipped a thorough fix in v2.1.15, closely following
my suggestions. The new core/fetch.py now:
- allows only
httpandhttps; - refuses a host if any address it resolves to is not public (loopback, private, link-local, CGNAT and IPv4-mapped IPv6 included);
- re-checks every redirect hop;
- checks the address actually connected to (against DNS rebinding);
- caps each fetch at 20 seconds and 50 MB.
Admins who need to fetch from their own network (a NAS, say) can allow specific networks with the new
IMAGE_FETCH_ALLOWED_NETWORKS setting, which is empty by default. A refused fetch now returns a generic
400.
I tested the fix locally against v2.1.15: the same request is now refused with HTTP 400 (“Cannot fetch
image from this URL.”), and no request reaches my listener — the server never opens the connection.
Takeaways
- Any feature that takes a URL from the user and fetches it server-side is a potential SSRF, including innocent-looking ones like “download an image.”
- You can’t fix SSRF by validating only the input (the first URL). The right place is an IP check right before connecting, applied on every redirect hop, and ideally enforced at connection time to defeat DNS rebinding.
- Defaults decide the impact: open registration turns “any user” into “anyone on the internet.”
Timeline
- 2026-11-26: Reported privately to the maintainer.
- 2026-11-26: Maintainer confirmed and released v2.1.15.
- 2026-11-27: Fix verified locally; this write-up published.
Thanks to the Pinry maintainer for the quick and careful response.