what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

sdl-overflow.txt

sdl-overflow.txt
Posted Jan 24, 2008
Authored by Gynvael Coldwind

SDL_Image versions 1.2.6 and below suffer from a GIF handling buffer overflow vulnerability.

tags | advisory, overflow
SHA-256 | 013e44ffbd053ccc714332adb0917f693c76ce4e1a1854c18fcc279af2d8b8e3

sdl-overflow.txt

Change Mirror Download
* Name      : SDL_Image 1.2.6 and prior GIF handling buffer overflow
* Type : (Remote) DoS / Code Execution (?)
* Impact : Low / Medium (?)
* Credits : Gynvael Coldwind / Team Vexillium
* Discovered: 2007-12-17
* Published : 2008-01-23


* Brief

SDL_Image is an open source library providing image file handling
functionality.
GIF format handling routines suffers from lack of proper buffer
size validating, which makes it vulnerable to a buffer overflow
attack. An attacker could DoS an application using SDL_Image,
or execute arbitrary code (this has not been confirmed, and
is believed to be nontrivial).
Since this is a library, in some cases the attack could be remote.


* Verbose

The problem takes place when a GIF file has invalid LWZ Minimum Code
Size in the Table Based Image Data header. The standard allows the
codes to have maximum size of 12 bits, but this is not checked in
SDL_image.
An attacker could use this for a local or remote buffer overflow
attack that may have denial of service or arbitrary code execution
effect.

SDL_image file IMG_gif.c, function ReadImage:

...
unsigned char c;
...
if (LWZReadByte(src, TRUE, c) < 0) {
RWSetMsg("error reading image");
return NULL;
}
/*
** If this is an "uninteresting picture" ignore it.
*/
if (ignore) {
while (LWZReadByte(src, FALSE, c) >= 0)
;
return NULL;
}
...

Please note that 'c' value is passed to LZWReadByte without checking
if it is OK with the standard.

Then in function LWZReadByte:

LWZReadByte(SDL_RWops *src, int flag, int input_code_size)
...
static int table[2][(1 << MAX_LWZ_BITS)];
...
set_code_size = input_code_size;
...
clear_code = 1 << set_code_size;
...
for (i = 0; i < clear_code; ++i) {
table[0][i] = 0;
table[1][i] = i;
}
...

This is the first place that is affected by this issue.


* Proof of concept

DoS proof of concept GIF file:
http://vexillium.org/dl.php?sdlgifdos


* Versions affected and vendor status

Version 1.2.6 and prior are affected.
Vendor was informed and has fixed this issue in 1.2.7.


* Disclaimer

This document and all the information it contains is provided "as is",
without any warranty. The author is not responsible for the
misuse of the information provided in this advisory. The advisory is
provided for educational purposes only.

Permission is hereby granted to redistribute this advisory, providing
that no changes are made and that the copyright notices and
disclaimers remain intact.

--
gynvael.coldwind//vx
http://vexillium.org
http://hispasec.com
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close