SOC Prime Bias: Crítico

09 Abr 2026 17:52

ChainShell: MuddyWater y MaaS Ruso

Author Photo
Ruslan Mikhalov Jefe de Investigación de Amenazas en SOC Prime linkedin icon Seguir
ChainShell: MuddyWater y MaaS Ruso
shield icon

Detection stack

  • AIDR
  • Alert
  • ETL
  • Query

Resumen

MuddyWater, un actor de espionaje vinculado a Irán, está aprovechando la plataforma rusa TAG-150 de malware como servicio para entregar CastleRAT y un nuevo agente C2 habilitado por blockchain de Node.js rastreado como ChainShell contra objetivos israelíes y otros de alto valor. La actividad es apoyada por un servidor web C2 expuesto y mal configurado, un script de implementación de PowerShell (reset.ps1) y cargas útiles PE ocultas mediante esteganografía. Múltiples versiones de CastleRAT (incluidas Build 120 y Build 13) contienen identificadores codificados compartidos que apuntan a la misma línea de MaaS. La infraestructura de backend parece estar organizada por campañas, usando dominios compartidos (por ejemplo, serialmenot.com) y credenciales JWT por operación para separar el acceso y el seguimiento en las implementaciones.

Investigación

JUMPSEC revisó el host C2 expuesto, recuperó 15 muestras de malware y vinculó la lógica de implementación de reset.ps1 a la entrega de ambos, ChainShell y múltiples compilaciones de CastleRAT. Los investigadores también correlacionaron certificados de firma de código (Amy Cherne y Donald Gay) vistos en herramientas conocidas de MuddyWater con el instalador TAG-150 MSI, formando una pista de atribución de alta confianza. Se observó un solapamiento adicional entre las muestras en marcadores de compilación codificados, convenciones de nombres de tareas programadas recurrentes e IDs de campaña JWT incrustados en las herramientas y artefactos del servidor.

Mitigación

Monitorear reset.ps1, tareas programadas asociadas y artefactos de mutex o rutas de archivos únicas vinculadas a CastleRAT y ChainShell. Bloquear infraestructura conocida de TAG-150, incluyendo serialmenot.com, ttrdomennew.com y sharecodepro.com, y examinar a fondo la instalación de componentes de Node.js a través de PowerShell. Aplicar controles estrictos de firma de código y validar certificados sospechosos contra material de firma vinculado a MuddyWater.

Respuesta

Si se encuentran indicadores, aislar los puntos finales afectados, capturar imágenes completas de disco y memoria, y buscar remanentes adicionales de CastleRAT y ChainShell. Revocar o dejar de confiar en certificados de firma de código comprometidos, restablecer credenciales afectadas y coordinar el informe con los CERTs nacionales relevantes. Revisar la telemetría de la red para detectar patrones de acceso a RPC de Ethereum y uso de JWT vinculados al flujo de trabajo de comando y control de serialmenot.com.

"graph TB %% Definiciones de clase classDef action fill:#99ccff classDef tool fill:#ffcc99 classDef technique fill:#c2f0c2 classDef malware fill:#ff9999 classDef process fill:#ffd966 %% Nodos action_phishing["<b>Acción</b> – <b>T1566.002 Phishing</b><br/>Documento malicioso habilitado por macro entregado por correo electrónico (ClickFix/BatClickFix)"] class action_phishing action action_user_exec["<b>Acción</b> – <b>T1204.002 Ejecución de Usuario</b><br/>La víctima abre el documento activando PowerShell"] class action_user_exec action tool_powershell["<b>Herramienta</b> – <b>T1059.001 PowerShell</b><br/>Intérprete de scripts usado para cargar el cargador"] class tool_powershell tool tool_cmstp["<b>Herramienta</b> – <b>T1218.003 CMSTP</b><br/>Ejecución de proxy binario del sistema que carga INF malicioso"] class tool_cmstp tool technique_dll_sideload["<b>Técnica</b> – <b>T1574.002 DLL Sideu2011Loading</b><br/>DLLs maliciosos cargados a través de INF"] class technique_dll_sideload technique technique_dll_hijack["<b>Técnica</b> – <b>T1574.005 Secuestro de Flujo de Ejecución</b><br/>userenv.dll y xmllite.dll maliciosos colocados junto a binarios legítimos"] class technique_dll_hijack technique technique_scheduled_task["<b>Técnica</b> – <b>T1543.001 Crear o Modificar Proceso del Sistema</b><br/>Tareas programadas (VirtualSmokestGuy120/666) para persistencia"] class technique_scheduled_task technique technique_steganography["<b>Técnica</b> – <b>T1027.003 Esteganografía</b><br/>Cargas útiles PE nativas ocultas dentro de imágenes JPEG"] class technique_steganography technique technique_embedded_payload["<b>Técnica</b> – <b>T1027.009 Cargas Útiles Embebidas</b><br/>Cargas útiles adicionales aún más ocultas"] class technique_embedded_payload technique technique_data_obfusc["<b>Técnica</b> – <b>T1001 Ofuscación de Datos</b><br/>Encriptación AESu2011256u2011CBC del tráfico C2"] class technique_data_obfusc technique technique_uac_bypass["<b>Técnica</b> – <b>T1548.002 Abuso del Mecanismo de Control de Elevación</b><br/>Ejecución de CMSTP evita UAC"] class technique_uac_bypass technique technique_steal_cookie["<b>Técnica</b> – <b>T1539 Robo de Cookies de Sesión Web</b><br/>Desencriptar cookies de Chrome v127+ ligadas a la aplicación"] class technique_steal_cookie technique technique_forge_cookie["<b>Técnica</b> – <b>T1606.001 Forjar Credenciales Web</b><br/>Usar cookies extraídas para autenticación"] class technique_forge_cookie technique technique_alt_auth["<b>Técnica</b> – <b>T1550.004 Usar Material de Autenticación Alternativo</b><br/>Abusar cookies para movimiento lateral"] class technique_alt_auth technique technique_vnc["<b>Técnica</b> – <b>T1021.005 Servicios Remotos VNC</b><br/>VNC oculto proporciona control de escritorio invisible"] class technique_vnc technique technique_remote_service["<b>Técnica</b> – <b>T1021 Servicios Remotos</b><br/>Movimiento lateral adicional a través de servicios remotos"] class technique_remote_service technique technique_dead_drop["<b>Técnica</b> – <b>T1102.001 Resolutor Dead Drop</b><br/>Dirección C2 resuelta desde contrato inteligente de Ethereum"] class technique_dead_drop technique technique_websocket_bidirectional["<b>Técnica</b> – <b>T1102.002 WebSocket Bidireccional</b><br/>Canal WebSocket para intercambio de comandos"] class technique_websocket_bidirectional technique technique_websocket_oneway["<b>Técnica</b> – <b>T1102.003 Comunicación Unilateral</b><br/>Ruta C2 de respaldo"] class technique_websocket_oneway technique technique_web_protocol["<b>Técnica</b> – <b>T1071.001 Protocolo de Capa de Aplicación Protocolos Web</b><br/>Tráfico sobre WebSocket a través de HTTPS"] class technique_web_protocol technique malware_chainshell["<b>Malware</b> – <b>Nombre</b>: ChainShell<br/>Orquestador de cargas útiles manejando C2, encriptación y movimiento lateral"] class malware_chainshell malware %% Conexiones action_phishing –>|conduce_a| action_user_exec action_user_exec –>|ejecuta| tool_powershell tool_powershell –>|carga| tool_cmstp tool_cmstp –>|usa| technique_dll_sideload tool_cmstp –>|evita| technique_uac_bypass technique_dll_sideload –>|habilita| technique_dll_hijack technique_dll_hijack –>|soporta| technique_scheduled_task technique_scheduled_task –>|crea| malware_chainshell malware_chainshell –>|contiene| technique_steganography malware_chainshell –>|contiene| technique_embedded_payload malware_chainshell –>|encripta| technique_data_obfusc malware_chainshell –>|roba| technique_steal_cookie technique_steal_cookie –>|habilita| technique_forge_cookie technique_forge_cookie –>|habilita| technique_alt_auth technique_alt_auth –>|habilita| technique_vnc technique_vnc –>|usa| technique_remote_service malware_chainshell –>|resuelve C2 a través de| technique_dead_drop technique_dead_drop –>|se comunica a través de| technique_websocket_bidirectional technique_websocket_bidirectional –>|respaldo a| technique_websocket_oneway technique_websocket_bidirectional –>|usa protocolo| technique_web_protocol "

Flujo de Ataque

Simulation Execution

Prerequisite: The Telemetry & Baseline Pre‑flight Check must have passed.

  • Attack Narrative & Commands:

    1. Stage 1 – Prepare a simple C2 server (run on the attacker machine or a controlled VM). The server listens on port 9999 and echoes received data.

    2. Stage 2 – On the target Windows host, launch a PowerShell back‑door that opens a TCP connection to the C2 server on port 9999. The payload uses native .NET classes to avoid creating a separate executable, mimicking a “living‑off‑the‑land” approach.

    3. Stage 3 – Optional proxy hop: The PowerShell script first contacts a local HTTP proxy (listening on 127.0.0.1:8080) which forwards the TCP traffic to the remote C2 server, demonstrating that the destination port stays unchanged.

    These steps produce firewall events with DestinationPort = 9999, satisfying the Sigma rule.

  • Regression Test Script:

    # -------------------------------------------------
    # CastleRAT‑style C2 simulation – PowerShell
    # -------------------------------------------------
    # 1. Define C2 server address (replace with your test IP)
    $c2Ip = "10.0.0.50"
    $c2Port = 9999
    
    # 2. OPTIONAL: Define local proxy (if you want to test proxy hop)
    $useProxy = $false
    $proxyHost = "127.0.0.1"
    $proxyPort = 8080
    
    # 3. Function to open a TCP stream (direct or via proxy)
    function Invoke-C2Connection {
        param (
            [string]$destIp,
            [int]$destPort,
            [bool]$viaProxy
        )
        if ($viaProxy) {
            # Simple HTTP CONNECT tunnel
            $proxyUri = "http://$proxyHost`:$proxyPort"
            $client = New-Object System.Net.Sockets.TcpClient($proxyHost,$proxyPort)
            $stream = $client.GetStream()
            $connectRequest = "CONNECT $destIp`:$destPort HTTP/1.1`r`nHost: $destIp`r`n`r`n"
            $bytes = [System.Text.Encoding]::ASCII.GetBytes($connectRequest)
            $stream.Write($bytes,0,$bytes.Length)
            # Discard proxy response
            $buffer = New-Object byte[] 1024
            $null = $stream.Read($buffer,0,$buffer.Length)
            Write-Host "[+] Proxy tunnel established"
            return $stream
        } else {
            $client = New-Object System.Net.Sockets.TcpClient($destIp,$destPort)
            Write-Host "[+] Direct TCP connection established"
            return $client.GetStream()
        }
    }
    
    # 4. Open the connection
    $stream = Invoke-C2Connection -destIp $c2Ip -destPort $c2Port -viaProxy:$useProxy
    
    # 5. Send a simple beacon
    $beacon = "CastleRAT Beacon $(Get-Date -Format o)`n"
    $bytes = [System.Text.Encoding]::UTF8.GetBytes($beacon)
    $stream.Write($bytes,0,$bytes.Length)
    Write-Host "[+] Beacon sent"
    
    # 6. Keep the channel open for a short period (simulate persistence)
    Start-Sleep -Seconds 15
    
    # 7. Cleanup
    $stream.Close()
    Write-Host "[+] Connection closed"
  • Cleanup Commands:

    # Ensure any lingering TCP connections are closed
    Get-NetTCPConnection -RemotePort 9999 -State Established | ForEach-Object {
        try {
            $proc = Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue
            if ($proc) { Stop-Process -Id $proc.Id -Force }
        } catch {}
    }
    
    # Remove any temporary proxy listener if it was started locally
    Stop-Process -Name "python" -Force -ErrorAction SilentlyContinue

Additional Observations & Hardening Recommendations

  1. Enrich Port‑Based Detection: Combine the port check with known malicious C2 IPs/domains, TLS fingerprinting, or abnormal traffic volume heuristics.
  2. Allow‑List Legitimate Services: Create an exception list for applications that legitimately use ports 9999 or 8888 (e.g., certain database or management tools).
  3. Behavioural Baselines: Deploy statistical models to flag low‑frequency outbound connections to high‑risk ports originating from non‑server endpoints.
  4. Process Context: Correlate firewall events with the originating process (ImageFileName, CommandLine). Flag connections made by unexpected processes (e.g., powershell.exe, cmd.exe).

By applying these mitigations, the rule’s resilience can be raised from the current 2 to a 4‑5 range, dramatically reducing false positives while preserving detection of genuine CastleRAT C2 traffic.