The vulnerability lies in the Identity Provider (IdP) service of memos, where several API endpoints lacked proper authorization checks. The analysis of the security patch 769dcd0cf9be83d472829f6e7903b201e42f6b3c reveals the root cause.
The functions APIV1Service.UpdateIdentityProvider and APIV1Service.DeleteIdentityProvider in server/router/api/v1/idp_service.go did not verify if the calling user had the administrative privileges required to perform these actions. Before the patch, any authenticated user could send a request to these endpoints and modify or delete IdP configurations. The patch rectifies this by adding a check to ensure the user has the store.RoleHost role, effectively restricting these operations to administrators.
Additionally, the APIV1Service.GetIdentityProvider and APIV1Service.ListIdentityProviders functions were found to leak sensitive OAuth2 client_secret values to any authenticated user. The patch addresses this information disclosure by introducing a new function, redactIdentityProviderResponse, which removes the client_secret from the response for users who do not have the store.RoleHost role.
Exploitation of these vulnerabilities would allow an attacker with a low-privilege account to either cause a Denial of Service (by deleting IdPs) or potentially achieve account takeover (by modifying an IdP to point to an attacker-controlled authentication server).