Easily solved - require that .desktop files be executable ("x" bit)
Posted Feb 18, 2009 0:01 UTC (Wed) by
dwheeler (guest, #1216)
In reply to:
making .desktop files executable by DeletedUser32991
Parent article:
Follow up: How to write a Linux virus
I agree, this is a trivially-solved problem. In fact, there's a standard solution, it's just that GNOME and KDE don't use the standard in this case. Shame, shame - that needs fixing.
If a file is an arbitrarily-executable program (as desktop files are), then the system should require that the execute ("x") bit be set before it can be run. Period. It should have a "#!..." prefix at its beginning - so the spec should add that. (If you use #!/usr/bin/env ...., then you can even have PATH redirect, but I digress).
Unfortunately, there will probably need to be some temporary stopgaps while everyone transitions to what they SHOULD have been doing in the first place.
As a stopgap measure, the GUI environments could process files specially if they are executable and end in ".desktop".
Also, the GUIs might accept any desktop file stored in "/usr/share/applications/", even if its "x" bit isn't set; it requires root privilege to write there anyway, so whoever put the .desktop file there was trusted.
That way, the transition is pretty painless; once people have switched
over, the stopgaps can be removed.
If you always run a given program to process a given file, then it shouldn't need an execute bit. E.G., a PDF reader or HTML file. Yes, an HTML file might include Javascript, but what the Javascript can do is tightly controlled (by correct implementations). Yes, a PDF reader might have a buffer overflow - but clearly that is a bug in the reader. But .desktop files can include ARBITRARY, UNMEDIATED command lines, which you're EXPECTED to run - that makes them fundamentally different.
Then, merely downloading and saving the file from the Internet does nothing - the user must then set the execute bit.
Of course, this presumes that unpackaging GUI programs won't just set the execute bit on programs without giving users a chance to deal with that, but that only requires careful implementation of a very few programs.
(
Log in to post comments)