For the English version of this alert, click here.
Allele Security Alert
ASA-2019-00010
Identificador(es)
ASA-2019-00010, CVE-2018-16865
Título
Stack overflow ao receber muitas entradas journald
Fabricante(s)
Lennart Poettering
Produto(s)
systemd
Versão(ões) afetada(s)
systemd v38 até v240
Versão(ões) corrigida(s)
systemd lançado com os seguintes commits:
journald: set a limit on the number of fields (1k)
https://github.com/systemd/systemd/commit/052c57f132f04a3cf4148f87561618da1a6908b4
journal-remote: set a limit on the number of fields in a message
https://github.com/systemd/systemd/commit/ef4d6abe7c7fab6cbff975b32e76b09feee56074
Prova de conceito
Sim
Descrição
Uma alocação de memória sem limites, que poderia resultar em stack clash com outra região de memória, foi descoberta no systemd-journald quando muitas entradas são enviadas para o soquete do journald. Um atacante local, ou um atacante remoto, se estiver usando o systemd-journal-remote, pode usar essa falha para travar o systemd-journald ou executar código com privilégios de journald.
Detalhes técnicos
File: v238/src/journal/journal-file.c --- 1963 int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const struct iovec iovec[], unsigned n_iovec, uint64_t *seqnum, Object **ret, uint64_t *offset) { .... 1986 items = alloca(sizeof(EntryItem) * MAX(1u, n_iovec)); 1987 1988 for (i = 0; i < n_iovec; i++) { 1989 uint64_t p; 1990 Object *o; 1991 1992 r = journal_file_append_data(f, iovec[i].iov_base, iovec[i].iov_len, &o, &p); 1993 if (r < 0) 1994 return r; 1995 1996 xor_hash ^= le64toh(o->data.hash); 1997 items[i].object_offset = htole64(p); 1998 items[i].hash = o->data.hash; 1999 } ---
Esta vulnerabilidade foi introduzida no systemd v38:
commit cf244689e9d1ab50082c9ddd0f3c4d1eb982badc Date: Thu Dec 29 15:00:57 2011 +0100 ... - items = new(EntryItem, n_iovec); - if (!items) - return -ENOMEM; + items = alloca(sizeof(EntryItem) * n_iovec);
e se tornou explorável no systemd v201:
commit c4aa09b06f835c91cea9e021df4c3605cff2318d Date: Mon Apr 8 20:32:03 2013 +0200 ... -#define ENTRY_SIZE_MAX (1024*1024*64) -#define DATA_SIZE_MAX (1024*1024*64) ... +#define ENTRY_SIZE_MAX (1024*1024*768) +#define DATA_SIZE_MAX (1024*1024*768)
Créditos
Qualys Research Labs
Referência(s)
System Down: A systemd-journald exploit
https://seclists.org/oss-sec/2019/q1/54
1653861 (CVE-2018-16865) – CVE-2018-16865 systemd: stack overflow when receiving many journald entries
https://bugzilla.redhat.com/show_bug.cgi?id=1653861
journald: set a limit on the number of fields (1k)
https://github.com/systemd/systemd/commit/052c57f132f04a3cf4148f87561618da1a6908b4
journal-remote: set a limit on the number of fields in a message
https://github.com/systemd/systemd/commit/ef4d6abe7c7fab6cbff975b32e76b09feee56074
Exploiting systemd-journald Part 1
https://capsule8.com/blog/exploiting-systemd-journald-part-1/
system-down.tar.gz
https://www.qualys.com/2019/05/09/system-down/system-down.tar.gz
CVE-2018-16865
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-16865
CVE-2018-16865
https://nvd.nist.gov/vuln/detail/CVE-2018-16865
Se encontrou algum erro neste alerta ou deseja uma análise compreensiva, entre em contato.
Última modificação: 10 maio 2019