Cyber security

ADOKit: Azure DevOps Services Attack Toolkit

Azure DevOps Services Attack Toolkit – ADOKit is a toolkit that can be used to attack Azure DevOps Services by taking advantage of the available REST API. The tool allows the user to specify an attack module, along with specifying valid credentials (API key or stolen authentication cookie) for the respective Azure DevOps Services instance. The attack modules supported include reconnaissance, privilege escalation and persistence. ADOKit was built in a modular approach, so that new modules can be added in the future by the information security community.

Full details on the techniques used by ADOKit are in the X-Force Red whitepaper.

Release

  • Version 1.0 of ADOKit can be found in Releases

Installation/Building

Libraries Used

The below 3rd party libraries are used in this project.

LibraryURLLicense
FodyLinkMIT License
Newtonsoft.JsonLinkMIT License

Pre-Compiled

  • Use the pre-compiled binary in Releases

Building Yourself

Take the below steps to setup Visual Studio in order to compile the project yourself. This requires two .NET libraries that can be installed from the NuGet package manager.

  • Load the Visual Studio project up and go to “Tools” –> “NuGet Package Manager” –> “Package Manager Settings”
  • Go to “NuGet Package Manager” –> “Package Sources”
  • Add a package source with the URL https://api.nuget.org/v3/index.json
  • Install the Costura.Fody NuGet package.
    • Install-Package Costura.Fody -Version 3.3.3
  • Install the Newtonsoft.Json package
    • Install-Package Newtonsoft.Json
  • You can now build the project yourself!

Command Modules

  • Recon
    • check – Check whether organization uses Azure DevOps and if credentials are valid
    • whoami – List the current user and its group memberships
    • listrepo – List all repositories
    • searchrepo – Search for given repository
    • listproject – List all projects
    • searchproject – Search for given project
    • searchcode – Search for code containing a search term
    • searchfile – Search for file based on a search term
    • listuser – List users
    • searchuser – Search for a given user
    • listgroup – List groups
    • searchgroup – Search for a given group
    • getgroupmembers – List all group members for a given group
    • getpermissions – Get the permissions for who has access to a given project
  • Persistence
    • createpat – Create personal access token for user
    • listpat – List personal access tokens for user
    • removepat – Remove personal access token for user
    • createsshkey – Create public SSH key for user
    • listsshkey – List public SSH keys for user
    • removesshkey – Remove public SSH key for user
  • Privilege Escalation
    • addprojectadmin – Add a user to the “Project Administrators” for a given project
    • removeprojectadmin – Remove a user from the “Project Administrators” group for a given project
    • addbuildadmin – Add a user to the “Build Administrators” group for a given project
    • removebuildadmin – Remove a user from the “Build Administrators” group for a given project
    • addcollectionadmin – Add a user to the “Project Collection Administrators” group
    • removecollectionadmin – Remove a user from the “Project Collection Administrators” group
    • addcollectionbuildadmin – Add a user to the “Project Collection Build Administrators” group
    • removecollectionbuildadmin – Remove a user from the “Project Collection Build Administrators” group
    • addcollectionbuildsvc – Add a user to the “Project Collection Build Service Accounts” group
    • removecollectionbuildsvc – Remove a user from the “Project Collection Build Service Accounts” group
    • addcollectionsvc – Add a user to the “Project Collection Service Accounts” group
    • removecollectionsvc – Remove a user from the “Project Collection Service Accounts” group
    • getpipelinevars – Retrieve any pipeline variables used for a given project.
    • getpipelinesecrets – Retrieve the names of any pipeline secrets used for a given project.
    • getserviceconnections – Retrieve the service connections used for a given project.

Arguments/Options

  • /credential: – credential for authentication (PAT or Cookie). Applicable to all modules.
  • /url: – Azure DevOps URL. Applicable to all modules.
  • /search: – Keyword to search for. Not applicable to all modules.
  • /project: – Project to perform an action for. Not applicable to all modules.
  • /user: – Perform an action against a specific user. Not applicable to all modules.
  • /id: – Used with persistence modules to perform an action against a specific token ID. Not applicable to all modules.
  • /group: – Perform an action against a specific group. Not applicable to all modules.

Authentication Options

Below are the authentication options you have with ADOKit when authenticating to an Azure DevOps instance.

  • Stolen Cookie – This will be the UserAuthentication cookie on a user’s machine for the .dev.azure.com domain.
    • /credential:UserAuthentication=ABC123
  • Personal Access Token (PAT) – This will be an access token/API key that will be a single string.
    • /credential:apiToken

Module Details Table

The below table shows the permissions required for each module.

Attack ScenarioModuleSpecial Permissions?Notes
ReconcheckNo
ReconwhoamiNo
ReconlistrepoNo
ReconsearchrepoNo
ReconlistprojectNo
ReconsearchprojectNo
ReconsearchcodeNo
ReconsearchfileNo
ReconlistuserNo
ReconsearchuserNo
ReconlistgroupNo
ReconsearchgroupNo
RecongetgroupmembersNo
RecongetpermissionsNo
PersistencecreatepatNo
PersistencelistpatNo
PersistenceremovepatNo
PersistencecreatesshkeyNo
PersistencelistsshkeyNo
PersistenceremovesshkeyNo
Privilege EscalationaddprojectadminYes – Project Administrator, Project Collection Administrator or Project Collection Service Accounts
Privilege EscalationremoveprojectadminYes – Project Administrator, Project Collection Administrator or Project Collection Service Accounts
Privilege EscalationaddbuildadminYes – Project Administrator, Project Collection Administrator or Project Collection Service Accounts
Privilege EscalationremovebuildadminYes – Project Administrator, Project Collection Administrator or Project Collection Service Accounts
Privilege EscalationaddcollectionadminYes – Project Collection Administrator or Project Collection Service Accounts
Privilege EscalationremovecollectionadminYes – Project Collection Administrator or Project Collection Service Accounts
Privilege EscalationaddcollectionbuildadminYes – Project Collection Administrator or Project Collection Service Accounts
Privilege EscalationremovecollectionbuildadminYes – Project Collection Administrator or Project Collection Service Accounts
Privilege EscalationaddcollectionbuildsvcYes – Project Collection Administrator, Project Colection Build Administrators or Project Collection Service Accounts
Privilege EscalationremovecollectionbuildsvcYes – Project Collection Administrator, Project Colection Build Administrators or Project Collection Service Accounts
Privilege EscalationaddcollectionsvcYes – Project Collection Administrator or Project Collection Service Accounts
Privilege EscalationremovecollectionsvcYes – Project Collection Administrator or Project Collection Service Accounts
Privilege EscalationgetpipelinevarsYes – Contributors or Readers or Build Administrators or Project Administrators or Project Team Member or Project Collection Test Service Accounts or Project Collection Build Service Accounts or Project Collection Build Administrators or Project Collection Service Accounts or Project Collection Administrators
Privilege EscalationgetpipelinesecretsYes – Contributors or Readers or Build Administrators or Project Administrators or Project Team Member or Project Collection Test Service Accounts or Project Collection Build Service Accounts or Project Collection Build Administrators or Project Collection Service Accounts or Project Collection Administrators
Privilege EscalationgetserviceconnectionsYes – Project Administrator, Project Collection Administrator or Project Collection Service Accounts

Examples

Validate Azure DevOps Access

Use Case

Perform authentication check to ensure that organization is using Azure DevOps and that provided credentials are valid.

Syntax

Provide the check module, along with any relevant authentication information and URL. This will output whether the organization provided is using Azure DevOps, and if so, will attempt to validate the credentials provided.

ADOKit.exe check /credential:apiKey /url:https://dev.azure.com/organizationName

ADOKit.exe check /credential:"UserAuthentication=ABC123" /url:https://dev.azure.com/organizationName

Example Output

C:\>ADOKit.exe check /credential:apiKey /url:https://dev.azure.com/YourOrganization

==================================================
Module:         check
Auth Type:      API Key
Search Term:
Target URL:     https://dev.azure.com/YourOrganization

Timestamp:      3/28/2023 3:33:01 PM
==================================================


[*] INFO: Checking if organization provided uses Azure DevOps

[+] SUCCESS: Organization provided exists in Azure DevOps


[*] INFO: Checking credentials provided

[+] SUCCESS: Credentials provided are VALID.

3/28/23 19:33:02 Finished execution of check

For more click here.

Varshini

Tamil has a great interest in the fields of Cyber Security, OSINT, and CTF projects. Currently, he is deeply involved in researching and publishing various security tools with Kali Linux Tutorials, which is quite fascinating.

Recent Posts

Kali Linux 2024.4 Released, What’s New?

Kali Linux 2024.4, the final release of 2024, brings a wide range of updates and…

4 hours ago

Lifetime-Amsi-EtwPatch : Disabling PowerShell’s AMSI And ETW Protections

This Go program applies a lifetime patch to PowerShell to disable ETW (Event Tracing for…

4 hours ago

GPOHunter – Active Directory Group Policy Security Analyzer

GPOHunter is a comprehensive tool designed to analyze and identify security misconfigurations in Active Directory…

2 days ago

2024 MITRE ATT&CK Evaluation Results – Cynet Became a Leader With 100% Detection & Protection

Across small-to-medium enterprises (SMEs) and managed service providers (MSPs), the top priority for cybersecurity leaders…

5 days ago

SecHub : Streamlining Security Across Software Development Lifecycles

The free and open-source security platform SecHub, provides a central API to test software with…

1 week ago

Hawker : The Comprehensive OSINT Toolkit For Cybersecurity Professionals

Don't worry if there are any bugs in the tool, we will try to fix…

1 week ago