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

Domain fronting support #4

Open
ScriptIdiot opened this issue Apr 21, 2022 · 8 comments
Open

Domain fronting support #4

ScriptIdiot opened this issue Apr 21, 2022 · 8 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@ScriptIdiot
Copy link

ScriptIdiot commented Apr 21, 2022

May I know if domain fronting is supported in this case? Tried to change the host header but then it shows this error upon execution:

thread 'main' panicked at 'called Result::unwrap() on an Err value: Custom { kind: ConnectionRefused, error: "Failed to make post request" }', src/profiles/mod.rs:117:49
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

*Run on linux

Thanks!

@t94j0
Copy link
Collaborator

t94j0 commented Apr 21, 2022

I haven't tried domain fronting with this agent, but I don't think there's an option to change the host header in the options of this agent. How did you attempt to change the host header?

@ScriptIdiot
Copy link
Author

ScriptIdiot commented Apr 21, 2022

During the generation of payload, I was able to add host header to attempt to achieve domain fronting, which is working in merlin agent

image

@t94j0
Copy link
Collaborator

t94j0 commented Apr 21, 2022

Gotcha. The Host header should be there based on this code. It looks like you're getting a ConnectionRefused error, so it looks like the domain front you're connecting to is unavailable. Are you sure you can connect to the target domain/ip?

@ScriptIdiot
Copy link
Author

Yeah, I am pretty sure. Tried to establish C2 without domain front, and the exact same setting with domain front worked by using merlin agent.

@MEhrn00
Copy link
Member

MEhrn00 commented Apr 21, 2022

I believe I have tracked down the issue. The HTTP library tetanus is using is minreq and minreq will insert the callback url into the Host header before establishing the HTTP connection. The library will not check for duplicates so it will include two Host headers but pick the Host specified in the HTTP Headers section of the payload generation for the HTTP connection and ignore the callback host.

This is obviously not great behavior at all and I will need to use a different library which supports arbitrarily setting the Host header. I will look into it this weekend.

@jeffmcjunkin
Copy link

For what it's worth, between this and #1 tetanus is getting damn close to a viable top-tier C2. The only two three wish list items I'd have left are the following:

  1. .NET Assembly injection support
  2. Beacon Object File support (likely via https://github.com/trustedsec/COFFLoader)
  3. DNS C2 channel support

The first two get a lot of existing functionality for free (via projects like https://github.com/trustedsec/CS-Situational-Awareness-BOF and https://github.com/Flangvik/SharpCollection), while the third makes operations possible in a pretty restricted environment.

@MEhrn00
Copy link
Member

MEhrn00 commented Feb 24, 2023

Update on this: I am in the process of doing a rewrite for Tetanus. I currently have domain fronting support, beacon object file support and reflective DLL loading support on the road map among other things. I can see about integrating a DNS C2 profile and .NET assembly injection but it depends on when I can get the current items on my road map complete.

I will leave this issue open until the rewrite is finished. This is just to acknowledge the suggestions 👍🏻

@jeffmcjunkin
Copy link

Oooh, today I learned of https://github.com/hakaioffsec/coffee, which may be of interest as an easier path to implementing Beacon Object Files.

In other news, is there any rough planned timeframe for the rewrite / release?

@MEhrn00 MEhrn00 self-assigned this Feb 18, 2024
@MEhrn00 MEhrn00 added the v0.2.0/rewrite v0.2.0 label Feb 18, 2024
@MEhrn00 MEhrn00 added bug Something isn't working enhancement New feature or request and removed v0.2.0/rewrite v0.2.0 labels Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

4 participants