Ne0nd0g / merlin

Merlin is a cross-platform post-exploitation HTTP/2 Command & Control server and agent written in golang.
GNU General Public License v3.0
5.03k stars 798 forks source link

Wit ll not run on AJAX Linux #108

Closed prizzy123 closed 2 years ago

prizzy123 commented 3 years ago

Hey guys,

This is a fantastic tool! I am trying to run Merlin through AJAX linux web console but am unable to do so. I have researched this for literally days on end to no avail. I have attempted to install go on AJAX but there are no env tables that I can find in the code, I have attempted to create a bash file of the server from Kali and tried uploading to AJAX and that did not even seem to recognize the bash file as a .sh file at all. Can someone help?

Prerequisite

Environment Data

Expected Behavior

Run merlin server within Ajax

Actual Behavior

Steps to Reproduce Behavior

Misc Information

Ne0nd0g commented 3 years ago

@prizzy123 I'm not familiar with AJAX Linux, can you share a link to it? If you are using a pre-compiled version of Merlin, you do not need to install Go. The compiled binaries contain everything you need. What happens when you execute Merlin on AJAX Linux?

patrickruda commented 3 years ago

AJAX is a set of web development techniques using many web technologies on the client-side to create asynchronous web applications. The application I am using is http://web-console.org/. This utilizes PHP which I am attempting to use to connect to a remote Linux machine via SSH.. So, in essence, I am trying to access Merlin via a web browser terminal. Obviously the AJAX terminal has limited functionality which is why I am struggling with connecting. I have tried cloud-cloud via AWS with AJAX, I have tried numerous PHP Shell apps, and have been working endlessly for weeks locating a way to use a browser to connect to Merlin to no avail. Please help me!!

Ne0nd0g commented 3 years ago

@prizzy123 I wanted to follow up with you before I close this issue due to lack of response.

@patrickruda I'm familiar with AJAX as a set of web development techniques, the original post language led me to believe it was a specific Linux distribution and less of a set of technologies. My initial guess is that the web consoles are not streaming STDOUT/STDERR back. Starting the Merlin server will prevent the process from ending because it never returns unless you issued the exit command. Because the Merlin server process is not returning, you're likely not seeing any output. Can you post example screenshots of what you're attempting to do and the result of doing so?

If you want to run Merlin through a web console, I recommend using https://github.com/its-a-feature/Mythic as a controller for the Merlin agent. To get started, check out this repository https://github.com/MythicAgents/merlin

prizzy123 commented 3 years ago

I have since been able to get Merlin working through means of shellinabox, however am still trying to understand how to execute commands/modules after an agent connects..... I am reading the Wiki repeatedly and just having a difficult time comprehending it,

On Tue, Jun 22, 2021 at 8:12 AM Russel Van Tuyl @.***> wrote:

@prizzy123 https://github.com/prizzy123 I wanted to follow up with you before I close this issue due to lack of response.

@patrickruda https://github.com/patrickruda I'm familiar with AJAX as a set of web development techniques, the original post language led me to believe it was a specific Linux distribution and less of a set of technologies. My initial guess is that the web consoles are not streaming STDOUT/STDERR back. Starting the Merlin server will prevent the process from ending because it never returns unless you issued the exit command. Because the Merlin server process is not returning, you're likely not seeing any output. Can you post example screenshots of what you're attempting to do and the result of doing so?

If you want to run Merlin through a web console, I recommend using https://github.com/its-a-feature/Mythic as a controller for the Merlin agent. To get started, check out this repository https://github.com/MythicAgents/merlin

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Ne0nd0g/merlin/issues/108#issuecomment-865930263, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS4OSQYZ223AOPK276ML5TTTUB4ZXANCNFSM46JYOKWA .

Ne0nd0g commented 3 years ago

Do have an example of what you're having a hard time with? I would be happy to provide additional information.

patrickruda commented 3 years ago

Yes, I cannot seem to load or access modules. No option at all. Also, the client, if it works, does not remain persistent and I have to click inside the DOS window just for Merlin to recognize the agent.

[cid:eeb8672e-87d8-4000-90fa-67bf8a0b4940]


From: Russel Van Tuyl @.> Sent: Wednesday, June 30, 2021 6:38 PM To: Ne0nd0g/merlin @.> Cc: patrickruda @.>; Mention @.> Subject: Re: [Ne0nd0g/merlin] Wit ll not run on AJAX Linux (#108)

Do have an example of what you're having a hard time with? I would be happy to provide additional information.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Ne0nd0g/merlin/issues/108#issuecomment-871639325, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APHL2GLH53PXDGL26CG37STTVNQCPANCNFSM46JYOKWA.

Ne0nd0g commented 2 years ago

@patrickruda I wanted to follow up one last time before I close this issue. I see your last post, but I'm able to duplicate. Can you provide duplication steps?

patrickruda commented 2 years ago

Yes thank you for following up with me! I am trying to figure out exactly how to get the merlin agent to connect to the mythic server using portmap. I have attempted to use port 7443 as well as port 80 but to no avail. I have tried just about every combination of ports with no callback results. The agent simply won't connect, I have watched your YouTube video to its entirety which has helped significantly in my comprehension of the overall project and it is embarrassing to have such difficulty with such a basic agent-to-server networking issue. Perhaps I am overthinking it. Can you assist?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Russel Van Tuyl @.> Sent: Thursday, April 21, 2022 7:53:19 AM To: Ne0nd0g/merlin @.> Cc: patrickruda @.>; Mention @.> Subject: Re: [Ne0nd0g/merlin] Wit ll not run on AJAX Linux (#108)

@patrickrudahttps://github.com/patrickruda I wanted to follow up one last time before I close this issue. I see your last post, but I'm able to duplicate. Can you provide duplication steps?

— Reply to this email directly, view it on GitHubhttps://github.com/Ne0nd0g/merlin/issues/108#issuecomment-1105107619, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APHL2GIQDZFTYZ6R7E57ZZ3VGE6S7ANCNFSM46JYOKWA. You are receiving this because you were mentioned.Message ID: @.***>

Ne0nd0g commented 2 years ago

Can you please elaborate more on what you mean by portmap? My initial thought is that this isn't a problem with Merlin, but a problem with how networking is setup.

It is important to note that the agent in this repository WILL NOT connect to a Mythic. You must build the Merlin agent from within Mythic. This repository and the agent that is used to connect to Mythic use two different clients.

I'm unable to fully understand your setup. Once you've setup and installed Mythic, you can access the Mythic web interface on port 7443. Port 7443 is not used for agent command and control.

The Merlin agent must be configured for the callback port documented in your C2 profile. To check, log into Mythic and click on the headphones icon in the upper right hand corner. Next click on the down arrow for the Stop Profile button on the http C2 profile. Then click on View/Edit Config and check to see what the port value is.

image

When you build the Merlin agent, enable the Verbose and Debug options so you can see the agent connecting or you can see the reason why it is not connecting.

image

When you get to the C2 profile, make sure the protocol used with the Callback Host matches your C2 profile from earlier (e.g., HTTP for port 80 without TLS and HTTPS for port 443 with TLS). Lastly, make sure the Callback Port matches your C2 profile from the first screenshot.

image

After you've built a Merlin agent from within Mythic, download it and execute it. After executing the payload, you will see the agent's connection attempts and can use that information to troubleshoot.

I'm going to close this issue because I'm unable to identify or duplicate a problem with the agent. This is more configuration and setup. I'm happy to chat with you about it until we get it going, but we will do so in Slack. Join the BloodHoundGang Slack and send me a DM or join the #merlin channel. Additionally, join the #mythic channel if you have questions about Mythic that don't relate to the Merlin agent.