diff options
author | Jerzi Kaminsky <JerziKaminsky@users.noreply.github.com> | 2017-04-16 09:30:14 +0300 |
---|---|---|
committer | Jerzi Kaminsky <JerziKaminsky@users.noreply.github.com> | 2017-04-16 17:09:53 +0300 |
commit | 2ad8850398693cb572152e6d97c59de371996273 (patch) | |
tree | 21abe14fe200099fffe5de9b7770cf2ca921e371 /sway/commands/input | |
parent | c9694ee63d451da62dc50b234b3080a35a40e844 (diff) |
Handle symlinks as IPC security targets
- When policies are allocated, the ipc target path goes
through symlink resolution. The result is used as
the canonical for matching pids to policies at runtime.
In particular, this matches up with the target of
the `/proc/<pid>/exe`.
- There's a possible race condition if this isn't done
correctly, read below.
Originally, validate_ipc_target() always tried to resolve
its argument for symlinks, and returned a parogram target string
if it validates. This created a possible race condition with
security implications. The problem is that get_feature_policy()
first independently resolved the policy target in order to check
whether a policy already exists. If it didn't find any, it called
alloc_feature_policy() which called validate_ipc_target() which
resolved the policy target again. In the time between the two
checks, the symlink could be altered, and a lucky attacker could
fool the program into thinking that a policy doesn't exist
for a target, and then switch the symlink to point at another file.
At the very least this could allow him to create two policies
for the same program target, and possibly to bypass security
by associating the permissions for one target with another,
or force default permissions to apply to a target for which
a more specific rule has been configured. So we don't that.
Instead, the policy target is resolved once and that result is
used for the rest of the lookup/creation process.
Diffstat (limited to 'sway/commands/input')
0 files changed, 0 insertions, 0 deletions