Giter VIP home page Giter VIP logo

skyark's Introduction

alt text

SkyArk is a cloud security project with two main scanning modules:

  1. AzureStealth - Scans Azure environments
  2. AWStealth - Scan AWS environments

These two scanning modules will discover the most privileged entities in the target AWS and Azure.

The Main Goal - Discover The Most Privileged Cloud Users

SkyArk currently focuses on mitigating the new threat of Cloud Shadow Admins, and helps organizations to discover, assess and protect cloud privileged entities.
Stealthy and undercover cloud admins may reside in every public cloud platform and SkyArk helps mitigating the risk in AWS and Azure.
In defensive/pentest/risk assessment procedures - make sure to address the threat and validate that those privileged entities are indeed well secured.

Note: In addition to SkyArk, you can try CyberArk Cloud Entitlements Manager for free, it offers discovery and remediation of all excessive permissions – not only those for admins and shadow admins – across AWS, Azure, and GCP. You can test these capabilities at cyberark.com/cem.

Background:

SkyArk deals with the new uprising threat of Cloud Shadow Admins - how attackers can find and abuse non-trivial and so-called “limited” permissions to still make it through and escalate their privileges and become full cloud admins.
Furthermore, attackers can easily use those tricky specific permissions to hide stealthy admin entities that will wait for them as an undercover persistence technique.

SkyArk was initially published as part of our research on the threat of AWS Shadow Admins, this research was presented at RSA USA 2018 conference.
The AWS Shadow Admins blog post:
https://www.cyberark.com/threat-research-blog/cloud-shadow-admin-threat-10-permissions-protect/
The recording of the RSA talk:
https://www.youtube.com/watch?v=mK62I1BNmXs

About a year later, we added the AzureStealth scan to SkyArk for mitigating the Shadow Admins threat in Azure! Our research on Azure Shadow Admins threat was presented at RSA USA 2020 and Hackfest conferences. DIY: Hunting Azure Shadow Admins Like Never Before - blog post:
https://www.cyberark.com/resources/threat-research-blog/diy-hunting-azure-shadow-admins-like-never-before-2

Tool Description

SkyArk currently contains two main scanning modules AWStealth and AzureStealth.
With the scanning results - organizations can discover the entities (users, groups and roles) who have the most sensitive and risky permissions.
In addition, we also encourage organizations to scan their environments from time to time and search for suspicious deviations in their privileged entities list.
Potential attackers are hunting for those users and the defensive teams should make sure these privileged users are well secured - have strong, rotated and safety stored credentials, have MFA enabled, being monitored carefully, etc.
Remember that we cannot protect the things we don’t aware of, and SkyArk helps in the complex mission of discovering the most privileged cloud entities - including the straight-forward admins and also the stealthy shadow admins that could easily escalate their privileges and become full admins as well.

1. AzureStealth Scan

Discover the most privileged users in the scanned Azure environment - including the Azure Shadow Admins.

How To Run AzureStealth
The full details are in the AzureStealth's Readme file:
https://github.com/cyberark/SkyArk/blob/master/AzureStealth/README.md
In short:

  1. Download/sync locally the SkyArk project
  2. Open PowerShell in the SkyArk folder with the permission to run scripts:
    "powershell -ExecutionPolicy Bypass -NoProfile"
  3. Run the following commands:
(1) Import-Module .\SkyArk.ps1 -force
(2) Start-AzureStealth

AzureStealth needs only Read-Only permissions over the scanned Azure Directory (Tenant) and Subscription.
*You can also run the scan easily from within the Azure Portal by using the built-in CloudShell:

   (1) IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/cyberark/SkyArk/master/AzureStealth/AzureStealth.ps1')  
   (2) Scan-AzureAdmins  

AzureStealth DEMO:
Demo

2. AWStealth Scan

Discover the most privileged entities in the scanned AWS environment - including the AWS Shadow Admins.

How To Run AWStealth
The full details are in the AWStealth's Readme file:
https://github.com/cyberark/SkyArk/tree/master/AWStealth
In short:

  1. Download/sync locally the SkyArk project
  2. Open PowerShell in the SkyArk folder with the permission to run scripts:
    "powershell -ExecutionPolicy Bypass -NoProfile"
  3. Run the following commands:
(1) Import-Module .\SkyArk.ps1 -force
(2) Start-AWStealth

AWStealth needs only Read-Only permissions over the IAM service of the scanned AWS environment.

AWStealth DEMO:
Demo

3. SkyArk includes more small sub-modules for playing around in the cloud security field

An example for such a sub-module is AWStrace module.
AWStrace - analyzes AWS CloudTrail Logs and can provide new valuable insights from CloudTrail logs.
It especially prioritizes risky sensitive IAM actions that potential attackers might use as part of their malicious actions as AWS Shadow Admins.
The module analyzes the log files and produces informative csv result file with important details on each executed action in the tested environment.
Security teams can use the results files to investigate sensitive actions, discover the entities that took those actions and reveal additional valuable details on each executed and logged action.

Quick Start

Take a look at the Readme files of the scanning modules:
AzureStealth - https://github.com/cyberark/SkyArk/blob/master/AzureStealth/README.md
AWStealth - https://github.com/cyberark/SkyArk/blob/master/AWStealth/README.md

Share Your Thoughts And Feedback

Asaf Hecht (@Hechtov) and CyberArk Labs

More coverage on the uprising Cloud Shadow Admins threat:

On the threat in AWS:
ThreatPost: https://threatpost.com/cloud-credentials-new-attack-surface-for-old-problem/131304/
TechTarget\SearchCloudSecurity: https://searchcloudsecurity.techtarget.com/news/252439753/CyberArk-warns-of-shadow-admins-in-cloud-environments
SecurityBoulevard: https://securityboulevard.com/2018/05/cyberark-shows-how-shadow-admins-can-be-created-in-cloud-environments/
LastWatchDog: https://www.lastwatchdog.com/cyberark-shows-how-shadow-admins-can-be-created-in-cloud-environments/
Byron Acohido's Podcast: https://soundcloud.com/byron-acohido/cloud-privileged-accounts-flaws-exposed
On the threat in Azure:
https://www.zdnet.com/article/new-tool-detects-shadow-admin-accounts-in-aws-and-azure-environments/ https://securityinfive.com/episode-797-new-tool-helps-you-find-shadow-admin-account-in-aws-and-azure/ https://awsinsider.net/articles/2020/07/29/aws-azure-shadow-admin.aspx https://siliconangle.com/2020/07/29/cyberark-launches-open-source-shadow-admin-identification-tool-azure-aws/ https://itsecuritywire.com/quick-bytes/cyberark-introduces-shadow-admin-identification-tool-for-azure-and-aws/

skyark's People

Contributors

ayberkhalacc avatar hechtov avatar jeffrechten avatar mnthomson 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  avatar

skyark's Issues

InvalidData: (:) [Join-Path], ParameterBindingValidationException

...
[+] Scanning tenant ID: 02a%ec76-fd38-4554-a6b4-33554477884083
Retrieving information on 359 Azure AD users, great reconnaissance, check the results file in the end
Join-Path : Não é possível associar o argumento ao parâmetro 'Path' porque ele é uma cadeia de caracteres vazia.
No linha:414 caractere:50

  • ... $resultsFolder = Join-path -Path $PSScriptRoot -ChildP ...

    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

Join-Path : Não é possível associar o argumento ao parâmetro 'Path' porque ele é nulo.
No linha:417 caractere:49

  • ... $usersPhotoFolder = Join-path -Path $resultsFolder -Child ...

Name resolution failure attempting to reach service in region | e-west-2

Hi

Am trying to run this but get the following response :

Line |
635 | $managedPolicies = Get-IAMPolicyList -OnlyAttached $true
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Name resolution failure attempting to reach service in region
| e-west-2 (as supplied to the -Region parameter or from
| configured shell default). Operation timed out Operation timed
| out. Possible causes: - The region may be incorrectly
| specified (did you specify an availability zone?). - The
| service may not be available in the region. - No network
| connectivity. See
| https://docs.aws.amazon.com/general/latest/gr/rande.html for
| the latest service availability across the AWS regions.

From the output not sure if the "u" is being dropped for some reason when entering the region but am entering as follows :
Screenshot 2020-08-05 at 13 45 43

Running this on a mac - catalina v10.15.6.
Using PowerShell 7.0.3

Permissions inherited from Management Groups not shown

Most of our Azure permissions management is done through group membership and applied at Management Group level. This tool only seems to report on RBAC that is granted specifically at the subscription level rather than being inherited from Management Groups. Would it be possible to enhance it so that inherited permissions are covered too?

Bitdefender detects malware in AWSHostRecon.ps1

\SkyArk-master\SkyArk-master\AWSHostRecon\AWSHostRecon.ps1 is infected with Heur.BZC.PZQ.Boxter.692.6D1F6FA8 and was moved to quarantine. It is recommended that you run a System Scan to make sure your system is clean.

Column for Resource ID and Type

I used the project and saw that the final result does not have the resource name and resource type. How would you add these 2 features to the code?

It would be to better filter where the collaborator has permissions.

AWStealth does not support assumed roles

The script seems to assume that you're using user credentials. I user a master profile that I then reference from other profiles via AssumeRole:

[profile OtherAccount-audit]
format = json
region = us-west-2
source_profile = MasterProfile
role_arn = arn:aws:iam::111111111111:role/InfoSec-audit
external_id = xxx

The code here fails due to assuming the profile's credentials are associated with an IAM user, not a role:

$currentUser = Get-IAMUser

Get-IAMUser : Must specify userName when calling with non-User credentials
At C:\...\AWStealth.ps1:140 char:20
+     $currentUser = Get-IAMUser
+                    ~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Amazon.PowerShe...etIAMUserCmdlet:GetIAMUserCmdlet) [Get-IAMUser], InvalidOperationException
    + FullyQualifiedErrorId : Amazon.IdentityManagement.AmazonIdentityManagementServiceException,Amazon.PowerShell.Cmdlets.IAM.GetIAMUserCmdlet

I'm not sure if it's related, but the attempt to delete a temporary profile also fails here:

Remove-AWSCredentialProfile -ProfileName $tempProfile -force

Remove-AWSCredentialProfile : The CredentialProfile 'AWStealthProfile' does not exist.
At C:\...\AWStealth.ps1:1185 char:5
+     Remove-AWSCredentialProfile -ProfileName $tempProfile -force
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Amazon.PowerShe...alProfileCmdlet:RemoveAWSCredentialProfileCmdlet) [Remove-AWSCredentialProfile], ArgumentException
    + FullyQualifiedErrorId : ArgumentException,Amazon.PowerShell.Common.RemoveAWSCredentialProfileCmdlet

Support for Session Token

We only allow STS temporary API keys and Session Token.

When running Download-CloudTrailLogFiles I get the following error:

"Get-S3Object : The AWS Access Key Id you provided does not exist in our records."
AWStrace.ps1:194 char:16

My temporary keys are correct and I can do aws s3 ls and Get-S3Object commands from the command line.

/usr/bin/sort: invalid option -- 'D'

This is most likely an invalid bug report because I'm running the tool in Linux, but...

[+] Discovered 32 privileged entities in the scanned AWS environment
/usr/bin/sort: invalid option -- 'D'
Try '/usr/bin/sort --help' for more information.
[+] Exported the results to: 
"/home/andres/tools/SkyArk/AWStealth\AWStealth - Results.csv"

/usr/bin/sort: invalid option -- 'D'
Try '/usr/bin/sort --help' for more information.
-> AWStealth discovered 0 privileged entities
Cannot index into a null array.
At /home/andres/tools/SkyArk/AWStealth/AWStealth.ps1:809 char:5
+     $awsAccount = (([string]$allPrivivlgedEntities[0]).Split(":"))[4]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
 
[+] Check the final report: 
"/home/andres/tools/SkyArk/AWStealth\AWStealth - Final Report.txt"



PS /home/andres/tools/SkyArk/AWStealth> 

AWStealth - Results.csv is empty.

And the report text says:

AWStealth scanned:
2195 Users
2160 Groups
4443 Roles
90 Managed Policies
7418 Inline Policies

...

Total number of the most privileged AWS entities: 0
Total number of AWS Shadow Admins: 0

Number of privileged Users: 0
Number of privileged Groups: 0
Number of privileged Roles: 0

I know there are various shadow admins. So it seems that the sort issue broke reporting.

Enumerating all those users, groups, roles, etc. took a while and everything seemed to work well. Sadly... that final sort broke everything.

Python

I would like to build a python for SkyArk. How can I contribute?

Powershell gallery not valid error while installing azure module

Hello Guys

  It is my first time here so apologies for any mistakes i make. In our environment, our amazon skyark is working and able to scan and give report. But for some reason, I am having issues installing skyark module on our azure environment. I looked here and online but can not seem to find a solution. I am doing this on a azure server created specifically for azure skyark, and sever has gpo overide. I will post the error I am getting and hopefully one of you guys can help me resolve. Thanks! 

image

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.