Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub C2 profile malfunctioning on some situations #83

Open
armysick opened this issue Jan 13, 2025 · 3 comments
Open

GitHub C2 profile malfunctioning on some situations #83

armysick opened this issue Jan 13, 2025 · 3 comments

Comments

@armysick
Copy link

armysick commented Jan 13, 2025

Describe the bug

For the GitHub profile to work with Athena, it is mandatory that the repository is not empty, and that the default branch is named "main".

In

var baseRef = await client.Git.Reference.Get(OWNER, REPO, $"heads/main");
will fail unless two conditions are met:

  • Repository is not empty
  • Branch main exists

Expected behavior
Either handle this edge case scenario (see additional data below);
Or describe these two conditions as a quick note on the setup documentation.

Additional data

Stack trace for "Git Repository is empty" Exception (empty repo):

   at Octokit.Connection.RunRequest(IRequest request, CancellationToken cancellationToken, Func`2 preprocessResponseBody) in /_/Octokit/Http/Connection.cs:line 798
   at Octokit.Connection.Run[T](IRequest request, CancellationToken cancellationToken, Func`2 preprocessResponseBody) in /_/Octokit/Http/Connection.cs:line 783
   at Octokit.ApiConnection.Get[T](Uri uri, IDictionary`2 parameters)
   at Agent.Profiles.GitHub.StartBeacon()

Stack trace for "Not Found" Exception (main branch does not exist):

   at Octokit.Connection.RunRequest(IRequest request, CancellationToken cancellationToken, Func`2 preprocessResponseBody) in /_/Octokit/Http/Connection.cs:line 798
   at Octokit.Connection.Run[T](IRequest request, CancellationToken cancellationToken, Func`2 preprocessResponseBody) in /_/Octokit/Http/Connection.cs:line 783
   at Octokit.ApiConnection.Get[T](Uri uri, IDictionary`2 parameters)
   at Agent.Profiles.GitHub.StartBeacon()
@checkymander
Copy link
Collaborator

checkymander commented Jan 14, 2025

Thanks for the report, and recommendations! @scottctaylor12 cc'ing the creator of that profile

@scottctaylor12
Copy link

Thanks for the detailed writeup @armysick! These are great suggestions that I will add to the C2 Profile documentation immediately. Rather than hardcoding the main branch, I will make that a configurable parameter in the near future.

@scottctaylor12
Copy link

The GitHub C2 Documentation has been updated with your suggestions. Feel free to install the latest version of the GitHub C2 Profile to see the updated documentation, or check them out at: https://github.com/MythicC2Profiles/github/blob/main/documentation-c2/github/_index.md
Thank you again for submitting this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants