Git Product home page Git Product logo

powerzure's Introduction

powerzure

For a list of functions, their usage, and more, check out https://powerzure.readthedocs.io

What is PowerZure?

PowerZure is a PowerShell project created to assess and exploit resources within Microsoft’s cloud platform, Azure. PowerZure was created out of the need for a framework that can both perform reconnaissance and exploitation of Azure, EntraID, and the associated resources.

Requirements

The "Az" Azure PowerShell module is the primary module used in PowerZure, as it handles most requests interacting with Azure resources. The Az module interacts using the Azure REST API. It can be installed via PowerShell command Install-Module -Name Az

Usage

RTFM: https://powerzure.readthedocs.io

ipmo C:\path\to\PowerZure.psd1

If you have multiple subscriptions, you must set the main subscription with Set-AzureSubscription. If you do not do this, things will fail.

Additional Resources

You can type Get-AzureCurrentUser to view the current signed-in user's roles in Azure and EntraID.

You can also type Get-AzureTarget to compare your current signed-in user's roles and their scope to resources within Azure.

For target finding, I recommend using AzureHound, the Azure component to BloodHound.

Author & License

Author: Ryan Hausknecht (@haus3c)

License: BSD-3

powerzure's People

Contributors

cyberfreaq avatar hausec avatar paralax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

powerzure's Issues

Ideas - audit public resources

Absolutely phenomenal tool!
What do you think about adding more public searching of resources to powerzure?
So for example Powerzure would query:

  • Public storage - Blobs, tables, etc.
  • Virtual machines with public IP
  • sql databases
    etc.

The command to set the subscription in the script output is wrong

Hello,

There is a mistake in the script output when you did not set a subscription.

The script output is currently the following:

Please set your default subscription with 'Set-Subscription --subscription {id}

However the good one is this one:

Set-Subscription -Id {id}

or

az account set --subscription {id}

Thank you

Cannot convert null to type "System.DateTime"

Thanks for the tool, very promising :)

I ran into this issue while testing it...

PS C:\Users\user\Desktop> Import-Module .\PowerZure.ps1
New-PSGetItemInfo : Cannot convert null to type "System.DateTime".
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2253 char:102
                         + ... ach-Object {New-PSGetItemInfo -SoftwareIdentity $_ -Type $script:PSAr ...
                         +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 + CategoryInfo          : MetadataError: (:) [New-PSGetItemInfo],
ArgumentTransformationMetadataException
+ FullyQualifiedErrorId : RuntimeException,New-PSGetItemInfo     

Do you have any idea ?

Missing Get-AllAppSecrets and Get-AllSecrets Commands

In @hausec 's blog post announcing PowerZure, it describes a number of commands including Get-AllAppSecrets and Get-AllSecrets. Based on the description, these commands would return information such as App Secrets in a connected Azure subscription that the user account has access to. However, these commands do not seem to exist in the codebase currently. I also do not see any equivalent commands for retrieving such secrets?

Additionally, in the CONVEX CTF published by Azure, they include a scenario where one steals credentials stored in an App Service's Application Settings. It would be useful if PowerZure would automatically dump the contents of Application Settings and Connection Strings for App Services.

Add-AzureSPSecret fails

Microsoft renamed .objectId to .id.
So the code at line 1611 would have to be adjusted to $Uri = 'https://graph.microsoft.com/beta/applications/' + $App.id + '/addPassword'. There might be other places where this breaks functionality..

Get-AzureRunbookContent -All -OutfilePath isn't working properly

When trying to specify the OutFilePath directory to save the runbook content it doesn't save to the specified directory. Instead it keeps saving the runbook content to: C:\Windows\System32\

Additionally it keeps spitting an error when it encounters a runbook that already exists on disk and tells us to specify the force switch to overwrite the content. Looking through the code and documentation I didn't see any reference to the force option (unless its straight from the az login command)

Commands Ran:
Get-AzureRunbookContent -All -OutFilePath 'C:\TEMP\hi'
Get-AzureRunbookContent -All -OutFilePath 'C:\TEMP\hi'

To fix this issue you can use the following code for the Get-AzureRunbookContent function (this will force an overwrite if the runbook already exists in the output location):

function Get-AzureRunbookContent
{
 <#
.SYNOPSIS
    Gets a specific Runbook and displays its contents. 

.PARAMETER
    -Runbook (Name of Runbook)
    -All 
    -OutFilePath (Where to save Runbook)

.EXAMPLE
    Get-AzureRunbookContent -Runbook Runbooktest -OutFilePath 'C:\temp'
    Get-AzureRunbookContent -All -OutFilePath 'C:\temp'

#>
    [CmdletBinding()]
     Param(
    [Parameter(Mandatory=$false)][String]$Runbook = $null,
    [Parameter(Mandatory=$true)][String]$OutFilePath = $null,
    [Parameter(Mandatory=$false)][Switch]$All = $null)

    If($Runbook)
    {
        $Book = Get-AzAutomationAccount | Get-AzAutomationRunbook | Where-Object {$_.Name -eq $Runbook}
        Export-AzAutomationRunbook -ResourceGroupName $Book.ResourceGroupName -AutomationAccountName $Book.AutomationAccountName -Name $Runbook -OutputFolder $OutFilePath -Force
    }
    If($All)
    {
        $Books = Get-AzAutomationAccount | Get-AzAutomationRunbook
        ForEach($Book in $Books)
        {
            Export-AzAutomationRunbook -ResourceGroupName $Book.ResourceGroupName -AutomationAccountName $Book.AutomationAccountName -Name $Book.Name -OutputFolder $OutFilePath -Force
        }
    }
    If(!$All -and !$Runbook)
    {
      Write-Host "Usage:" -ForegroundColor Red  
      Write-Host "Get-AzureRunbookContent -Runbook Runbooktest -OutFilePath 'C:\temp'" -ForegroundColor Red  
      Write-Host "Get-AzureRunbookContent -All -OutFilePath 'C:\temp'" -ForegroundColor Red  
    }
}

getting immediate error when launching PowerZure

First, I connect to my account using my "root" user with connect-azaccount
Then I import Powerzure

PowerZure : Cannot validate argument on parameter 'ObjectId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again

  • PowerZure -Checks -Banner -Welcome

  • CategoryInfo : InvalidData: (:) [PowerZure], ParameterBindingValidationException

  • FullyQualifiedErrorId : ParameterArgumentValidationError,PowerZure

New-AzureBackdoor RemoteServer connection error 404

Running New-AzureBackdoor command and getting this error output. Anybody else run the same issue and how to solve? Thanks in advance for feedback.

Invoke-RestMethod : Remote Server raise an error : (404) Not found.
In C:\Users\Vidad\Desktop\Azure-Tools\PowerZure-master\PowerZure.psm1:1350

  • $req = Invoke-RestMethod -Headers $Headers -Method Post -Body $bo ...
    
  •        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Unprivileged Users Not Supported?

I think since the merge of the dev branch it is no longer possible to use PowerZure with users who do not have an active subscription. During initialization PowerZure throws the error Get-AzRoleAssignment : Object reference not set to an instance of an object.

I think, most of the users "owned" during an assessment won't have any active subscriptions. Wouldn't it be better, if you could also query Azure/Azure AD with those users (or at least the parts of Azure, to which the users possibly have some access to) or am I missing something here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.