![]() |
|||||||
![]() |
|
|||||||
| Sony PlayStation Portable Sony PlayStation Portable related development discussion. |
![]() |
|
|
Thread Tools | Display Modes |
|
#11
|
|||
|
|||
|
Quote:
|
|
#12
|
|||
|
|||
|
More detailed information:
Code:
The LZW algorithm is based on a translation table, or string table,
that maps strings of input characters into codes. The TIFF
implementation uses variable-length codes, with a maximum code length
of 12 bits
The string table is initialized to contain all possible single-
character strings. There are 256 of them, numbered 0 through 255,
since our characters are bytes. There are also special codes:
#define CODE_CLEAR 256 /* code to clear string table */
#define CODE_EOI 257 /* end-of-information code */
#define CODE_FIRST 258 /* first free code entry */
As decoding continues, longer strings are added to the string table as
linked lists of characters. If the string table gets full(4096
entries), there is a "Clear code" which signals to reinitialize the
string table.
tif_lzw.c
In LZWSetupDecode():
sp->dec_codetab = (code_t*)_TIFFmalloc(CSIZE*sizeof (code_t));
In LZWPreDecode():
sp->dec_free_entp = sp->dec_codetab + CODE_FIRST;
/*
* Zero entries that are not yet filled in. We do
* this to guard against bogus input data that causes
* us to index into undefined entries. If you can
* come up with a way to safely bounds-check input codes
* while decoding then you can remove this operation.
*/
_TIFFmemset(sp->dec_free_entp, 0, (CSIZE-CODE_FIRST)*sizeof (code_t));
In LZWDecodeCompat(), LZWDecode(), and LZWDecodeVector(), when a
CODE_CLEAR code is received, the string table does not get re-zeroed,
leading to uninitialized data in the table being used, if the next
code after the CODE_CLEAR is > CODE_FIRST.
For example in LZWDecodeCompat():
while (occ > 0) {
NextCode(tif, sp, bp, code, GetNextCodeCompat);
if (code == CODE_EOI)
break;
if (code == CODE_CLEAR) {
free_entp = sp->dec_codetab + CODE_FIRST; <--
free_entp points to the first free entry
after the constant entries.
nbits = BITS_MIN;
nbitsmask = MAXCODE(BITS_MIN);
maxcodep = sp->dec_codetab + nbitsmask;
NextCode(tif, sp, bp, code, GetNextCodeCompat); <--
get the next code. The implementation
expects it to be < CODE_FIRST, but that might not be true in a
malicious file.
if (code == CODE_EOI)
break;
*op++ = code, occ--;
oldcodep = sp->dec_codetab + code;
continue;
}
codep = sp->dec_codetab + code; <--codep
points into uninitialized data
...
do {
*--tp = codep->value; <--
potential buffer underflow
} while( (codep = codep->next) != NULL);
[...]
Quote:
http://bugs.gentoo.org/show_bug.cgi?id=234080 http://bugzilla.maptools.org/show_bug.cgi?id=1929 |
|
#13
|
|||
|
|||
|
I managed to create somes tif files that crash my PSP 3000 on OFW 4.20
My tests on a Phat with CFW 5.00 m33-4 tend to show that the vulnerability has been fixed in firmware 5.00 Here are the files: http://wololo.net/files/libtiffcrash.zip There are 2 files because it seems to increase the probability of crash. But 1 should actually be enough. put the files in PSP/PHOTO, and try to view either the thumbnails or the pictures themselves, it should crash the PSP. The bug seems pretty random (depends on the state of the RAM, I guess), so you might have to reboot the PSP a few times and try again. video: I have lots of things to discuss on the subject, but I don't have enough time right now. Thing is, I pretty much reached the limits of my knowledge here, but if somebody have a clue on how such a crash could be used, please contact me if you want information on how I created the files. This is a very simple modification of LZWEncode in tif_lzw.c Again, this does NOT seem to work on 5.00, only on 4.20 |
|
#14
|
|||
|
|||
|
As soon as a lot of 3000 users are still in 4.20 (like me) or 4.21, i think that this BUG deserves a good exploration...
|
|
#15
|
|||
|
|||
|
According to some tests done by people on a japanese blog, it seems version 4.21 is patched, so this is 4.20 only :/
I could confirm the second statement (two CODE_CLEAR values in a row cause a crash), but I'm very doubtful about the first one (possibility of a buffer underflow), because I believe the following statement : Code:
codep = sp->dec_codetab + code; <--codep points into uninitialized data The variable that can have problems is oldcodep, not codep. And I am not sure if oldcodep can be really used ![]() Finally, the people who reported bugs say they have files that crash on linux and windows. The files I created only seem to crash the PSP. On cygwin (with unpatched 3.8.2, obviously), it just gives me an error message "Bogus encoding" and stops decompressing the file. |
|
#16
|
|||
|
|||
|
I verified on my 3000 w/ 4.20 fw that this does indeed lockup / crash the PSP consistently. The first time I loaded the Tiffs, when I got into pictures and then loaded the first, I got a weird streak of color across the screen and it froze. Any attempts since the PSP freezes as soon as I see the thumbnails.
I also verified this DOES NOT happen on a 2000 w/ 5.00 m33-4. Do you think this could possibly lead to code execution? Regards, Impulse / npt |
|
#17
|
|||
|
|||
|
I remember this...I experimented with this when it was first announced. I was never able to get my PSP to crash, though, so I don't know what I was doing wrong. I think I still have some files lying around that were what I was testing with, but I gave up after I was unable to crash anything. I guess this merits some further looking into.
I know I PMed FreePlay about this back when the vulnerability was first announced, but I guess he never looked into it. E] The crash appears to be it trying to read from a bogus memory address. I am unsure of where the memory address comes from, but I can tell you that the value it loads (if successful) is compared against another value and overwritten in the next instruction. Not very useful, it seems. Still, there may be more to this than I'm seeing. Last edited by Archaemic; 01-03-2009 at 12:48 AM. |
|
#18
|
|||
|
|||
|
Quote:
I'd be very happy not to be the only one looking at that though, just to be sure ![]() |
|
#19
|
|||
|
|||
|
Joined to help, I am from PSP-Hacks.
Tried this on my Slim 2000 that came with OFW 4.01 and am confirming that it successfully crashes. ![]() ![]() |
|
#20
|
|||
|
|||
|
psp slim on 4.05
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Exploit found in flash player. | Squirrel | Sony PlayStation Portable | 6 | 08-02-2007 06:11 AM |
| Possible Exploit | Kwastie | Sony PlayStation Portable | 10 | 06-14-2007 06:13 PM |
| 3.10 Possible Exploit. | Mentality | Sony PlayStation Portable | 1 | 02-03-2007 05:22 PM |
| new exploit found! | SpectroPlasm | Sony PlayStation Portable | 4 | 12-22-2006 02:00 AM |