GithubHelp home page GithubHelp logo

hausec / powerzure Goto Github PK

View Code? Open in Web Editor NEW
1.1K 1.1K 159.0 49.91 MB

PowerShell framework to assess Azure security

License: BSD 3-Clause "New" or "Revised" License

PowerShell 100.00%
azure infosec powershell security windows

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

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

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  
    }
}

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

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 ?

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.

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.

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.