GHSA-xv4r-4885-gwpg Kimai has Improper Authorization in Team Member and Team Activity Assignment APIs Which Allows Expansion of Team Scope Beyond Authorized Visibility
SummaryKimai contains an authenticated improper authorization vulnerability in Team-related assignment APIs. A Teamlead who can edit their own team can use backend API endpoints to add users or activities that fall outside their intended visible or manageable scope, even when the frontend correctly hides those targets.This affects both team member assignment and team activity assignment. The issue is caused by treating "may edit this team" as equivalent to "may attach any referenced object to this team", without performing a second authorization check on the target user or activity.DetailsThe issue affects at least the following API routes:`POST /api/teams/{id}/members/{userId}``POST /api/teams/{id}/activities/{activityId}`In both cases, the backend checks whether the caller may edit the `Team`, but it does not verify whether the referenced `User` or `Activity` falls inside the caller's allowed management scope.For team member assignment, the frontend form correctly limits the visible user choices. In `src/Form/TeamEditForm.php`, the team edit form uses `UserType`:In `src/Form/Type/UserType.php`, the user selector is built from `UserRepository::getQueryBuilderForFormType()`:And in `src/Repository/UserRepository.php`, Teamlead-visible candidates are limited to team members from teams they lead:However, the actual member-assignment API does not reuse that restriction. In `src/API/TeamController.php`:For activity assignment, the same pattern appears. In `src/API/TeamController.php`:The `Team` voter only checks whether the current user may edit that team, not whether the referenced object is within the Teamlead's legitimate scope. In `src/Voter/TeamVoter.php`:For activities, this is especially risky because later authorization logic may trust the team assignment that was just written. In `src/Security/RolePermissionManager.php`:So once a Teamlead is able to write a new team/activity relation, later access-control decisions may treat that relation as legitimate input.*A PoC was provided, but removed for security reasons.*ImpactThis vulnerability allows a Teamlead to use their own editable team as an expansion container for objects that should remain outside their authorized scope. In the validated member-assignment case, the attacker can forcibly add users who are not supposed to be manageable through that Teamlead's visible range. In the activity-assignment case, the attacker can attach activities that are outside the intended authorization boundary of the team.Once such relations are written, downstream authorization, visibility, and business workflows may start treating them as legitimate. This can affect user scoping, team-based access control, customer/project/activity visibility, time-entry behavior, statistics, and reporting. The issue therefore breaks the trustworthiness of `Team` as a security isolation container.SolutionSeveral new permission checks were added to `src/API/TeamController.php` -Check if user can be accessed with `#[IsGranted('access_user', 'member')]` before adding as new team memberCheck if customer can be seen with `#[IsGranted('view', 'customer')]` before a team is granted access to a customerCheck if project can be seen with `#[IsGranted('view', 'project')]` before a team is granted access to a projectCheck if activity can be seen with `#[IsGranted('view', 'activity')]` before a team is granted access to an activitySee [https://www.kimai.org/en/security/ghsa-xv4r-4885-gwpg](https://www.kimai.org/en/security/ghsa-xv4r-4885-gwpg) for more information.
CVSS v4.0 score: 5.3