Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2021-38714: PLIB / Bugs / #55 integer overflow for maliciously crafted tga file

In Plib through 1.85, there is an integer overflow vulnerability that could result in arbitrary code execution. The vulnerability is found in ssgLoadTGA() function in src/ssg/ssgLoadTGA.cxx file.

CVE
#vulnerability#c++

In plib, there is an integer overflow vulnerability that may cause arbitrary code execution in the victim’s system with a maliciously crafted input.

The vulnerability resides in ssgLoadTGA() function in src/ssg/ssgLoadTGA.cxx file. In line 91, the program reads data from given tga file using fread.

if ( fread(header, 18, 1, f) != 1 )

Then, it stores the value to xsize and ysize and bits without sanitizing.

// image info int type = header[2]; int xsize = get16u(header + 12); int ysize = get16u(header + 14); int bits = header[16];

If xsize and ysize are enough large to cause integer overflow the small heap block is allocated when the new image is created. It leads to buffer overrun when reads data to this buffer.

GLubyte *image = new GLubyte [ (bits / 8) * xsize * ysize ];

I attach the maliciously crafted tga file which crashes program like below.

$ apt source plib $ cd plib-1.8.5 $ ./configure && make $ cd src/ssg $ gcc -I…/…/src/sg -I…/…/src/util test.cxx -lplibssg

where text.cxx is as follows

#include <stdlib.h> #include “ssg.h”

int main(int argc, char **argv) { ssgLoadTGA (argv[1], NULL); }

$ ./a.out poc.tga DEBUG: ssgLoadTGA: Loading 'poc.tga’, colormap 65535x65535-8. terminate called after throwing an instance of ‘std::bad_alloc’ what(): std::bad_alloc Aborted (core dumped)

Thank you.

Related news

Ubuntu Security Notice USN-6353-1

Ubuntu Security Notice 6353-1 - Wooseok Kang discovered that PLIB did not properly manage memory under certain circumstances. If a user were tricked into opening a specially crafted TGA file, an attacker could possibly use this issue to cause applications using PLIB to crash, resulting in a denial of service, or possibly execute arbitrary code.

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907