Communitygithub.com

Cuckoo 샌드박스를 통한 악성코드 행위 분석

Cuckoo 샌드박스에서 악성코드 샘플을 실행하여 런타임 행위를 관찰합니다.

Cuckoo 샌드박스를 통한 악성코드 행위 분석란 무엇인가요?

이 스킬은 Cuckoo Sandbox를 활용하여 의심스러운 파일이나 URL을 안전한 격리 환경에서 실행하고, 실행 중 발생하는 프로세스, 네트워크, 파일 시스템, 레지스트리 변경 및 API 호출 등의 모든 행위를 상세히 분석하는 방법을 제공합니다. 분석자는 CLI나 REST API를 통해 샘플을 제출하고, 실시간 모니터링, JSON 보고서 파싱, Volatility를 활용한 메모리 덤프 분석 등을 통해 악성코드의 전체 감염 체인을 파악할 수 있습니다. 이 스킬은 정적 분석을 통과한 의심스러운 샘플의 동적 분석, 네트워크 트래픽 및 드롭된 파일 분석, 행위 기반 시그니처 생성이 필요한 경우에 특히 유용합니다. Ubuntu 22.04 서버에 설치된 Cuckoo 3.x와 Windows 게스트 VM, InetSim/FakeNet-NG, Suricata/Snort가 통합된 환경을 전제로 하며, 멀티 스테이지 드로퍼 분석, 지속성 메커니즘 확인, C2 통신 탐지 등 다양한 시나리오를 지원합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-malware-behavior-with-cuckoo-sandbox

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Cuckoo 샌드박스를 통한 악성코드 행위 분석은(는) 무엇을 하나요?

사용 시점

  • 의심스러운 샘플이 정적 분석 트라이지를 통과하여 통제된 환경에서의 행동 관찰이 필요한 경우
  • 악성코드 실행으로 인한 네트워크 트래픽, 파일 드롭, 레지스트리 수정, API 호출을 포착해야 하는 경우
  • 2차 페이로드 다운로드 및 지속성 메커니즘을 포함한 전체 감염 체인을 확인해야 하는 경우
  • 관찰된 런타임 활동을 기반으로 행동 시그니처와 YARA 규칙을 생성해야 하는 경우
  • 일관된 보고가 필요한 대량의 악성코드 샘플을 자동 분석해야 하는 경우

사용하지 말아야 할 경우: 샘플이 잘못 구성된 샌드박스에서 네트워크 공유를 통해 확산될 수 있는 알려진 랜섬웨어 변종인 경우. 먼저 네트워크 격리를 확인하십시오.

전제 조건

  • 전용 분석 서버(Ubuntu 22.04 권장)에 Cuckoo Sandbox 3.x 설치
  • Windows 10/11 스냅샷으로 구성된 게스트 VM(Cuckoo 에이전트 설치, 클린 상태에서 스냅샷 생성)
  • Cuckoo 가상화 백엔드로 VirtualBox, KVM 또는 VMware 구성
  • 인터넷 서비스 시뮬레이션을 위한 InetSim 또는 FakeNet-NG를 갖춘 격리된 네트워크
  • 분석 중 네트워크 수준 시그니처 매칭을 위한 Suricata 또는 Snort 통합
  • PCAP 캡처 및 메모리 덤프를 위한 충분한 디스크 공간(최소 500 GB 권장)

워크플로우

1단계: 샘플을 Cuckoo에 제출

자동 분석을 위해 악성코드 샘플을 제출합니다:

# 명령줄을 통해 제출
cuckoo submit /path/to/suspect.exe

# 특정 분석 타임아웃(300초)으로 제출
cuckoo submit --timeout 300 /path/to/suspect.exe

# 특정 VM 및 분석 패키지로 제출
cuckoo submit --machine win10_x64 --package exe --timeout 300 /path/to/suspect.exe

# REST API를 통해 제출
curl -F "[email protected]" -F "timeout=300" -F "machine=win10_x64" \
  http://localhost:8090/tasks/create/file

# URL 분석을 위해 제출
curl -F "url=http://malicious-site.com/payload" -F "timeout=300" \
  http://localhost:8090/tasks/create/url

# 작업 상태 확인
curl http://localhost:8090/tasks/view/1 | jq '.task.status'

2단계: 실시간 실행 모니터링

분석 진행 상황을 추적하고 실시간 동작을 관찰합니다:

# Cuckoo 분석 로그 보기
tail -f /opt/cuckoo/log/cuckoo.log

# 분석 작업 상태 모니터링
cuckoo status

# 실시간 스크린샷 및 프로세스 트리를 위한 Cuckoo 웹 인터페이스 접속
# http://localhost:8080/analysis/<task_id>/ 로 이동

실행 중 관찰해야 할 주요 행동 이벤트:

  • 프로세스 생성 체인(부모-자식 관계)
  • 외부 IP로의 네트워크 연결 시도
  • 임시 디렉터리 또는 시스템 폴더에 파일 드롭
  • 실행 키 또는 서비스 항목에 대한 레지스트리 수정
  • 암호화(CryptEncrypt), 인젝션(WriteProcessMemory) 또는 회피와 관련된 API 호출

3단계: 프로세스 활동 분석

Cuckoo 보고서에서 프로세스 트리와 API 호출 추적을 검토합니다:

# Cuckoo JSON 보고서를 프로그래밍 방식으로 파싱
import json

with open("/opt/cuckoo/storage/analyses/1/reports/report.json") as f:
    report = json.load(f)

# 프로세스 트리 분석
for process in report["behavior"]["processes"]:
    pid = process["pid"]
    ppid = process["ppid"]
    name = process["process_name"]
    print(f"PID: {pid} PPID: {ppid} Name: {name}")

    # 의심스러운 API 호출 추출
    for call in process["calls"]:
        api = call["api"]
        if api in ["CreateRemoteThread", "VirtualAllocEx", "WriteProcessMemory",
                    "NtCreateThreadEx", "RegSetValueExA", "URLDownloadToFileA"]:
            args = {arg["name"]: arg["value"] for arg in call["arguments"]}
            print(f"  [!] {api}({args})")

4단계: 네트워크 활동 검토

네트워크 연결, DNS 쿼리 및 HTTP 요청을 검사합니다:

# Cuckoo 보고서에서 네트워크 분석
network = report["network"]

# DNS 확인
print("DNS 쿼리:")
for dns in network.get("dns", []):
    print(f"  {dns['request']} -> {dns.get('answers', [])}")

# HTTP 요청
print("\nHTTP 요청:")
for http in network.get("http", []):
    print(f"  {http['method']} {http['uri']} (Host: {http['host']})")
    if http.get("body"):
        print(f"    본문: {http['body'][:200]}")

# TCP 연결
print("\nTCP 연결:")
for tcp in network.get("tcp", []):
    print(f"  {tcp['src']}:{tcp['sport']} -> {tcp['dst']}:{tcp['dport']}")

# 심층 Wireshark 분석을 위한 PCAP 추출
# PCAP 위치: /opt/cuckoo/storage/analyses/1/dump.pcap

5단계: 파일 시스템 및 레지스트리 변경 검사

지속성 메커니즘과 드롭된 파일을 문서화합니다:

# 파일 작업
print("생성/수정된 파일:")
for f in report["behavior"].get("summary", {}).get("files", []):
    print(f"  {f}")

# 해시가 포함된 드롭된 파일
print("\n드롭된 파일:")
for dropped in report.get("dropped", []):
    print(f"  경로: {dropped['filepath']}")
    print(f"  SHA-256: {dropped['sha256']}")
    print(f"  크기: {dropped['size']} 바이트")
    print(f"  유형: {dropped['type']}")

# 레지스트리 수정
print("\n수정된 레지스트리 키:")
for key in report["behavior"].get("summary", {}).get("keys", []):
    print(f"  {key}")

6단계: 시그니처 및 점수 검토

Cuckoo의 행동 시그니처와 위협 점수를 확인합니다:

# 트리거된 행동 시그니처
print("트리거된 시그니처:")
for sig in report.get("signatures", []):
    severity = sig["severity"]
    name = sig["name"]
    description = sig["description"]
    marker = "[!]" if severity >= 3 else "[*]"
    print(f"  {marker} [{severity}/5] {name}: {description}")
    for mark in sig.get("marks", []):
        if mark.get("call"):
            print(f"      API: {mark['call']['api']}")
        if mark.get("ioc"):
            print(f"      IOC: {mark['ioc']}")

# 전체 점수
score = report.get("info", {}).get("score", 0)
print(f"\n전체 위협 점수: {score}/10")

7단계: 메모리 덤프 아티팩트 추출

실행 중 캡처된 전체 메모리 덤프를 분석합니다:

# 메모리 덤프 저장 위치:
# /opt/cuckoo/storage/analyses/1/memory.dmp

# Volatility를 사용하여 메모리 덤프 분석
vol3 -f /opt/cuckoo/storage/analyses/1/memory.dmp windows.pslist
vol3 -f /opt/cuckoo/storage/analyses/1/memory.dmp windows.malfind
vol3 -f /opt/cuckoo/storage/analyses/1/memory.dmp windows.netscan

주요 개념

용어정의
동적 분석통제된 환경에서 악성코드를 실행하여 시스템 호출, 네트워크 활동, 파일 작업 등 런타임 행위를 관찰하는 것
샌드박스 회피악성코드가 가상/샌드박스 환경을 탐지하고 행동을 변경하여 분석을 회피하는 기술(슬립 타이머, VM 검사, 사용자 상호작용 검사)
API 후킹Cuckoo가 악성코드가 호출하는 Windows API를 가로채 함수명, 매개변수, 반환값을 기록하는 방법
InetSim격리된 분석 네트워크 내에서 악성코드의 네트워크 요청(HTTP, DNS, SMTP)에 응답하는 인터넷 서비스 시뮬레이션 도구
프로세스 인젝션악성코드가 정상 프로세스에 코드를 주입하는 기술; VirtualAllocEx 및 WriteProcessMemory API 시퀀스 모니터링을 통해 탐지
행동 시그니처특정 API 호출, 파일 작업 또는 네트워크 활동 시퀀스를 알려진 악성코드 행동과 매칭하는 규칙 기반 탐지
분석 패키지게스트 VM 내에서 특정 파일 형식(exe, dll, pdf, doc)을 실행하여 행동을 포착하는 방법을 정의하는 Cuckoo 모듈

도구 및 시스템

  • Cuckoo Sandbox: 행동 보고서, 네트워크 캡처 및 메모리 덤프를 제공하는 오픈소스 자동 악성코드 분석 시스템
  • InetSim: 격리된 악성코드 분석 네트워크를 위해 가짜 HTTP, DNS, SMTP 및 기타 서비스를 제공하는 인터넷 서비스 시뮬레이션 제품군
  • FakeNet-NG: FLARE 팀의 네트워크 시뮬레이션 도구로, 모든 네트워크 트래픽을 가로채서 분석을 위해 리디렉션
  • Suricata: 악성 네트워크 트래픽의 실시간 시그니처 기반 탐지를 위해 Cuckoo와 통합된 네트워크 IDS/IPS
  • Volatility: Cuckoo 분석 중 캡처된 메모리 덤프를 분석하는 데 사용되는 메모리 포렌식 프레임워크

일반적인 시나리오

시나리오: 멀티 스테이지 드로퍼 분석

컨텍스트: 정적 분석 결과 최소한의 임포트와 높은 엔트로피를 가진 패킹된 실행 파일이 발견되었습니다. 언패킹, 페이로드 전달 및 C2 설정을 관찰하기 위해 샌드박스 실행이 필요합니다.

접근 방식:

  1. 느린 행동을 포착하기 위해 확장된 타임아웃(600초)으로 샘플을 Cuckoo에 제출
  2. 하위 프로세스 생성(드로퍼가 페이로드 프로세스를 생성)을 위한 프로세스 트리 검토
  3. %TEMP%, %APPDATA% 또는 시스템 디렉터리에 드롭된 파일 식별
  4. 드롭된 파일을 추출하고 별도 분석을 위한 해시 계산
  5. 초기 실행 후 접촉한 C2 인프라를 식별하기 위해 네트워크 연결 매핑
  6. 레지스트리 수정에서 지속성 메커니즘(실행 키, 예약된 작업, 서비스) 확인
  7. 알려진 악성코드 패밀리와 행동 시그니처 비교

주의사항:

  • 부적절한 분석 타임아웃을 사용하여 2차 페이로드가 실행되기 전에 샌드박스가 종료되는 경우
  • InetSim이 DNS 및 HTTP 요청에 응답하도록 구성하지 않아 악성코드가 C2 체크인을 진행하지 못하는 경우
  • 샌드박스 회피 탐지를 무시하는 경우; 샘플이 즉시 종료되면 가상 환경을 탐지 중일 수 있음
  • 드롭된 파일을 별도로 분석하지 않는 경우; 초기 드로퍼가 최종 페이로드보다 덜 중요할 수 있음

출력 형식

동적 분석 보고서 - CUCKOO 샌드박스
==========================================
작업 ID:          1547
샘플:           suspect.exe (SHA-256: e3b0c44298fc1c149afbf4c8996fb924...)
분석 시간:    300초
VM:               win10_x64 (Windows 10 21H2)
점수:            8.5/10

프로세스 트리
suspect.exe (PID: 2184)
  └── cmd.exe (PID: 3456)
      └── powershell.exe (PID: 4012)
          └── svchost_fake.exe (PID: 4568)

파일 시스템 활동
[생성]  C:\Users\Admin\AppData\Local\Temp\payload.dll
[생성]  C:\Windows\System32\svchost_fake.exe
[수정] C:\Windows\System32\drivers\etc\hosts

레지스트리 수정
[설정] HKCU\Software\Microsoft\Windows\CurrentVersion\Run\WindowsUpdate = "C:\Windows\System32\svchost_fake.exe"
[설정] HKLM\SYSTEM\CurrentControlSet\Services\FakeService\ImagePath = "C:\Windows\System32\svchost_fake.exe"

네트워크 활동
DNS:    update.malicious[.]com -> 185.220.101.42
HTTP:   POST hxxps://185.220.101[.]42/gate.php (비콘)
TCP:    10.0.2.15:49152 -> 185.220.101.42:443 (237개 연결)

행동 시그니처
[!] [4/5] injection_createremotethread: 원격 프로세스에 코드 인젝션
[!] [4/5] persistence_autorun: 지속성을 위해 실행 레지스트리 키 수정
[!] [3/5] network_cnc_http: HTTP C2 통신 수행
[*] [2/5] antiav_detectfile: 안티바이러스 제품 파일 확인

드롭된 파일
payload.dll    SHA-256: abc123... 크기: 98304  유형: PE32 DLL
svchost_fake.exe SHA-256: def456... 크기: 184320 유형: PE32 EXE

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

관련 스킬