mirror of
https://github.com/photoprism/photoprism.git
synced 2026-03-02 22:57:18 -05:00
Direct links to image remain accessible after share is revoked #657
Labels
No labels
ai
android
api
auth
awesome
bug
bug
ci
cli
config
database
declined
deprecated
docker
docs 📚
documents
duplicate
easy
enhancement
enhancement
enhancement
epic
faces
feedback wanted
frontend
hacktoberfest
help wanted
idea
in-progress
incomplete
index
invalid
ios
labels
live
live
low-priority
macos
member-feature
metadata
mobile
nas
needs-analysis
no-coding-required
no-coding-required
observability
performance
places
please-test
plus-feature
priority
pro-feature
question
raspberry-pi
raw
released
released
released
research
resolved
security
sharing
tested
tests
third-party-issue
thumbnails
upgrade
upstream-issue
ux
vector
video
waiting
won't fix
won't fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/photoprism#657
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @squirrelchew on GitHub (Jan 4, 2021).
Originally assigned to: @lastzero on GitHub.
Album share links should be tied to the direct links to a given image, being created and destroyed alongside the album share link.
Scenario
/s/slug/albumname)/api/v1/t/hash/hash/fit_res)Expected result
Actual result
@squirrelchew commented on GitHub (Jan 4, 2021):
Further testing reveals that right clicking an image that already fits in the window will dismiss it, making it slightly more challenging to retrieve the image URL. This can be bypassed by looking at the source, or simply making your viewport smaller, left clicking the image to zoom it, then right clicking the image.
Also, turns out the URL for a given image is the same for an image regardless of whether or not it's shared or even in an album. The URL fetched using this method from the admin login on album-less images is publicly accessible.
It would make sense to me to dynamically create/destroy the API endpoints for a given image based on the slug of the album share, keep that stored in the database or however the endpoints are currently mapped for images, no?
@lastzero commented on GitHub (Jan 5, 2021):
This isn't Snapchat. When you share an image with Friends & Family, expect it a) being cached by their browser and b) being downloaded.
There even is a download button. You don't need to hack it.
We could continuously change all URLs, but that would give a false sense of security and cause a huge performance impact as pictures can't be properly cached by browsers anymore. Note that album share links are much shorter, and may be much easier to guess. You might also post them somewhere external and then forget.
Let us know when you find a way to guess the URL without having full access in the first place.
@lastzero commented on GitHub (Jan 5, 2021):
@lastzero commented on GitHub (Jan 5, 2021):
As you can see, this "security issue" exists in all image sharing services to a certain extend. In addition, you can manually change PhotoPrism's preview & download tokens. Download tokens are also being regenerated on restart. When you don't know the token, you can't download images anymore. Previews don't have full resolution and don't contain metadata.
@lastzero commented on GitHub (Jan 5, 2021):
I've closed this as it works as designed - there are always tradeoffs, and you can't have it both ways:
Also I remember to have had this discussion before, just no time to search for existing GitHub issues. In the end, everyone agreed it is good enough for now.
Tokens & permissions will be revisited when implementing multi-user support, see #98
@Leonetienne commented on GitHub (Jun 1, 2023):
The gist of this issue still persists. Even images which have never, ever been publicized, can be accessed via the direct image url.
An attacker could just brute-force urls to mine private pictures. Sure, the urls are not predictable, but guessable. If one has a LOT of images in an album (seen people talk about north of 40k images), I could imagine bombarding their server with requests from multiple attacking hosts for weeks could yield a few private images in a reasonable timeframe.
Why serve the file directly instead of just checking for a valid session id? Sure, it's a small performance hit, but exposing private images to anyone able to guess the url is bad.
To be fair, I did not check if Photoprism just refuses to answer after lots of failed attempts (kinda like fail2ban), but somehow I think that's unlikely.
Another aspect: I suppose the direct image uris are generated by some hash value? Please tell me it's not the original files unsalted hash. If it is, Mallory could check if Bob hosts specific images on his server by deriving the uri herself, and checking if it yields an image.
Maybe I'm missing something, but this seems like a glaring issue to me.
@lastzero commented on GitHub (Jun 1, 2023):
@Leonetienne See our Developer Guide for a detailed discussion of the architecture and the best practices it is based on:
Since then, we've additionally implemented individual download and preview tokens for each user, except if you're running your instance in public mode anyway. These completely random tokens change when you change your password and become inactive when you log out or a user account is deleted, so the URLs no longer work.
Extremely unlikely. If you have that much time and resources you might as well raid the house or data center where the server is located and get a good lawyer to defend you (or get the first flight our of the country). If you think otherwise, please do the math and/or show a proof-of-concept.