Skip to content

Commit fe54768

Browse files
committed
2 parents e46957c + 8637aba commit fe54768

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

README.md

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Please refer to the [Wiki](https://github.com/mlcsec/Graphpython/wiki) for the f
146146
* **Get-AppRoleAssignments** - Get application role assignments for current user (default) or target user
147147
* **Get-ConditionalAccessPolicy** - Get conditional access policy properties
148148
* **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
149150
* **Get-ServicePrincipal** - Get Service Principal details
150151
* **Get-ServicePrincipalAppRoleAssignments** - Get Service Principal app role assignments (shows available admin consent permissions that are already granted)
151152
* **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
187188
* **Invoke-CustomQuery** - Custom GET query to target Graph API endpoint
188189
* **Invoke-Search** - Search for string within entity type (driveItem, message, chatMessage, site, event)
189190
* **Find-PrivilegedRoleUsers** - Find users with privileged roles assigned
191+
* **Find-PrivilegedApplications** - Find privileged apps (via their service principal) with granted admin consent API permissions
190192
* **Find-UpdatableGroups** - Find groups which can be updated by the current user
191193
* **Find-SecurityGroups** - Find security groups and group members
192194
* **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
395397

396398
![](./.github/assignprivilegedrole.png)
397399

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+
![](./.github/apiperms.png)
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+
![](./.github/findprivilegedapps.png)
416+
417+
398418
### Spoof-OWAEmailMessage
399419

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.
401421

402-
> Mail.Send permission REQUIRED for --id spoofing
422+
> Mail.Send permission REQUIRED for `--id` spoofing
403423
404424
Options:
405425
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
460480

461481
### Get-DeviceConfigurationPolicies
462482

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):
464484

465485
![](./.github/getdeviceconfigurationpolicies.png)
466486

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+
467489
<br>
468490

469491
## Post-Auth Intune Exploitation
@@ -490,22 +512,22 @@ Create a new script locally with the existing content and your malicious code ad
490512

491513
![](./.github/createdirbackdoored.png)
492514

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:
494516

495517
![](./.github/backdoorscript.png)
496518

497519

498520
### Deploy-MaliciousScript
499521

500-
Creating the new script and assignment options:
522+
Create a new script with desired properties (signature check, run as account, etc.):
501523

502524
![](./.github/deploymaliciousscript.png)
503525

504526
Verified creation and assignment options in Microsoft Intune admin center:
505527

506528
![](./.github/deploymaliciousscript-intuneportal.png)
507529

508-
> 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.
509531
510532
### Add-ExclusionGroupToPolicy
511533

@@ -554,7 +576,7 @@ Check the members of the target group:
554576

555577
![](./.github/getgroupmember.png)
556578

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:
558580

559581
![](./.github/removegroupmember.png)
560582

@@ -601,7 +623,7 @@ Graph permission IDs applied to objects can be easily located with detailed expl
601623
- [x] `Get-DeviceConfigurationPolicies` - tidy up the templateReference and assignmentTarget output
602624
- [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
603625
- New:
604-
- [x] `Find-PrivilegedApplications` - identify enterprise applications which have
626+
- [x] `Find-PrivilegedApplications` - identify enterprise applications which have privileged graph api permissions granted
605627
- [x] `Grant-AppAdminConsent` - grant admin consent for requested/applied admin app permissions (if `Add-ApplicationPermission` fails)
606628
- [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)
607629
- [ ] `Deploy-MaliciousWin32App` - use IntuneWinAppUtil.exe to package the EXE/MSI and deploy to devices

0 commit comments

Comments
 (0)