Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security issue: can proxy any image from any server #9

Open
backrunner opened this issue Sep 23, 2023 · 1 comment
Open

Security issue: can proxy any image from any server #9

backrunner opened this issue Sep 23, 2023 · 1 comment

Comments

@backrunner
Copy link

backrunner commented Sep 23, 2023

The proxy will accept a target URL from query or the params part in the request, then it will download it even if the image if not coming from a Misskey instance in the federation.
That will cause a security issue that as a public proxy server, someone can easily abuse it to proxy something from any server, which might a harmful content, and the abusive behavior can also cause server traffic to be wasted, which can be used to launch malicious attacks on server instances with limited traffic.

Here is a possible solution to this issue:
The misskey instance knows which original servers the inbox receives media files from, and it must have an available URL to pull the original media files. Misskey instance can resolve the domain from the URL of media files, and add them to a whitelist automatically (the whitelist can be saved into DB, and use Redis or something other to notify the proxy that the whitelist should be reloaded), then the proxy can be secured by filter the URL with the domains in the whitelist.

Alternatively, it is also possible to check the domains of the individual instances within the federation, but this may not be as accurate (some instances may use different CDN domains).

(Actually, just add a simple signature can also make things better in a small cost way :D)

@backrunner
Copy link
Author

backrunner commented Sep 24, 2023

👆 I've just created a sample PR in my fork as a reference, there're still some problem with the changes, but that can help you guys to make things further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant