The vulnerability lies in Keycloak's Fine-Grained Admin Permissions (FGAPv2) feature, where several methods responsible for managing client and realm role scope mappings failed to enforce proper authorization checks. Specifically, the functions addClientScopeMapping, deleteClientScopeMapping in ScopeMappedClientResource.java, and addRealmScopeMappings, deleteRealmScopeMappings in ScopeMappedResource.java were missing checks to verify if the calling administrator had the map-role-client-scope permission for the roles being modified. This allowed an administrator with limited permissions (e.g., only manage-clients) to add or remove any role, including highly privileged ones like realm-admin, to a client's scope. When a user authenticates against this client, the injected privileged role would be included in their access token, leading to a privilege escalation. The patch addresses this by inserting the requireMapClientScope authorization check in all the vulnerable methods, ensuring that the administrator has the explicit permission to map the target role before the operation is allowed.