hausec / powerzure Goto Github PK
View Code? Open in Web Editor NEWPowerShell framework to assess Azure security
License: BSD 3-Clause "New" or "Revised" License
PowerShell framework to assess Azure security
License: BSD 3-Clause "New" or "Revised" License
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
Hmm, getting a different error though:
Get-AzRoleAssignment : The Principal ID xxxxx_live.com#EXT#@xxxxxx.onmicrosoft.com is not valid. Principal ID must be a GUID
Originally posted by @halfluke in #6 (comment)
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
}
}
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..
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 ?
The docs mention a "Get-AzureGroup" command that does not exist.
https://powerzure.readthedocs.io/en/latest/Functions/infogathering.html#get-azuregroup
I think it should be Get-AzureADGroup ?
Absolutely phenomenal tool!
What do you think about adding more public searching of resources to powerzure?
So for example Powerzure would query:
minor doc error:
Docs say Get-AzureDeviceOwner but command is actually Get-AzureDeviceOwners
Add-AzureSPSecret function only allows to input -ApplicationName, not -Password.
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.
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
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 ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.