
Python 및 PowerShell 기반의 오픈 소스 사전 운영 C2 서버
Octopus는 HTTP/S를 통해 Octopus 파워쉘 에이전트를 제어할 수 있는, 파이썬 기반의 오픈 소스 사전 작업 C2 서버입니다.
Octopus를 만든 주된 목적은 레드 팀 작업 전에 사용하기 위함입니다. 즉, 전체 작전 무기고와 인프라로 공격을 시작하는 대신, 먼저 Octopus를 사용하여 실제 레드 팀 작업을 시작하기 전에 대상을 공격하고 정보를 수집할 수 있습니다.
Octopus는 매우 간단한 방식으로 작동하여 명령을 실행하고 암호화된 채널을 통해 C2와 정보를 교환하므로, 거의 모든 AV, 엔드포인트 보호 및 네트워크 모니터링 솔루션에서 눈에 띄지 않고 탐지되지 않습니다.
Octopus의 멋진 기능 중 하나는 ESA(Endpoint Situational Awareness)입니다. 이 기능은 대상에 대한 몇 가지 중요한 정보를 수집하여 작전 중에 직면하게 될 대상 네트워크 엔드포인트를 더 잘 이해할 수 있도록 도와주며, 따라서 이 정보를 기반으로 실제 작전을 맞춤화할 수 있는 기회를 제공합니다.
Octopus는 C2와 통신하는 동안 은밀하고 숨겨지도록 설계되었습니다. 기본적으로 파워쉘 에이전트와 C2 서버 간의 암호화된 채널에 AES-256을 사용합니다. 도메인에 유효한 인증서를 제공하고 Octopus C2 서버를 구성하여 SSL/TLS를 사용하도록 선택할 수도 있습니다.
Octopus는 실제로 전체 무기고나 도구 및 기술을 배포하기 전에 다가오는 작업에 대한 통찰력을 얻을 수 있는 여러 기능을 제공합니다. 예를 들어:
다음 명령어를 통해 Octopus의 모든 요구 사항을 설치할 수 있습니다:
pip install -r requirements.txt
셸코딩 기능과 스푸핑된 인수 에이전트를 사용하려면 Linux용 nasm과 'mingw-w64' 컴파일러를 설치해야 합니다.
Debian 기반 배포판에서 nasm을 설치하려면 다음 명령어를 사용하세요:
apt install nasm
그리고 Debian 기반 배포판에서 mingw-w64를 설치하려면 다음 명령어를 사용하세요:
apt install mingw-w64
Octopus는 다음 운영 체제에서 테스트되었습니다:
또한 C# 소스 코드를 문제없이 컴파일할 수 있도록 mono를 설치해야 합니다.
Octopus는 C# 소스 코드를 컴파일하기 위해 mono-csc 바이너리에 의존하며, Kali와 Ubuntu 16.04에서 테스트된 다음 명령어로 설치할 수 있습니다: apt install mono-devel
mono를 설치하지 않고 Octopus를 사용할 수 있지만,
generate_exe명령은 사용할 수 없습니다.
또한 C# 컴파일은 SHA1 해시가 a43ed886b68c6ee913da85df9ad2064f1d81c470인 System.Management.Automation.dll 어셈블리에 의존합니다.
Octopus 사용 중 문제가 발생하면 버그 리포트를 자유롭게 제출해 주세요!
먼저 다음 명령어를 사용하여 최신 버전의 Octopus를 다운로드하세요:
git clone https://github.com/mhaskar/Octopus/
그런 다음 다음 명령어를 사용하여 요구 사항을 설치하세요:
pip install -r requirements.txt
이제 다음 명령어를 실행하여 Octopus 서버를 시작할 수 있습니다:
./octopus.py
실행하면 다음과 같은 화면이 나타납니다:
┌─[askar@hackbook]─[/opt/redteaming/Octopus]
└──╼ $python3 octopus.py
___ ___ ___ ___ ___ ___
/ /\ / /\ ___ / /\ / /\ /__/\ / /\
/ /::\ / /:/ / /\ / /::\ / /::\ \ \:\ / /:/_
/ /:/\:\ / /:/ / /:/ / /:/\:\ / /:/\:\ \ \:\ / /:/ /\
/ /:/ \:\ / /:/ ___ / /:/ / /:/ \:\ / /:/~/:/ ___ \ \:\ / /:/ /::\
/__/:/ \__\:\ /__/:/ / /\ / /::\ /__/:/ \__\:\ /__/:/ /:/ /__/\ \__\:\ /__/:/ /:/\:\
\ \:\ / /:/ \ \:\ / /:/ /__/:/\:\ \ \:\ / /:/ \ \:\/:/ \ \:\ / /:/ \ \:\/:/~/:/
\ \:\ /:/ \ \:\ /:/ \__\/ \:\ \ \:\ /:/ \ \::/ \ \:\ /:/ \ \::/ /:/
\ \:\/:/ \ \:\/:/ \ \:\ \ \:\/:/ \ \:\ \ \:\/:/ \__\/ /:/
\ \::/ \ \::/ \__\/ \ \::/ \ \:\ \ \::/ /__/:/
\__\/ \__\/ \__\/ \__\/ \__\/ \__\/
v1.2 stable !
Octopus C2 | Control your shells
Octopus >>
Octopus 사용은 매우 간단합니다. 리스너를 시작하고 해당 리스너의 정보를 기반으로 에이전트를 생성하기만 하면 됩니다.
필요한 만큼 리스너를 생성할 수 있으며, 그런 다음 연결되는 에이전트와 상호 작용을 시작할 수 있습니다.
Octopus를 사용하기 전에 C2 동작과 기능을 제어할 URL 처리 프로필을 설정해야 합니다. Octopus는 HTTP 기반 C2이므로 연결을 처리하기 위해 URL에 의존하며, URL이 현재 공격 중인 네트워크에서 시그니처나 IoC로 작동하지 않도록 보장하기 위해 URL을 필요에 따라 쉽게 사용자 정의하고 이름을 바꿀 수 있습니다.
현재 프로필 설정은 URL 처리, 자동 종료 값 및 헤더만 지원합니다.
프로필 설정
프로필 설정을 시작하려면 profile.py 파일을 편집해야 합니다. 이 파일에는 몇 가지 주요 변수가 포함되어 있습니다:
예시:
#!/usr/bin/python3
# this is the web listener profile for Octopus C2
# you can customize your profile to handle a specific URLs to communicate with the agent
# TODO : add the ability to customize the request headers
# handling the file downloading
# Ex : /anything
# Ex : /anything.php
file_receiver_url = "/messages"
# handling the report generation
# Ex : /anything
# Ex : /anything.php
report_url = "/calls"
# command sending to agent (store the command will be executed on a host)
# leave <hostname> as it with the same format
# Ex : /profile/<hostname>
# Ex : /messages/<hostname>
# Ex : /bills/<hostname>
command_send_url = "/view/<hostname>"
# handling the executed command
# Ex : /anything
# Ex : /anything.php
command_receiver_url = "/bills"
# handling the first connection from the agent
# Ex : /anything
# Ex : /anything.php
first_ping_url = "/login"
# will return in every response as Server header
server_response_header = "nginx"
# will return white page that includes HTA script
mshta_url = "/hta"
# auto kill value after n tries
auto_kill = 10
에이전트와 리스너는 이 프로필을 사용하여 서로 통신하도록 구성됩니다. 다음으로 리스너를 만드는 방법을 알아야 합니다.
Octopus에는 두 가지 주요 리스너("http 리스너"와 "https 리스너")가 있으며, 두 리스너의 옵션은 대부분 동일합니다.
HTTP 리스너:
listen_http 명령은 시작하기 위해 다음 인수를 사용합니다:
listen_http 명령을 실행하여 예제를 볼 수도 있습니다:
Octopus >>listen_http
[-] Please check listener arguments !
Syntax : listen_http BindIP BindPort hostname interval URL listener_name
Example (with domain) : listen_http 0.0.0.0 8080 myc2.live 5 comments.php op1_listener
Example (without domain) : listen_http 0.0.0.0 8080 172.0.1.3 5 profile.php op1_listener
##########
Options info :
BindIP IP address that will be used by the listener
BindPort port you want to listen on
Hostname will be used to request the payload from
Interval how may seconds that agent will wait before check for commands
URL page name will hold the payload
Listener_name listener name to use
Octopus >>
다음 명령어를 사용하여 리스너를 시작할 수 있습니다:
listen_http 0.0.0.0 8080 192.168.178.1 5 page.php operation1
다음 결과가 반환됩니다:
Octopus >>listen_http 0.0.0.0 8080 192.168.178.1 5 page.php operation1
Octopus >> * Serving Flask app "core.weblistener" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
Octopus >>
리스너가 성공적으로 시작되었습니다. listeners 명령어를 사용하여 모든 리스너를 볼 수 있습니다:
Octopus >>listeners
Name IP Port Host Interval Path SSL
---------- ------- ------ ------------- ---------- -------- -----
operation1 0.0.0.0 8080 192.168.178.1 5 page.php False
Octopus >>
HTTPS 리스너:
HTTPS 리스너를 생성하려면 다음과 같이 listen_https 명령어를 사용할 수 있습니다:
Octopus >>listen_https
[-] Please check listener arguments !
Syntax : listen_https BindIP BindPort hostname interval URL listener_name certficate_path key_path
Example (with domain) : listen_https 0.0.0.0 443 myc2.live 5 login.php op1_listener certs/cert.pem certs/key.pem
Octopus >>listen_https 0.0.0.0 443 myc2.live 5 login.php darkside_operation certs/cert.pem certs/key.pem
SSL listener started !
[+]darkside_operation Listener has been created
Octopus >> * Serving Flask app "core.weblistener" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off