OK but although I love the file utility, why does OpenOffice and/or CUPS rely on it to... print a file that ends with the .ps extension?
It's kinda begging for troubles.
OK but although I love the file utility, why does OpenOffice and/or CUPS rely on it to... print a file that ends with the .ps extension?
It's kinda begging for troubles.
Like I get that sometimes you have to do what you have to do, but sniffing should be a last resort.
An attacker might send a file that orders for millions of dollars of pizzas, using the fax hardware built into the printer (I’m not sure you can buy postscript printers that can fax today, but you can buy printers that can fax even today)
Imagine a server allows you to upload images. It has a system designed for images only. It will behave unpredictably maybe even dangerously with another file. The server checks that the file ends with .jpg. it checks that the file is a valid jpeg. All clear. Upload allowed. But 5 steps later some tool looks at the image file and notices it's a valid zip file (creating files with multiple valid interpretations is something people have succeeded in doing it's not always so hard). It runs this check before the image check. The next step in the processing chain wants an image but it has been told it's dealing with a zip file. So it unzips the file to see if it contains an image. But it was a zip bomb. The server goes down.
If the printer endpoint of the USB device receives a file that orders millions of pizzas, it will print the file (or print a PS error, or print the plaintext contents of the file), not order pizzas.
If the user mistakenly "prints" to the fax device, the file will be printed at the destination fax machine, at the number the user typed, not the number in the file, and it will print, not order pizzas (unless the pizzeria accepts fax orders, which would be a prank, not an attack).
It is how at least one of them works, and how I assumed all of them work. http://www.whoopis.com/howtos/laserwriter16-600/LaserWriter_...:
“FaxOptions Dictionary This dictionary contains parameters that direct fax transmissions from a PostScript language program. Refer to “Fax Parameters” on page 29 for further information about FaxOptions defaults and the keys found in this dictionary”
Google tells me this is what you needed in your PostScript file to send a fax:
<<
/OutputDevice /Fax
/FaxOptions <<
/DialCallee (555-0199)
>>
>> setpagedevice
And I don’t think Apple was unique in having fax support in their PostScript. https://web.mit.edu/PostScript/Adobe/Documents/5001.DSC_Spec... mentions faxing, too (but doesn’t appear to say how to accomplish it)But even if it is capable, currently used cups validation would still find a valid PS even if the PS contents itself is malicious.
What you need is a printer that decides what to do with a file based on file contents instead of instructions from the computer. Like, "Computer: Print this as an unformatted text file!" / "Printer: This text fine you sent me is actually a PS file. I'm going to fax it instead, because it says so inside."
`sudo apt purge libcups*`
NB, don't do this on a system you're planning to keep operational, this will autoremove half the OS if allowed to run.