4 ms·
Once upon a time: https://njbooher.github.io/blog/cloudflare-workers-ip-spoofing https://njbooher.github.io/blog/cloudflare-workers-ip-spoofi...
by njbooher 6y ago
Once upon a time: https://njbooher.github.io/blog/cloudflare-workers-ip-spoofing https://njbooher.github.io/blog/cloudflare-workers-ip-spoofi...
- kentonv 6y agoYep, I worked on that one. Thank you for reporting it. Ironically, the purported problem in this case is the opposite: Because we don't attribute the request as coming from the original client (in order to avoid the security problem you reported), a client that has bad reputation associated with their IP can proxy through a worker to hide that. The answer is to assign reputation to the Worker itself.
- njbooher 6y agoYeah, I don't envy you. Finding loopholes is more fun than trying to account for everything upfront.
- ec109685 6y agoYou see the request on “both sides” of the worker, so shouldn’t you be able to evaluate the “connecting client to the worker’s reputation” when allowing or denying the upstream request?
- kentonv 6y agoYou mean by somehow evaluating whether the incoming request and the outgoing one are sufficiently "the same", in which case the outgoing request can be attributed to the original client? This seems hard. Let's say the request is the very simplest "GET /" request. The worker does nothing except rewrite the hostname, in order to proxy it to a different server. Is it "the same" request? Well, imagine the new destination host is a company-internal dashboard that authenticates users based on IP address. Now this "GET /" request which was proxied will receive a response that contains secrets. The worker that did the proxying can intercept the response and learn the secrets. So clearly if the request's host is rewritten, it cannot be "the same" request and it cannot be considered to have come from the original client. But the only case where we care about any of this is when a worker makes a request to a different domain. If a request is to the same domain, we trust it, because in that case the attacker can only attack themselves anyway. So the only case that even matters here is when the host has been rewritten, and in that case, we've established that the new request definitely cannot be attributed to the original client. So it seems to me there's nothing interesting we can do here. A request coming out of a worker (going to a different domain) must always be attributed to the worker itself, not to the client that triggered the worker.