You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
UpsertBucket uses a purpose label to detect & work around squatting (#9269)
Fixes both a DoS and RCE vulnerability when an attacker could predict the bucket that App Hosting or Functions would use for uploading source.
Instead of returning a bucket when it exists (but could be owned by an attacker) we list the buckets actually owned by the user. There are three cases to consider:
There exists a bucket with the "purpose label". This will usually have the same name as the target bucket name, but may not in the case that the bucket was created with collision avoidance. Return whichever bucket has the label.
There exists a bucket without the "purpose label" but with the target bucket name. Since we got this bucket name from "listBuckets" we know that this is user owned and it is safe to add the purpose label to migrate the fleet to one shape
The bucket does not exist. Try to create it. If creation fails (e.g. naming conflict due to squatting) then add a random 6-character string at the end to avoid conflicts. We try this 4 times, so an attacker would need to have squatted on about 600 million buckets for there to be at least a 1% chance that deployment fails (and they can retry without consequence).
Manually tested:
Create a bucket without conflict
Create a bucket with conflict
Reuse a bucket
Add a purpose label to a legacy bucket
0 commit comments