Resumen Ejecutivo
Críticos
3
RCE + heap overflow
Altos
7
auth bypass + SSRF
Medios
12
info-leaks + logic
Superficies analizadas
4
parser · api · supply-chain · driver
Metodología — Fases de Ejecución
Fase 01
Reconocimiento
- Enumeración de versiones
- Mapeo de superficie de ataque
- CVE database (NVD, OSV)
- SBOM analysis (syft)
Fase 02
Análisis Estático
- CodeQL sobre Python/FastAPI
- Semgrep: funciones peligrosas C
- Ghidra: binario nutriparser
- Patch diffing v2.2 → v2.3
Fase 03
Análisis Dinámico
- Frida: hooking runtime iOS/Android
- DynamoRIO: taint analysis C
- WinDbg: driver IOCTL
- eBPF bpftrace: syscalls
Fase 04
Fuzzing
- AFL++ 4.21: harness .ndi parser
- LibAFL: API HTTP/2 endpoints
- Nyx snapshot: stateful auth
- LLM-guided corpus (ChatAFL)
Fase 05
Explotación
- Primitivas: addrof/fakeobj
- Bypass ASLR via info-leak
- Payload PoC documentado
- Reporte + mitigaciones
Hallazgos Identificados
Deep-Dive: NTR-001 — Heap Overflow
9.8
CVSS v3.1 — CRÍTICO
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
nutriparser/src/ndi_parser.c · línea 247
⚠ VULNERABLE
// NDI header parser — NutriFlow v2.3.1
int parse_ndi_header(uint8_t *buf, size_t buf_len) {
ndi_entry_t *e = (ndi_entry_t *)buf;
char label[64]; // fixed-size stack buffer
// ⚠ VULN: name_len proviene del archivo sin validar
memcpy(label, e->name, e->name_len); // heap overflow!
// FIX recomendado:
// if (e->name_len > sizeof(label) - 1) return -EINVAL;
// memcpy(label, e->name, e->name_len);
}
Crash Triage — AFL++ output
==AFL fuzzer crash #0041==
KASAN: heap-buffer-overflow in parse_ndi_header
Write of size 512 at addr ffff888003a12040
memcpy+0x1f (nutriparser.c:247)
parse_ndi_header+0x8c (ndi_parser.c:247)
process_diet_file+0x1a3 (api_handler.c:89)
Corpus input: crash-0041-minimal.ndi (28 bytes)
Cobertura de Fuzzing — AFL++ Stats
parse_ndi_header()89%
ndi_chain_walker()64%
crypto_decrypt_ndi()31%
api_v2_import_url()47%
ioctl_handler_0x22041C()73%
48,291
Ejecuciones/seg
23
Crashes únicos
1,847
Paths cubiertos
Progreso del Red Team
Reconocimiento completado
Análisis estático — 3 críticos detectados
Fuzzing harness .ndi — crash #0041
Análisis dinámico — Frida iOS + DynamoRIO
Explotación + PoC final
Entrega informe + parches recomendados
Herramientas por Superficie de Ataque
Checklist — Parser Binario C
-
Validación bounds antes de memcpy()entry.name_len sin verificar contra sizeof(label)
-
Invariante offset+length ≤ buf_len (u64)aritmética de next en cadenas sin overflow check
-
ASan/KASAN habilitado en CIactivado en pipeline de test pero no en prod
-
Stack canaries habilitados-fstack-protector-all verificado en binario
-
RELRO completo + PIE activonutriparser compilado sin full RELRO
-
Fuzzing continuo (ClusterFuzzLite CI)configurado en GitHub Actions — implementar
-
Crypto writes a arrays fijos con bound checkcrypto_decrypt_ndi() sin límite en destino
Mitigaciones Recomendadas
NTR-001 CRÍTICO
Añadir bounds check antes de memcpy
if (e->name_len >= sizeof(label)) return -EINVAL;
memcpy(label, e->name, e->name_len);
label[e->name_len] = '\0';
NTR-003 CRÍTICO
Bloquear SSRF vía allowlist + IMDSv2
# FastAPI · api_handler.py
BLOCKED = ["169.254.", "10.", "192.168."]
if any(url.startswith(p) for p in BLOCKED):
raise HTTPException(400, "URL bloqueada")
NTR-005 ALTO
Publicar nutri-core en PyPI (squatting)
Registrar
nutri-core en PyPI con paquete vacío + aviso de seguridad. Usar hash pinning en requirements.txt. Configurar private registry (AWS CodeArtifact).