T05 · Unauthorized Access and Privilege Escalation
- Location
commands.md:20- Finding
Microsoft Graph Recipe Requests Unnecessary Calendar Write Access
- Content
View full analysis
Vulnerability Details
File Location:
commands.md, lines 20–25
Vulnerability Type: Excessive delegated OAuth permissions
Risk Level: MediumVulnerable Code
powershell Import-Module Microsoft.Graph.Calendar Connect-MgGraph -Scopes "Calendars.Read","Calendars.ReadWrite" Get-MgUserCalendarView -UserId $userId -StartDateTime "2026-03-09T00:00:00+01:00" -EndDateTime "2026-03-16T00:00:00+01:00" New-MgUserEvent -UserId $userId -Subject "Weekly review" -Start @{DateTime="2026-03-14T17:00:00";TimeZone="Europe/Madrid"} -End @{DateTime="2026-03-14T17:45:00";TimeZone="Europe/Madrid"}Technical Analysis
The Microsoft Graph adapter recipe requests both
Calendars.ReadandCalendars.ReadWriteduring initial authentication.Calendars.ReadWritealready includes calendar-reading capability and grants substantially more authority than is necessary for read-only operations such as retrieving a calendar view, checking conflicts, or preparing a proposed schedule.This conflicts with the project's stated least-privilege and approval model. Although the documentation instructs the agent to obtain approval before calendar writes, authorization is granted at connection time, before any operation-specific approval. Application-level instructions do not technically constrain an OAuth token that already possesses write access.
Attack Path
- A user asks the agent to inspect an Outlook calendar or perform a read-only conflict audit.
- The agent follows the documented Microsoft Graph recipe.
Connect-MgGraphrequestsCalendars.ReadWritedespite the task requiring only read access.- The user grants the requested delegated permission.
- The resulting Graph session can create, modify, or delete calendar events.
- A compromised agent session, malicious local process, misused PowerShell command, or other code operating through that authenticated session can perform unauthorized calendar writes without ...[truncated 660 chars]
- Remediation
View remediation
Remediation Suggestions
Separate read-only and write-enabled authentication flows:
powershell # Default read-only workflow Import-Module Microsoft.Graph.Calendar Connect-MgGraph -Scopes "Calendars.Read" Get-MgUserCalendarView -UserId $userId ` -StartDateTime "2026-03-09T00:00:00+01:00" ` -EndDateTime "2026-03-16T00:00:00+01:00"Only request write access after the user explicitly approves a specific calendar modification:
powershell # Run only after explicit write approval Disconnect-MgGraph Connect-MgGraph -Scopes "Calendars.ReadWrite" New-MgUserEvent -UserId $userId ` -Subject "Weekly review" ` -Start @{DateTime="2026-03-14T17:00:00";TimeZone="Europe/Madrid"} ` -End @{DateTime="2026-03-14T17:45:00";TimeZone="Europe/Madrid"}Additional hardening measures:
- Do not request both scopes because
Calendars.ReadWritesubsumes read access. - Place read and write commands in clearly separated documentation sections.
- Make
Calendars.Readthe documented default. - Display the exact target calendar, event data, and side effects before elevating permission.
- Disconnect or clear the Graph context after completing the approved write.
- Where supported, apply tenant consent policies and conditional-access controls to limit delegated calendar write access.
- Do not request both scopes because
