You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-8Lines changed: 30 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,6 +146,7 @@ Please refer to the [Wiki](https://github.com/mlcsec/Graphpython/wiki) for the f
146
146
***Get-AppRoleAssignments** - Get application role assignments for current user (default) or target user
147
147
***Get-ConditionalAccessPolicy** - Get conditional access policy properties
148
148
***Get-Application** - Get Enterprise Application details for app (NOT object) ID
149
+
***Get-AppServicePrincipal** - Get details of the application's service principal from the app ID
149
150
***Get-ServicePrincipal** - Get Service Principal details
150
151
***Get-ServicePrincipalAppRoleAssignments** - Get Service Principal app role assignments (shows available admin consent permissions that are already granted)
151
152
***Get-PersonalContacts** - Get contacts of the current user
@@ -187,6 +188,7 @@ Please refer to the [Wiki](https://github.com/mlcsec/Graphpython/wiki) for the f
187
188
***Invoke-CustomQuery** - Custom GET query to target Graph API endpoint
188
189
***Invoke-Search** - Search for string within entity type (driveItem, message, chatMessage, site, event)
189
190
***Find-PrivilegedRoleUsers** - Find users with privileged roles assigned
191
+
***Find-PrivilegedApplications** - Find privileged apps (via their service principal) with granted admin consent API permissions
190
192
***Find-UpdatableGroups** - Find groups which can be updated by the current user
191
193
***Find-SecurityGroups** - Find security groups and group members
192
194
***Find-DynamicGroups** - Find groups with dynamic membership rules
@@ -395,11 +397,29 @@ Assign a privileged role via template ID to a user or group and define permissio
395
397
396
398

397
399
400
+
401
+
### Find-PrivilegedApplications
402
+
403
+
Applications can be granted privileged Graph API permissions via 'Grant admin consent...' option for permissions marked 'Admin consent required':
404
+
405
+

406
+
407
+
The `Find-PrivilegedApplications` command helps to identify high-value apps that have already been assigned with privileged permssions:
408
+
409
+
1. identifies all enterprise/registered applications within Entra (no default Msoft ones included)
410
+
2. finds the service principal id for each application
411
+
3. enumerates app role assignments for each application service principal
412
+
4. cross-references assigned app role IDs and data against .github/graphpermissions.txt
413
+
5. displays assigned role name and description
414
+
415
+

416
+
417
+
398
418
### Spoof-OWAEmailMessage
399
419
400
-
Send emails using a compromised user's Outlook mail box. The --id parameter can be used to send emails as other users within the organistion.
420
+
Send emails using a compromised user's Outlook mail box. The `--id` parameter can be used to send emails as other users within the organistion.
401
421
402
-
> Mail.Send permission REQUIRED for --id spoofing
422
+
> Mail.Send permission REQUIRED for `--id` spoofing
403
423
404
424
Options:
405
425
1. Compromise and auth as an application service principal with the `Mail.Send` permission assigned then use `Spoof-OWAEmailMessage`
@@ -460,10 +480,12 @@ Similarly you can identify all Intune managed devices and details belonging to a
460
480
461
481
### Get-DeviceConfigurationPolicies
462
482
463
-
Identify all created device configuration policies across the Intune environment. This includes Antivirus (Defender), Disk encryption (Bitlocker), Firewall (policies and rules), EDR, and Attack Surface Reduction (ASR):
483
+
Identify all created device configuration policies across the Intune environment with colour highlighting for policies with active/no assignments. This includes Antivirus (Defender), Disk encryption (Bitlocker), Firewall (policies and rules), EDR, and Attack Surface Reduction (ASR):
464
484
465
485

466
486
487
+
In the example above you can see an ASR policy in place which is assigned to all users and devices, however members of group ID `46a6...` are excluded. There is a Bitlocker policy but it hasn't been assigned to any devices.
488
+
467
489
<br>
468
490
469
491
## Post-Auth Intune Exploitation
@@ -490,22 +512,22 @@ Create a new script locally with the existing content and your malicious code ad
490
512
491
513

492
514
493
-
Supply the backdoored script to the --script flag which will then patch the existing script:
515
+
Supply the backdoored script to the `--script` flag which will then patch the existing script:
494
516
495
517

496
518
497
519
498
520
### Deploy-MaliciousScript
499
521
500
-
Creating the new script and assignment options:
522
+
Create a new script with desired properties (signature check, run as account, etc.):
501
523
502
524

503
525
504
526
Verified creation and assignment options in Microsoft Intune admin center:
> NOTE: Deploy-PrinterSettings.ps1 is used for the actual script name instead of whatever is supplied to --script. Recommended updating this in graphpython.py to blend in to target env.
530
+
> NOTE: Deploy-PrinterSettings.ps1 is used for the actual script name instead of whatever is supplied to `--script`. Recommended updating this in graphpython.py to blend in to target env.
509
531
510
532
### Add-ExclusionGroupToPolicy
511
533
@@ -554,7 +576,7 @@ Check the members of the target group:
554
576
555
577

556
578
557
-
Remove the group member by first supplying the groupid and object id to the --id flag:
579
+
Remove the group member by first supplying the groupid and object id to the `--id` flag:
558
580
559
581

560
582
@@ -601,7 +623,7 @@ Graph permission IDs applied to objects can be easily located with detailed expl
601
623
-[x]`Get-DeviceConfigurationPolicies` - tidy up the templateReference and assignmentTarget output
602
624
-[x]`Add-ApplicationPermission` - updated logic and added ability to grant admin consent for admin permissions assigned from the same command - update `Grant-AppAdminConsent` to handle any failures so users don't have to repeat this whole command again
603
625
- New:
604
-
-[x]`Find-PrivilegedApplications` - identify enterprise applications which have
626
+
-[x]`Find-PrivilegedApplications` - identify enterprise applications which have privileged graph api permissions granted
605
627
-[x]`Grant-AppAdminConsent` - grant admin consent for requested/applied admin app permissions (if `Add-ApplicationPermission` fails)
606
628
-[x]`Backdoor-Script` - first user downloads target script content then adds their malicious code, supply updated script as args, encodes then [patch](https://learn.microsoft.com/en-us/graph/api/intune-shared-devicemanagementscript-update?view=graph-rest-beta)
607
629
-[ ]`Deploy-MaliciousWin32App` - use IntuneWinAppUtil.exe to package the EXE/MSI and deploy to devices
0 commit comments