Summary: | handling /undefined results in SEGV | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Tavis Ormandy <taviso> |
Component: | Security (public) | Assignee: | Chris Liddell (chrisl) <chris.liddell> |
Status: | RESOLVED FIXED | ||
Severity: | critical | CC: | cbuissar, scorneli |
Priority: | P1 | ||
Version: | unspecified | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | Word Size: | --- |
Description
Tavis Ormandy
2018-08-24 20:55:10 UTC
I didn't understand (at first) the "appears to expose undefined names". What it does when "runpdfbegin" stops is that it leaves GS_PDF_ProcSet on the dict stack, and apparently the "CS" proc in that causes a segfault. The GS_PDF_ProcSet is currently in userdict, and items can be loaded from it. A more serious issue is that the dictionary is DANGEROUS, so I have changed this to P1, critical. I have a PoC that allows access to systemdict, so pretty much anything can be done. We need to make sure this dictionary isn't left laying around in userdict, and make sure the PDF interpreter never leaves it (or other PDF interpreter procset dicts) on the dict stack after an error, and (for extra precaution) make it executeonly. As a lower priority, we may want to scan the various procs to make sure that none of them can cause segfaults (as CS does in this example). Ah-ha, that explains it, thanks for investigating Ray. I guess I'm lucky CS segfaults, or I wouldn't have noticed a serious issue :) Presumably, if we make all the PDF interpreter procedures executeonly then that would ameliorate the worst of the exploit - it still leaves the segfault to solve, of course. FWIW, I *suspect* the problem is that it has been assumed that binding all the PDF interpreter procedures provides security against such exploits - but bind is not guaranteed to succeed, so we shouldn't rely on it. (In reply to Chris Liddell (chrisl) from comment #3) > Presumably, if we make all the PDF interpreter procedures executeonly then > that would ameliorate the worst of the exploit - it still leaves the > segfault to solve, of course. > > FWIW, I *suspect* the problem is that it has been assumed that binding all > the PDF interpreter procedures provides security against such exploits - but > bind is not guaranteed to succeed, so we shouldn't rely on it. As we discovered on Thursday.... Oh well. I was going to suggest that we should make the executable procedures executeonly, I'll look at it on Monday. And yes, I wanted to understand the seg fault before hiding the problem, as in the gssetresolution case. By the way, I don't really think its worth changing the priority or severity of these, they are all classified as 'security' which to my mind makes them as important as its possible to get. Commit ea735ba37dc0fd5f5622d031830b9a559dec1cc9 addresses the bug described here (and a similar companion possibility with the SC PDF operator). Because Ray's comment #1 is a completely different problem, I've chose to open a new bug for that. This is bug 699676 |