09 - Verificacion y Busquedas SOC

Verificación funcional

1. Servicios y puertos

Get-Service Splunkd,SplunkForwarder | Format-Table Name,Status,StartType
foreach ($p in 8000,8089,9997,8090) {
    $t = Test-NetConnection 127.0.0.1 -Port $p -WarningAction SilentlyContinue
    "Puerto $p : $($t.TcpTestSucceeded)"
}

Resultados esperados tras la instalación:

  • Splunkd Running
  • SplunkForwarder Running
  • Puertos 8000, 8089, 9997 a True
  • 8090 = mgmt port del UF (no critical para analista)

2. índices creados

Splunk Web → Settings → Indexes y filtrar por win_*. Verificar que cada uno no está vacío tras esperar 5-10 min.

SPL equivalente (admin):

| rest /servicesdata/indexes | search title="win_*"
| table title currentSize primary.totalBuckets

3. Forwarder conectado

En Splunk Web:

Settings → Forwarder Management → Forwarders

debería listar HOSTNAME.

SPL:

index=_internal source=*metrics.log group=tcpout
| stats count latest(_time) by host

4. Llegada de datos por index

| tstats count where index=win_* OR index=_internal by index _time span=1h

Más concreto, comprueba cada fuente:

index=win_security      | stats count by EventCode | sort -count
index=win_sysmon        | stats count by EventID    | sort -count
index=win_powershell    | stats count by EventCode  | sort -count
index=win_defender      | stats count by EventCode  | sort -count
index=win_perfmon        | stats count by counter    | sort -count

Busquedas SOC iniciales útiles en este PC

Logins correctos en última 1h

index=win_security EventCode=4624
| stats count, values(Account_Name), values(IpAddress), values(Logon_Type)
  by ComputerName
| sort -count

Logins fallidos (fuerza bruta SSH/RDP local)

index=win_security EventCode=4625
| bucket _time span=5m
| stats count vals(Account_Name) as users by _time IpAddress
| where count > 10
| sort -count

Creación de procesos sensibles

Sysmon EID 1 con padres sospechosos o hashes válidos:

index=win_sysmon EventID=1
| search (Image="*.exe" OR CommandLine="*powershell*")
| table _time host Image ParentImage CommandLine Hashes

PowerShell encoded commands (bypass clásico)

index=win_powershell EventCode=4104
| search ScriptBlockText="*-EncodedCommand*" OR ScriptBlockText="*FromBase64String*"
| table _time Message

Conexiones de red por proceso

index=win_sysmon EventID=3
| stats dc(DestinationIp) values(DestinationIp) values(DestinationPort)
  by Image, InitiatingProcess
| sort 0

DNS queries sospechosas (C2 / DGA)

index=win_sysmon EventID=22
| stats count by QueryName
| where QueryName likes("%.ru") OR QueryName likes("%.cn") OR QueryName likes("%.xyz")
| sort -count

Persistencia via Task Scheduler

index=win_tasks EventCode=200 OR EventCode=201
| table _time ActionName TaskName

Lateral movement vía WMI

index=win_wmi EventCode=1295 OR EventCode=1296
| stats count by User, ClientMachine

Revisión Sysmon

Comprobar config activa y que los EIDs esperados llegan:

sysmon -s                 # imprime config (admin)
Get-WinEvent -LogName 'Microsoft-Windows-Sysmon/Operational' -MaxEvents 100 |
  Group-Object Id | Select-Object Name,Count

En este PC la config de Sysmon estaba instalada al inicio del proyecto (servicio Running), pero no se encontró archivo de config en C:\Windows\sysmonconfig.xml. Recomendación: desplegar config de SwiftOnSecurity u Olaf Hartong]:

Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/SwiftOnSecurity/sysmon-config/master/sysmonconfig-export.xml' `
                  -OutFile C:\Sysmon\sysmonconfig.xml
sysmon -accepteula -c C:\Sysmon\sysmonconfig.xml

Si no se hace esto, los EIDs llegarán pero con reglas mínimas/shipping default, perdiendo visibilidad (por ejemplo DNS Query EID=22 requiere DnsQuery rule).

Dashboards recomendados

Aceleración (recomendable a partir de ~5 GB de win_*)

  1. Instalar Splunk Common Information Model (CIM).
  2. Settings → Data Models → habilitar acceleration para Authentication, Endpoint.Processes, Endpoint.NetworkSessions, Performance.
  3. Acelerar en win_* indexes para tstats subsegundo.

Volver a: 00 - MOC Monitorización PC Local