Bug 1206756

Summary: exo-open will execute an untrusted application launcher
Product: [Fedora] Fedora Reporter: Noah Petherbridge <root>
Component: exoAssignee: Kevin Fenzi <kevin>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: kevin, nonamedotc, pertusus, rdieter
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-02 10:36:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Noah Petherbridge 2015-03-28 03:56:59 UTC
Description of problem:

xdg-open can be told to open an application launcher (.desktop file) that is not "trusted" (marked executable). xdg-open will launch the application from this file anyway.

Graphical desktop environments like Xfce/Thunar, on the other hand, will not execute an untrusted application launcher. Instead, double-clicking it will result in a warning prompt explaining that the launcher is not trusted and giving options to mark it executable, launch it anyway, or cancel.


Version-Release number of selected component (if applicable):

xdg-utils-1.1.0-0.39.rc3.fc21.noarch


How reproducible:

Always


Steps to Reproduce:
1. Create an application launcher .desktop file, and make sure it is NOT executable (chmod -x)
2. Run `xdg-open test.desktop` to launch your file. See that it runs.
3. Open Thunar on an Xfce desktop (haven't tested with Nautilus), and double-click on the .desktop file. See that it resists launching it.
4. Mark it executable with `chmod +x test.desktop`
5. Double-click it in Thunar and see that it executes now with no prompt.

Actual results:

xdg-open will run the application launcher even though it is not marked executable and is not "trusted" by a graphical desktop environment.


Expected results:

xdg-open should refuse to launch a non-executable application launcher and give an error message indicating that the launcher must be made executable.


Additional info:

Demonstration video of a proof of concept exploit that has this as the root cause: https://www.youtube.com/watch?v=gjyJj1RJAYY

Example application launcher (will launch gedit):

[Desktop Entry]
Type=Application
Name=Test App
Exec=/usr/bin/gedit

Comment 1 Rex Dieter 2015-03-28 05:34:19 UTC
Under what circumstances will xdg-open execute such an (untrusted) application launcher?  (other than explicitly and manually doing it?)

Comment 2 Noah Petherbridge 2015-03-28 05:38:10 UTC
As in the linked YouTube video, you can send somebody a file:// URL in Pidgin which becomes a clickable link, and it could point to an untrusted .desktop file that then gets launched when clicked.

https://www.youtube.com/watch?v=gjyJj1RJAYY

1. Send a user a link that downloads a .desktop file (Chrome/Chromium will automatically download it without prompting)
2. Send the user a file:// link to the downloaded .desktop file, which has a predictable file path on disk.

If instead the user attempted to navigate to and double-click the .desktop file, they would be warned about it being untrusted and they need to confirm if they really want to execute it. When clicking a file:// link, they don't get any such warning.

Comment 3 Rex Dieter 2015-03-28 18:04:49 UTC
This may be DE-specific.

For example, if I do:

xdg-open /usr/share/applications/kde4/kfmclient_html.desktop

on kde/plasma, it opens an editor for the .desktop file (and does not execute it).

on kde, xdg-open uses 'kde-open'

On XFCE, xdg-open uses exo-open, and indeed, 

exo-open /usr/share/applications/kde4/kfmclient_html.desktop

launches the app, and sure enough, if I copy that .desktop file locally (without execuate bit), exo-open still opens it without fuss.

Reassigning -> exo-open

Comment 4 Kevin Fenzi 2015-03-29 13:05:15 UTC
Sadly it seems there was no changes made to the actual spec around calling non executable desktop files 'untrusted', it's just something some groups choose to do. ;( 

I can file a bug upstream asking for that... or would you prefer to do so?

Comment 5 Fedora End Of Life 2015-11-04 15:38:12 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2015-12-02 10:36:56 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.