Activity log for bug #546009

Date Who What changed Old value New value Message
2010-03-24 13:42:15 Dan Rosenberg bug added bug
2010-03-24 13:42:15 Dan Rosenberg attachment added Causes infinite stack popping, leading to jump to controllable address http://launchpadlibrarian.net/41836803/infinite.ps
2010-03-24 13:43:21 Dan Rosenberg attachment added Causes memory corruption, due to invalid function pointer call (8.64) or stack overflow (8.70) http://launchpadlibrarian.net/41836930/overflow.ps
2010-04-09 19:38:23 Kees Cook description Binary package hint: ghostscript I have discovered multiple memory corruption vulnerabilities in Ghostscript, which can be triggered when using Ghostscript to view maliciously crafted PostScript files. 1. The Ghostscript interpreter fails to properly handle some cases of infinite recursion. By creating a .ps file with a sequence such as: /A{pop 0 A 0} bind def /product A 0 The interpreter's internal stack will be overflowed with recursive calls. Rather than gracefully handling this situation, the interpreter continues execution by jumping to an (usually invalid) address near (or past) the tail end of the stack. Without further manipulation, this would simply result in a segfault, but it turns out that by altering the number of variable definitions that occur before the call to the infinitely recursive procedure, the user can actually exert control over the address that is jumped to. Combined with the fact that the attacker has an easy way to introduce shellcode (via the .ps file), this can definitely result in arbitrary code execution. I have not developed a fully functional exploit for this case, but the attached reproducer ("infinite.ps") will trigger a segfault in the same location on all of the versions of Ghostscript I have tested, including 8.61, 8.62, 8.64, and 8.70. If you wish to more convincingly verify that this is exploitable, place varying amounts of "/A{ 0 } bind def" strings at the beginning of the file, and observe how the EIP at crash time is altered. Unfortunately, the Ghostscript code is rather complex, so I am unable to determine the root cause of this vulnerability in the source. 2. Ghostscript fails to properly parse very long identifiers, leading to memory corruption and potentially arbitrary code execution. The resulting behavior depends on the version of Ghostscript. I have found that 8.61 (Hardy) is not vulnerable. However, 8.64 (Jaunty) is vulnerable and exploitable. I haven't been able to pin down the exact cause for the overflow, but the exploitable memory access occurs in gc_objects_clear_marks(), in psi/igc.c, when *(pre + 1) is called as a function. 3. 8.70 (Karmic) is also vulnerable to an overflow when parsing very long identifiers, but this time, rather than an invalid (exploitable) function pointer call, the issue is a classic stack overflow. The overflow occurs due to a bad memcpy() call in dynamic_save(), called in scan_token() in psi/iscan.c at line 1061. Successful exploitation is mitigated by SSP - it catches the overflow and terminates - so on Karmic this should only result in denial of service. The attached reproducer ("overflow.ps") will trigger overflows in both 8.64 and 8.70 due to the different reasons described above. Binary package hint: ghostscript I have discovered multiple memory corruption vulnerabilities in Ghostscript, which can be triggered when using Ghostscript to view maliciously crafted PostScript files. 1. The Ghostscript interpreter fails to properly handle some cases of infinite recursion. By creating a .ps file with a sequence such as: /A{pop 0 A 0} bind def /product A 0 The interpreter's internal stack will be overflowed with recursive calls. Rather than gracefully handling this situation, the interpreter continues execution by jumping to an (usually invalid) address near (or past) the tail end of the stack. Without further manipulation, this would simply result in a segfault, but it turns out that by altering the number of variable definitions that occur before the call to the infinitely recursive procedure, the user can actually exert control over the address that is jumped to. Combined with the fact that the attacker has an easy way to introduce shellcode (via the .ps file), this can definitely result in arbitrary code execution. I have not developed a fully functional exploit for this case, but the attached reproducer ("infinite.ps") will trigger a segfault in the same location on all of the versions of Ghostscript I have tested, including 8.61, 8.62, 8.64, and 8.70. If you wish to more convincingly verify that this is exploitable, place varying amounts of "/A{ 0 } bind def" strings at the beginning of the file, and observe how the EIP at crash time is altered. Unfortunately, the Ghostscript code is rather complex, so I am unable to determine the root cause of this vulnerability in the source. 2. Ghostscript fails to properly parse very long identifiers, leading to memory corruption and potentially arbitrary code execution. The resulting behavior depends on the version of Ghostscript. I have found that 8.61 (Hardy) is not vulnerable. However, 8.64 (Jaunty) is vulnerable and exploitable. I haven't been able to pin down the exact cause for the overflow, but the exploitable memory access occurs in gc_objects_clear_marks(), in psi/igc.c, when *(pre + 1) is called as a function. 8.70 (Karmic) is also vulnerable to an overflow when parsing very long identifiers, but this time, rather than an invalid (exploitable) function pointer call, the issue is a classic stack overflow. The overflow occurs due to a bad memcpy() call in dynamic_save(), called in scan_token() in psi/iscan.c at line 1061. Successful exploitation is mitigated by SSP - it catches the overflow and terminates - so on Karmic this should only result in denial of service. The attached reproducer ("overflow.ps") will trigger overflows in both 8.64 and 8.70 due to the different reasons described above.
2010-04-09 21:40:54 Kees Cook ghostscript (Ubuntu): status New Confirmed
2010-04-09 21:40:56 Kees Cook ghostscript (Ubuntu): importance Undecided Medium
2010-05-12 00:23:15 Dan Rosenberg visibility private public
2010-05-14 08:40:10 Till Kamppeter bug watch added http://bugs.ghostscript.com/show_bug.cgi?id=691303
2010-05-14 08:40:10 Till Kamppeter bug task added gs-gpl
2010-05-14 09:27:49 Bug Watch Updater gs-gpl: status Unknown Invalid
2010-05-14 10:08:42 Till Kamppeter bug watch added http://bugs.ghostscript.com/show_bug.cgi?id=691295
2010-05-14 10:08:42 Till Kamppeter gs-gpl: status Invalid Unknown
2010-05-14 10:08:42 Till Kamppeter gs-gpl: remote watch Ghostscript (AFPL) Bugzilla #691303 Ghostscript (AFPL) Bugzilla #691295
2010-05-14 11:01:39 Bug Watch Updater gs-gpl: status Unknown Confirmed
2010-05-19 14:47:05 Tomas Hoger bug watch added http://bugs.ghostscript.com/show_bug.cgi?id=690902
2010-05-21 14:24:37 Marc Deslauriers cve linked 2010-1869
2010-05-21 14:53:49 Marc Deslauriers cve linked 2010-1628
2010-06-15 16:09:28 Kees Cook bug added subscriber Kees Cook
2010-06-15 16:09:42 Kees Cook bug added subscriber Brian Murray
2010-06-15 16:29:44 Brian Murray removed subscriber Brian Murray
2010-06-22 20:20:52 Bug Watch Updater gs-gpl: status Confirmed Fix Released
2010-07-13 18:04:33 Launchpad Janitor ghostscript (Ubuntu): status Confirmed Fix Released
2010-07-13 18:30:43 Launchpad Janitor branch linked lp:ubuntu/jaunty-security/ghostscript
2010-07-13 18:30:48 Launchpad Janitor branch linked lp:ubuntu/karmic-security/ghostscript
2010-07-13 18:30:52 Launchpad Janitor branch linked lp:ubuntu/hardy-security/ghostscript
2010-07-13 18:31:24 Launchpad Janitor branch linked lp:ubuntu/lucid-security/ghostscript
2010-07-22 11:15:41 Launchpad Janitor branch linked lp:ubuntu/ghostscript
2010-09-03 11:08:05 Bug Watch Updater gs-gpl: status Fix Released Confirmed
2011-02-04 08:07:06 Bug Watch Updater gs-gpl: importance Unknown Critical
2011-10-19 16:46:38 Jamie Strandboge removed subscriber Ubuntu Security Team
2011-11-01 13:25:56 Bug Watch Updater gs-gpl: status Confirmed Fix Released
2016-12-02 02:34:42 Rahmadani bayu aji ghostscript (Ubuntu): assignee Skymathrix (asstaroid)