repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
azure-persistence.mdMarkdown80 lines3.1 KiBsource raw download

title: "Azure AD - Persistence" section: "Cloud" sectionSlug: "cloud" sourcePath: "docs/cloud/azure/azure-persistence.md" sourceUrl: "https://github.com/swisskyrepo/InternalAllTheThings/blob/203bb0c0b290/docs/cloud/azure/azure-persistence.md" sha: "203bb0c0b290" isIndex: false#

Azure AD - Persistence#

Add Secrets to Application#

Add Service Principal#

Add User to Group#

Add-AzureADGroupMember -ObjectId <group_id> -RefObjectId <user_id> -Verbose

PowerShell Profile Backdoor Using KFM#

OneDrive for Business Known Folder Move (KFM) is a feature in Microsoft OneDrive for Business that enables users and organizations to automatically redirect the contents of key Windows user folders; Desktop, Documents, and Pictures from their local PC to OneDrive.

A PowerShell profile is a script file that loads whenever you start a new PowerShell session (such as opening PowerShell or Windows Terminal). Users and administrators often customize their profiles to set aliases, environment variables, functions, or pre-load modules.

Requirements:

Methodology:

Known Folder Move moves the user's Documents (and/or Desktop, Pictures) folder to OneDrive for Business, typically syncing:

C:\Users\<username>\Documents → C:\Users\<username>\OneDrive - <TenantName>\Documents

This means the PowerShell profile file (Documents\PowerShell\Microsoft.PowerShell_profile.ps1) will now be synced to OneDrive.

Push a malicious PowerShell profile at $HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1.

References#