A recently discovered vulnerability in the Linux kernel, specifically in the lib/seq_buf.c file, affects versions of the kernel prior to 5.13.3. This vulnerability, designated as CVE-2023-28772, can lead to a seq_buf_putmem_hex buffer overflow. This type of overflow can potentially provide malicious users with unauthorized access to the system, leading to potential data leakage or system hijacking.

Exploit Details

To understand the vulnerability, it's crucial to know about the seq_buf_putmem_hex function within the lib/seq_buf.c file. This function is responsible for converting a memory block's contents to a hexadecimal representation. However, due to the improper handling of memory allocation inside this function, it may lead to a buffer overflow.

The CVE-2023-28772 vulnerability arises when the seq_buf_putmem_hex function writes more data than is allocated for the buffer space. This exceeding of space can damage nearby memory, leading to potential arbitrary code execution or denial of service.

Below is a code snippet showcasing the problematic portion of the lib/seq_buf.c file

int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, size_t len)
  size_t i;
  const unsigned char *buf = mem;

  for (i = ; i < len; i++) {
      int err;

      err = seq_buf_putc(s, hex_asc_hi(buf[i]));
      if (err)
          return err;

      err = seq_buf_putc(s, hex_asc_lo(buf[i]));
      if (err)
          return err;

  return ;

Possible Mitigation

Updating the Linux kernel to version 5.13.3 or newer will effectively address this vulnerability. The updated kernel contains a fix where proper handling of memory allocation is ensured, and consequently, the potential for the seq_buf_putmem_hex buffer overflow is resolved.

Original References

1. Linux kernel source code – The official Linux kernel source code where the vulnerability exists.

2. CVE-2023-28772 on NVD - The National Vulnerability Database's entry for the CVE-2023-28772 vulnerability.

3. Kernel.org – The official website for Linux kernel updates and news.


The CVE-2023-28772 vulnerability is a serious issue that may lead to unauthorized access, data leakage, and even system hijacking. Therefore, it's important to update the Linux kernel to 5.13.3 or a newer version as soon as possible. Users should also ensure they have a strong security posture by keeping their systems updated, monitoring for any suspicious activity, and being cautious with the access they grant to applications and users.


Published on: 03/23/2023 15:15:00 UTC
Last modified on: 04/27/2023 15:15:00 UTC