Coder Social home page Coder Social logo

enkomio / alanframework Goto Github PK

View Code? Open in Web Editor NEW
460.0 13.0 71.0 17.37 MB

A C2 post-exploitation framework

License: Other

JavaScript 0.32% CMake 0.13% C 23.16% Makefile 0.24% Shell 1.47% Ruby 0.28% Python 0.55% Tcl 0.01% C++ 0.41% Perl 0.16% SmPL 0.01% Batchfile 0.01% Dockerfile 0.01% GDB 0.01% Assembly 71.66% HTML 0.16% F# 0.50% C# 0.92% PowerShell 0.01%
security security-tool hacking hacking-tool post-exploitation red-team red-teaming c2

alanframework's Introduction

Alan Framework

Alan Framework is a post-exploitation framework useful during red-team activities.

If you find my tool useful, please consider to sponsor me.

⚠⚠⚠ Disclaimer ⚠⚠⚠

The creation of this kind of software has always caused controversies. If you're wondering why I decided to create this tool, it's because I'm convinced that the ultimate learning experience is implementing what you learned. During the reverse engineering process, many small details are overlooked. Little by little, these details prevent the researcher from having a complete picture of what is going on. Finally, I'm a programmer first, and I love to develop this kind of program 😄

Download

Download Alan C2 Framework

Notable Features

  • You can run your preferred tool directly in-memory
  • JavaScript script execution (in-memory without third party dependency)
  • Fully compliant SOCKS5 proxy
  • Supported agent types: Powershell (x86/x64), DLL (x86/x64), Executable (x86/x64), Shellcode (x86/x64)
  • Server.exe can be executed in Linux (via dotnet core)
  • The network communication is fully encrypted with a session key not recoverable from the agent binary or from a traffic dump
  • Communication performed via HTTP/HTTPS
  • No external dependencies or libraries need to be installed
  • A powerful command shell
  • The agent configuration can be updated on the fly (you can change port and protocol too)

Documentation:

Blog posts

For more information on its usage please read the documentation.

Compile the source code

To compile Alan the following actions must be performed:

  • Ensure that you have installed cmake and that it is in the PATH (run cmake --help to see if it works)
  • Install Visual Studio 2022 (the Community Edition is fine). These steps were tested against version VS 2022 17.3.1
  • Be sure that .NET Desktop Development, Desktop development with C++ and the F# language are installed as part of the Visual Studio suite
  • Install .NET libraries by running: ./src/server/paket.exe install
  • Open the file .src/server/ServerSln.sln in Visual Studio. Set the ServerBuilder project as the main one (right click -> Set as Startup Project)
  • Run the ServerBuilder which will compile everything
  • If the compilation ended succesfully, the Alan .zip file will be located in the newly created directory Misc/out/release

Videos:

Demo videos

Alan v7.0.514.10 - SOCKS5 Proxy Alan C2 Framework v7.0, codename: Hyper-Pivoting Alan v6.0.511.28 - JS Execution Alan C2 Framework 6.0 - Alan + JavaScript = ♡ Alan v5.0.509.20 - In-Memory Execution Alan 5.0 C2 Framework - All You Can In-Memory Edition
Alan v4.0.0 - x64 Agent && Inject Alan post-exploitation framework v4.0 demo Alan v3.0.0 - Misc Commands Alan v3.0 - Post-Exploitation Framework Alan v2.0.500.23 Alan post-exploitation framework - Update the agent profile at runtime
Alan v1.0.0 Alan v1.0 - A Post-Exploitation Framework

Changelog

v7.0.514.10 - 15/05/2022

  • Implemented proxy command for pivoting
  • The info and info++ commands display if the agent is using a proxy
  • Fixed bug on network communication (Issue 2)
  • Fixed error in PE loader when function are import via ordinal
  • Fixed JS module causing memory free ahead of time
  • Fixed error in run command that cause the & option to not work
  • The log messages are now saved to file alan.log
  • All the generated output and user input is logged to an evidence file inside the evidences folder
  • Added machine ID information to info command
  • Added Vanilla package type for agent creation. This allows a better integration of custom packer.

v6.0.511.28 24/02/2022

  • x86/x64 PE loaders modified to update the PEB->Ldr field. This allows the system to call DLL_PROCESS_DETACH on the injected DLL.
  • Increase max response size to 1GB. This fix the download of big files.
  • Added agent expiration date to the configuration.
  • The run was extended to support the execution of Javascript files.
  • info++ command now shows the Volume label and the FS type.

v5.0.509.20 - 13/12/2021

  • Implemented run command
  • Implemented kill command
  • Implemented exec command
  • Removed inject message since it can be achieved with the run command in background
  • Created stager and PE loader to make the agent stealthier. Each generated agent file has a different hash
  • Improved code injection to bypass Dynamic Code Policy Mitigation
  • It is now possible to specify the agent file name to create during the wizard
  • Fixed error in upload and download commands
  • Fixed error in shell creation. The command shell process token did not have the same agent integrity level
  • Removed exported function from DLL agent artifact
  • Added current working directory to info command
  • Extended shell command to execute a single command

v4.0.0 - 26/09/2021

  • Added inject command. This command allows the operator to inject code into a remote process
  • Added sleep command performed in short sleep of 400 msec each.
  • Introduced Jitter concept in sleep
  • Ported agent to x64 bit (included PE32+ loader)
  • Fixed errors in x86 PE loader
  • .NET agent runner is now executed in a stealthier way to avoid detection
  • It is now possible to specify a custom Web server in the HTTP/S listener response
  • Removed command listeners since superfluous
  • Improved info command with more information
  • Error message are more explanatory
  • Added information on process token type (elevated or not)
  • Added information on process token privileges
  • Added information on process token groups

v3.0.0 - 15/05/2021

  • Renamed agent shell quit command to exit
  • Implemented agent migration via migrate command
  • Fixed error in retrieving OS version
  • Added DLL as agent format in the creation wizard.
  • Implemented ps command to list the currently running processes
  • Implemented download command to locally download a file or an entire directory
  • Implemented upload command to upload files to the compromised host
  • Implemented SuccessRequest as HTTP server response option to customize the http/s listener response
  • Implemented ErrorRequest to customize the http/s listener response for bad requests
  • Implemented prepend and append as HTTP server request option to specify in the agent prof

v2.0.500.23 - 20/03/2021

  • Implemented agent detach command to temporary exit from a joined agent
  • Implemented shell detach command to temporary exit from a command shell
  • Implemented listeners command to list the available listeners
  • Implemented HTTPS listener to communicatewith the agent via TLS
  • Implemented get-config command to download the current agent configuration
  • Implemented update command to update the agent configuration
  • Windows7 is now supported

v1.0.0 - 22/02/2021

  • First Release

alanframework's People

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  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  avatar  avatar

alanframework's Issues

Compilation Guide

Hello,
I wonder if you have a guide/ReadMe to compile the Server.dll file from the src folder with Visual Studio.
Best regards,
Piedacoulisse

[QUESTION] Connexion AWS server

Hello,

I have a question about the C2. Why is there a connexion to the web server AWS 34.252.108.5 in the app ?

Best regards;

Piedacoulisse

Default proxy for C2

Hi,

Is there a way to configure for the client to use the default machine proxy (org proxy), or set proxy configurations (dest + port)? Otherwise the client cannot communicate with the server that is outside the org network if direct access to the internet from the machine is blocked.
As I understand, the proxy that exist in the framework doesn't allow such functionality and used for pivoting inside the network.

Got some error when testing alan Framework on ubuntu 20.04

❯ dotnet ./Server.dll

-=[ Post Exploitation Framework ]=-
Copyright (c) 2021-2022 Enkomio

[INFO] 2022-07-26 14:00:27 - Alan version: 7.0.514.10
[INFO] 2022-07-26 14:00:27 - Start listeners
[INFO] 2022-07-26 14:00:27 - Evidence log saved to file: /root/new-CME-Jun/CrackMapExec/alan/evidences/20220726/session_0400.txt
[INFO] 2022-07-26 14:00:28 - Web listener started on: 0.0.0.0:8080
[INFO] 2022-07-26 14:00:28 - Using certificate: E=alan@localhost, C=Italy, S=IT, L=IT, O=AlanCA, OU=AlanFramework, CN=Enkomio. Expires: 10/26/2022 3:54:36 PM
[INFO] 2022-07-26 14:00:28 - Web listener started on: 0.0.0.0:8443
Autofac.Core.DependencyResolutionException: An exception was thrown while activating ES.Alan.Server.Consoles.CliConsole -> ES.Alan.Server.Consoles.NetworkUtility.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(ES.Fslog.ILogProvider)' on type 'NetworkUtility'.
---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): Name or service not known
at System.Net.Dns.GetHostEntryOrAddressesCore(String hostName, Boolean justAddresses)
at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
at ES.Alan.Server.Consoles.NetworkUtility.logPrivateIPs()
at ES.Alan.Server.Consoles.NetworkUtility..ctor(ILogProvider logProvider)
at lambda_method3(Closure , Object[] )
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.b__1(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next) --- End of inner exception stack trace --- at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.b__1(ResolveRequestContext ctxt)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.SharingMiddleware.<>c__DisplayClass5_0.<Execute>b__0() at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func1 creator)
at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable1 qualifyingId, Func1 creator)
at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.b__1(ResolveRequestContext ctxt)
at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.Core.Container.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable1 parameters) at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable1 parameters)
at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context)
at ES.Alan.Server.Program.main$cont@121(ParseResults`1 results, Unit unitVar)
at ES.Alan.Server.Program.main(String[] argv)

❯ dotnet --list-runtimes
Microsoft.AspNetCore.App 3.1.26 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.26 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

❯ dotnet --version
5.0.408

❯ dotnet --list-sdks
3.1.420 [/usr/share/dotnet/sdk]
5.0.408 [/usr/share/dotnet/sdk]

❯ cat /proc/version
Linux version 5.4.0-121-generic (buildd@lcy02-amd64-013) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #137-Ubuntu SMP Wed Jun 15 13:33:07 UTC 2022

Agent didn't come back

I just follow the movie to have a try.
I run the agent(p8UPKP.exe) that I craete. But no agent come back.(waiting for a long long time)
image
image

Computer Info:
System: windows 2019(no network)

Is network required? Thank you.

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.