CERT-SG IRM-03: Unix Linux Intrusion
CERT-SG IRM-03: Unix Linux Intrusion
Playbook operativo de Incident Response del CERT Societe Generale. Importado desde el vault PAI Obsidian-Inbox para uso de Juniors.
Resumen original
PURPOSE: This Incident Response Methodology is a cheat sheet dedicated to handlers investigating on a precise security issue — specifically, live analysis on a suspected Unix/Linux system.
WHO SHOULD USE IRM SHEETS?
- Administrators
- Security Operation Center
- CISOs and deputies
- CERTs (Computer Emergency Response Team)
INCIDENT HANDLING STEPS — 6 steps are defined to handle security incidents:
- Preparation: get ready to handle the incident
- Identification: detect the incident
- Containment: limit the impact of the incident
- Remediation: remove the threat
- Recovery: recover to a normal stage
- Lessons learned: draw up and improve the process
Metodos
Case study / cheat sheet basado en el framework NIST de 6 pasos, aplicado a la deteccion de intrusiones en sistemas Unix/Linux. Incluye comandos especificos para cada verificacion.
Hallazgos clave
- Preparacion: Desplegar EDR en endpoints y servidores; acceso fisico al sistema preferido sobre acceso remoto (el atacante podria detectar la investigacion via sniffer); mantener lista actualizada de archivos criticos (especialmente SUID/GUID) en lugar seguro fuera de la red; usar Auditd, AppArmor y logs de sistema/aplicaciones
- Identificacion - Cuentas inusuales: Buscar entradas sospechosas en /etc/passwd con UID 0; verificar /etc/group y /etc/shadow; buscar archivos huerfanos con
find / \( --nouser -o --nogroup \) --print - Identificacion - Archivos inusuales: Buscar archivos SUID/GUID con
find / -uid 0 \( --perm -4000 -o --perm 2000 \) --print; buscar nombres de archivo extraños (". ", ".. ", " "); buscar archivos grandes; verificar procesos corriendo desde archivos eliminados conlsof +L1; revisar /proc y /tmp - Identificacion - Servicios inusuales: Usar
chkconfig --listyps -aux; investigar procesos desconocidos conlsof -p [pid]; atencion especial a procesos bajo UID 0 - Identificacion - Actividad de red inusual: Detectar sniffers buscando modo promiscuo en logs del kernel; verificar actividad de puertos con
netstat -napylsof -i; buscar entradas MAC inusuales conarp -a - Identificacion - Tareas automatizadas: Revisar cron jobs de root y del sistema; inspeccionar /etc/crontab y /etc/cron.*
- Identificacion - Logs inusuales: Revisar /var/log/auth.log, kern.log, cron.log, httpd/, secure, utmp/wtmp, syslog, historiales de comandos de root y usuarios
- Identificacion - Kernel: Usar
dmesg,lsmod,lspci; buscar rootkits con rkhunter; verificar hashes de binarios con AIDE, rpm, debsums - Contencion: Backup bit-a-bit del disco y copia de memoria RAM; aislar con EDR, firewall o switches; investigacion offline si la identificacion no dio resultados
- Remediacion: Solo remediar cuando el perimetro este contenido; remover accesos de cuentas involucradas y archivos maliciosos
- Recuperacion: Reinstalar el sistema completamente como mejor practica; si no es posible: cambiar contrasenas, verificar integridad con hashes SHA256, restaurar binarios alterados, reemplazar paquetes comprometidos
Relevancia
Referencia operativa indispensable para la investigacion forense en Linux/Unix. La inclusion de comandos exactos para cada tipo de verificacion la convierte en un checklist ejecutable inmediatamente. Destaca la advertencia sobre rootkits que pueden alterar los resultados de los propios comandos del sistema, y la importancia de tener una lista de referencia de archivos SUID/GUID almacenada fuera de la red.
Citas clave
"You should know your usual running processes and be able to figure out which processes could have been added by a hacker. Pay special attention to the processes running under UID 0." (p. 6)
"WARNING: this operation will probably change all file timestamps. This should only be done after all other investigations are done and you feel like you can alter these data." (p. 8)
"No matter how far the attacker has gone into the system and the knowledge you might have about the compromise, as long as the system has been compromised, the best practice is to reinstall the system completely and apply all security fixes." (p. 11)
"If the machine is not considered critical for the company and can be disconnected, shut the machine down the hard way, removing its power plug." (p. 9)
Conexiones
- certsg-irm-02-windows-intrusion — Equivalente para sistemas Windows
- certsg-irm-01-worm-infection — Respuesta a infecciones por malware, referencia cruzada
- certsg-irm-05-malicious-network-behaviour — Comportamiento de red malicioso, complementario
- certsg-irm-18-large-scale-compromise — Referenciado para recuperacion de infraestructura
- Tema principal: Themes/respuesta-incidentes-lifecycle