Skip to content

Caddy v2 module to filter requests based on C2 profiles

License

Notifications You must be signed in to change notification settings

lum8rjack/caddy-c2

Repository files navigation

caddy-c2

Tests

Caddy v2 module to match network traffic and only allow traffic based on C2 profiles. This module currently works with the following C2 frameworks:

Installation

You can build Caddy by yourself by installing xcaddy and running:

xcaddy build --with github.com/lum8rjack/caddy-c2

If you want to clone and make any changes, you can test locally with the following command:

# Specify the location of the local build
 xcaddy build --with github.com/lum8rjack/caddy-c2=./caddy-c2

Caddyfile

Allow access to the C2 server for only requests that match the profile. Everything else is redirected to a different website. The supported frameworks include:

  • cobaltstrike
  • empire

Below is an example Caddyfile for use with Cobalt Strike.

{
  admin off
  debug
}

https://test.example.com {
  @c2 {
    c2_profile {
      profile "/usr/share/cobaltstrike/cobaltstrike.profile"
      framework "cobaltstrike"
    }
  }

  handle @c2 {
    reverse_proxy https://localhost:8080 {
      header_up Host {http.request.host}
      transport http {
        tls
        tls_insecure_skip_verify
      }
    }
  }

  handle /* {
    redir https://example.com{uri}
  }
}

Future Improvements

References

  • SeeProxy - Go reverse proxy with Cobalt Strike malleable profile validation. This project gave me the idea to create this caddy module.
  • goMalleable - Cobalt Strike malleable C2 profile parser
  • Malleable-C2-Profiles - Cobalt Strike template used for testing.

About

Caddy v2 module to filter requests based on C2 profiles

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages