Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The provided way to identify applications is unreliable #15

Open
Ongy opened this issue Mar 20, 2018 · 2 comments
Open

The provided way to identify applications is unreliable #15

Ongy opened this issue Mar 20, 2018 · 2 comments

Comments

@Ongy
Copy link

Ongy commented Mar 20, 2018

Unless I am worse at C than I thought, the implemented way to determine the application binary path is to read the /proc/[pid]/exe symlink.

This is sadly not a reliable way. The symlink is always given in the applications mount namespace, not the compositors mount namespace.
With unprivileged user namespaces (which afaik most distributions have available for lxc/docker/etc.) any user application can abuse this to gain any path.

I think this can be (paritally) mitigated by checking /proc/[pid]/ns/nmt and compare it with /proc/self/ns/mnt.

As secondary problem, applications that use interpreters (such as python) will show up as the interpreter. And sadly /proc/[pid]/cmdline is not reliable either to determine which file is interpreted.

@Sidnioulz
Copy link
Collaborator

HI,

This was written before user namespaces were "stable", so you're right to point out a now valid limitation. Your approach is similar to what I've done in a similar project and I believe you're right.

You're totally right about interpreted apps showing up as the interpreter. This is partly mitigable, but not always. However, the issue can be eliminated for DE-launched apps if the DE provides a method for libwsm to identify running applications, with a "Desktop" concept of running application that currently lacks standardisation on Linux.

@emersion
Copy link

emersion commented Apr 7, 2019

Actually, there is one more potential attack scenario. It exploits the fact that PIDs can be re-used. More details here: swaywm/sway#3088 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants