The vulnerability is located in the DistSpecAuthzHandler function in pkg/api/authz.go. This function is a middleware that checks user permissions before allowing an image manifest push. The logic to distinguish between creating a new tag (create permission) and overwriting an existing tag (update permission) was flawed. Specifically, the condition if err == nil && slices.Contains(tags, reference) && reference != "latest" would only trigger an update permission check if the tag being pushed was not latest. This created a loophole where a user with only create permissions could overwrite the latest tag, as the action was not correctly identified as an update. The fixing commit ace12e2a12d0e104f6fb0aecf162b29e8c67b8a9 removes the && reference != "latest" part of the condition, ensuring that any attempt to overwrite an existing tag, including latest, correctly requires update permission. The analysis of the patch directly points to DistSpecAuthzHandler as the single vulnerable function.