Giter VIP home page Giter VIP logo

ansible-role-cobalt-strike's Introduction

ansible-role-cobalt-strike

GitHub Build Status CodeQL

An Ansible role for installing Cobalt Strike.

Pre-requisites

In order to execute the Molecule tests for this Ansible role in GitHub Actions, a build user must exist in AWS. The accompanying Terraform code will create the user with the appropriate name and permissions. This only needs to be run once per project, per AWS account. This user can also be used to run the Molecule tests on your local machine.

Before the build user can be created, you will need a profile in your AWS credentials file that allows you to read and write your remote Terraform state. (You almost certainly do not want to use local Terraform state for this long-lived build user.) If the build user is to be created in the CISA COOL environment, for example, then you will need the cool-terraform-backend profile.

The easiest way to set up the Terraform remote state profile is to make use of our aws-profile-sync utility. Follow the usage instructions in that repository before continuing with the next steps, and note that you will need to know where your team stores their remote profile data in order to use aws-profile-sync.

To create the build user, follow these instructions:

cd terraform
terraform init --upgrade=true
terraform apply

Once the user is created you will need to update the repository's secrets with the new encrypted environment variables. This should be done using the terraform-to-secrets tool available in the development guide. Instructions for how to use this tool can be found in the "Terraform IAM Credentials to GitHub Secrets" section. of the Project Setup README.

If you have appropriate permissions for the repository you can view existing secrets on the appropriate page in the repository's settings.

Requirements

None.

Role Variables

Variable Description Default Required
cobalt_strike_bucket_name The name of the AWS S3 bucket where the Cobalt Strike tarball and license files are stored. cisa-cool-third-party-production No
cobalt_strike_license_object_name The name of the AWS S3 object that is the Cobalt Strike license. cobaltstrike.license No

Dependencies

Installation

This role can be installed via the command:

ansible-galaxy install --role-file path/to/requirements.yml

where requirements.yml looks like:

---
- name: cobalt_strike
  src: https://github.com/cisagov/ansible-role-cobalt-strike

and may contain other roles as well.

For more information about installing Ansible roles via a YAML file, please see the ansible-galaxy documentation.

Example Playbook

Here's how to use it in a playbook:

- hosts: all
  become: true
  become_method: sudo
  tasks:
    - name: Install Cobalt Strike
      ansible.builtin.include_role:
        name: cobalt_strike

Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

License

This project is in the worldwide public domain.

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.

Author Information

Shane Frasier - [email protected]

ansible-role-cobalt-strike's People

Contributors

arcsector avatar dav3r avatar dependabot[bot] avatar felddy avatar hillaryj avatar jasonodoom avatar jmorrowomni avatar jsf9k avatar mcdonnnj avatar michaelsaki 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-cobalt-strike's Issues

Revert commenting out of Cobalt Strike update when possible

๐Ÿ’ก Summary

In #30 I commented out the Ansible code that upgrades the Cobalt Strike server as a workaround for a bug in version 4.3 that affected PCAs. This change should be reverted once a version of Cobalt Strike that fixes the bug is released.

Motivation and context

It's best to be using the latest version of Cobalt Strike once that is a possibility, so that that we get other improvements and bug fixes.

Acceptance criteria

  • This Ansible role is once again installing the latest version of Cobalt Strike.

CobaltStrike 4.6 must be installed manually

๐Ÿ’ก Summary

CobaltStrike 4.6 has recently come out and will require the new package be downloaded from their website directly. Every subsequent update can follow the same process that is currently used (utilizing the update binary located in the /opt/cobaltstrike folder on the Kali and TeamServer images).

Motivation and context

If we don't pull the latest version of CobaltStrike directly from their website for 4.6 we will be unable to continue to use the latest features of CobaltStrike moving forward.

Implementation notes

Please see the following blog which further outlines why this is necessary (https://www.cobaltstrike.com/blog/cobalt-strike-4-6-the-line-in-the-sand/)

Acceptance criteria

How do we know when this work is done?

  • CobaltStrike 4.6 has been downloaded and installed on the Kali AMI
  • CobaltStrike 4.6 has been downloaded and installed on the TeamServer AMI
  • We can once again use the update binary located in the /opt/cobaltstrike directory to update future instances (This will be possible only after downloaded and installing CobaltStrike 4.6)

Cobalt Strike upgrade fails

๐Ÿ› Summary

One can see from the output of the Ansible task that the Cobalt Strike upgrade fails, although the return value of the process itself still indicates success.

To reproduce

Steps to reproduce the behavior:

  1. molecule --verbose converge
  2. Look at the output of the Cobalt Strike update task.

Currently unable to update Cobalt Strike

๐Ÿ› Summary

The Cobalt Strike (CS) update program does not run according to the expect script in this Ansible role because there is a mismatch in the SHA-256 fingerprint for the certificate served by verify.cobaltstrike.com.

To reproduce

  1. Run the molecule tests for this Ansible role.
  2. Watch them fail when the role attempts to run the CS update program.

Expected behavior

The CS update program should complete successfully.

Any helpful log output or screenshots

Here is the content of the expect session:

spawn ./update
[+] Cobalt Strike Update (20220412)
[*] Please enter your license key:
xxxx-xxxx-xxxx-xxxx
[*] Checking for latest version
[*] Downloading the latest version of Cobalt Strike
    Downloaded 5.5mb
<snip>
    Downloaded 64.5mb
    Read 68.7mb
[+] Download complete. Unpacking Cobalt Strike program data.
[+] Unpacked Cobalt Strike program data. Now verifying the download
[*] Download latest hashes
[-] SSL certificate verification for verify.cobaltstrike.com failed.
    Observed SHA-256 fingerprint: 
      351c5c60d0b983066c2c1018113d5326da143291f861ec39e20621210d1c61d8
    Expected SHA-256 fingerprints: 
      28ecfdf1b4b8d646f57820de906e370c85dbf6288d400df3d47c5686bc002f14
      3d778be9c600a481b69fb067312e1883f8eadf3b88337f8153085e79f98c94ec
    Is someone performing SSL intercept? Don't trust this update unless
    you know why this certificate fingerprint doesn't match.
[?] Would you like to continue with this update?
(yes/no):

Role no longer able to download installer

๐Ÿ› Summary

This Ansible role is no longer able to download the Cobalt Strike installer.

To reproduce

Steps to reproduce the behavior:

  1. molecule converge

Expected behavior

The role should download and install Cobalt Strike.

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.