Communitygithub.com

analisando-artefatos-de-malware-em-cadeia-de-suprimentos

Investigue artefatos de ataques à cadeia de suprimentos, incluindo software trojanizado.

O que é analisando-artefatos-de-malware-em-cadeia-de-suprimentos?

Esta skill capacita analistas de segurança e SOC a investigar artefatos de malware provenientes de ataques à cadeia de suprimentos, como os notórios casos SolarWinds SUNBURST (2020) e 3CX SmoothOperator (2023). Ela fornece um workflow estruturado que abrange desde a comparação binária de versões legítimas e trojanizadas até a análise de injeção de código, anomalias de assinatura digital e rastreamento da cadeia de infecção. Inclui scripts Python prontos para uso (usando pefile, hashlib) que comparam estruturas PE, identificam seções suspeitas, mudanças de imports e verificam a presença de assinatura digital. A skill é ideal para construir regras de detecção, conduzir threat hunting e validar a cobertura de monitoramento contra técnicas como MITRE ATT&CK T1195 (Supply Chain Compromise), ajudando a extrair IOCs e avaliar o impacto a jusante em sistemas afetados. Suporta as plataformas Windows (PE) e linguagens como Python, com requisitos de ferramentas como BinDiff e sigcheck.

Funciona com~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-supply-chain-malware-artifacts

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Análise de Artefatos de Malware em Cadeia de Suprimentos

Visão Geral

Ataques à cadeia de suprimentos comprometem canais legítimos de distribuição de software para entregar malware por meio de mecanismos de atualização confiáveis. Exemplos notáveis incluem SolarWinds SUNBURST (2020, afetando mais de 18.000 clientes), 3CX SmoothOperator (2023, um ataque em cascata originado da Trading Technologies) e inúmeras campanhas de envenenamento de pacotes npm/PyPI. A análise envolve comparar binários trojanizados com versões legítimas, identificar código injetado em artefatos de build, examinar anomalias de assinatura de código e rastrear a cadeia de infecção desde o comprometimento inicial até a entrega do payload. Em 2025, ataques à cadeia de suprimentos representam 30% de todas as violações, um aumento de 100% em relação aos anos anteriores.

Quando Usar

  • Ao investigar incidentes de segurança que exigem análise de artefatos de malware de cadeia de suprimentos
  • Ao criar regras de detecção ou consultas de threat hunting para este domínio
  • Quando analistas de SOC precisam de procedimentos estruturados para este tipo de análise
  • Ao validar a cobertura de monitoramento de segurança para técnicas de ataque relacionadas

Pré-requisitos

  • Python 3.9+ com pefile, ssdeep, hashlib
  • Ferramentas de diff binário (BinDiff, Diaphora)
  • Ferramentas de verificação de assinatura de código (sigcheck, codesign)
  • Ferramentas de análise de composição de software (SCA)
  • Acesso a versões legítimas de software para comparação
  • Monitoramento de repositórios de pacotes (npm, PyPI, NuGet)

Fluxo de Trabalho

Passo 1: Análise de Comparação Binária

#!/usr/bin/env python3
"""Compara binário trojanizado com a versão legítima."""
import hashlib
import pefile
import sys
import json


def compare_pe_files(legitimate_path, suspect_path):
    """Compara estruturas de arquivo PE entre versões legítima e suspeita."""
    legit_pe = pefile.PE(legitimate_path)
    suspect_pe = pefile.PE(suspect_path)

    report = {"differences": [], "suspicious_sections": [], "import_changes": []}

    # Compara seções
    legit_sections = {s.Name.rstrip(b'\x00').decode(): {
        "size": s.SizeOfRawData,
        "entropy": s.get_entropy(),
        "characteristics": s.Characteristics,
    } for s in legit_pe.sections}

    suspect_sections = {s.Name.rstrip(b'\x00').decode(): {
        "size": s.SizeOfRawData,
        "entropy": s.get_entropy(),
        "characteristics": s.Characteristics,
    } for s in suspect_pe.sections}

    # Encontra seções novas ou modificadas
    for name, props in suspect_sections.items():
        if name not in legit_sections:
            report["suspicious_sections"].append({
                "name": name, "reason": "Nova seção não presente na versão legítima",
                "size": props["size"], "entropy": round(props["entropy"], 2),
            })
        elif abs(props["size"] - legit_sections[name]["size"]) > 1024:
            report["suspicious_sections"].append({
                "name": name, "reason": "Tamanho da seção alterado significativamente",
                "legit_size": legit_sections[name]["size"],
                "suspect_size": props["size"],
            })

    # Compara imports
    legit_imports = set()
    if hasattr(legit_pe, 'DIRECTORY_ENTRY_IMPORT'):
        for entry in legit_pe.DIRECTORY_ENTRY_IMPORT:
            for imp in entry.imports:
                if imp.name:
                    legit_imports.add(f"{entry.dll.decode()}!{imp.name.decode()}")

    suspect_imports = set()
    if hasattr(suspect_pe, 'DIRECTORY_ENTRY_IMPORT'):
        for entry in suspect_pe.DIRECTORY_ENTRY_IMPORT:
            for imp in entry.imports:
                if imp.name:
                    suspect_imports.add(f"{entry.dll.decode()}!{imp.name.decode()}")

    new_imports = suspect_imports - legit_imports
    if new_imports:
        report["import_changes"] = list(new_imports)

    # Verifica assinatura de código
    report["legit_signed"] = bool(legit_pe.OPTIONAL_HEADER.DATA_DIRECTORY[4].Size)
    report["suspect_signed"] = bool(suspect_pe.OPTIONAL_HEADER.DATA_DIRECTORY[4].Size)

    return report


def hash_file(filepath):
    """Calcula múltiplos hashes para um arquivo."""
    hashes = {}
    with open(filepath, 'rb') as f:
        data = f.read()
    for algo in ['md5', 'sha1', 'sha256']:
        h = hashlib.new(algo)
        h.update(data)
        hashes[algo] = h.hexdigest()
    return hashes


if __name__ == "__main__":
    if len(sys.argv) < 3:
        print(f"Uso: {sys.argv[0]} <binario_legitimo> <binario_suspeito>")
        sys.exit(1)
    report = compare_pe_files(sys.argv[1], sys.argv[2])
    print(json.dumps(report, indent=2))

Critérios de Validação

  • Componentes trojanizados identificados por meio de diff binário
  • Código injetado isolado e analisado separadamente
  • Anomalias de assinatura de código documentadas
  • Linha do tempo da infecção reconstruída a partir de artefatos de build
  • Escopo de impacto downstream avaliado em sistemas afetados
  • IOCs extraídos para detecção e bloqueio

Referências

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,

Habilidades Relacionadas