Overview
To simulate keyboard and pointer input through /dev/uinput, Pardus eta-remote spawns /usr/share/eta/eta-remote/client/actions.py with root privileges via pkexec. An overly permissive Polkit configuration (CWE-276) allowed unprivileged, non-active local users to run actions.py as uid=0 without authentication and inject keystrokes into the active desktop session. Furthermore, the initial mitigation—embedding the launcher in a compiled C binary and verifying /proc/<ppid>/exe—remained vulnerable to Python environment injection.
Affected Components
data/org.pardus.eta-remote.uinput.policysrc/client/actions.pyeta-remote.c.in
Root Cause & Initial Patch Bypass
1. Permissive Polkit Policy & Cross-Session uinput Injection
The original Polkit policy granted passwordless pkexec execution across all sessions:
<!-- data/org.pardus.eta-remote.uinput.policy (Vulnerable) -->
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/share/eta/eta-remote/client/actions.py</annotate>
Because <allow_any>yes</allow_any> and <allow_inactive>yes</allow_inactive> were enabled, any low-privileged or SSH user could run pkexec /usr/share/eta/eta-remote/client/actions.py as root and feed Base64-encoded JSON keyboard events over stdin. The kernel created a virtual eta-remote-virtual-input device whose keystrokes bypassed Wayland/X11 window isolation and landed directly in the active graphical user session.
2. Initial C Wrapper Patch Bypass (a6d02bb, 0946d7d, 8e8cdf5)
The initial patch replaced eta-remote.py.in with a compiled C launcher (eta-remote.c.in -> /usr/bin/eta-remote) and added an auth_process() check in actions.py validating the parent /proc/<ppid>/exe inode (st_ino / st_dev) against /usr/bin/eta-remote.
However, eta-remote.c.in initialized Python using Py_Initialize() while <allow_any>yes</allow_any> remained active:
// Initial Patch: eta-remote.c.in (Bypassable)
#include <Python.h>
int main(int argc, char *argv[]) {
Py_Initialize();
PyRun_SimpleString(
"import sys\n"
"sys.path.insert(0, '/usr/share/eta/eta-remote')\n"
"import Main\n"
);
Py_Finalize();
return 0;
}
Because Py_Initialize() honors PYTHONPATH, PYTHONHOME, and user site hooks (sitecustomize.py / ~/.local/lib/python3.x/site-packages/usercustomize.py) before executing PyRun_SimpleString, an attacker could execute arbitrary Python code inside the legitimate /usr/bin/eta-remote ELF process. At the OS level, /proc/<ppid>/exe still pointed to the genuine /usr/bin/eta-remote binary, completely bypassing auth_process().
Final Remediation (3b098ef & a590afd)
The complete fix submitted and merged upstream hardened all three layers:
- PEP 587
PyConfigInterpreter Isolation (eta-remote.c.in): ReplacedPy_Initialize()withPyConfigdisabling environment variables, user site directories, andargvparsing, alongside a sanitizedsys.path:
// Hardened Final Code: eta-remote.c.in
PyStatus status;
PyConfig config;
PyConfig_InitPythonConfig(&config);
config.use_environment = 0; // Disable PYTHONPATH, PYTHONHOME, etc.
config.user_site_directory = 0; // Disable ~/.local/.../usercustomize.py
config.parse_argv = 0;
status = Py_InitializeFromConfig(&config);
if (PyStatus_Exception(status)) {
PyConfig_Clear(&config);
Py_ExitStatusException(status);
}
PyConfig_Clear(&config);
PyRun_SimpleString(
"import sys\n"
"sys.path = ['@pkgdatadir@'] + [p for p in sys.path if p != '' and not p.startswith('/home') and not p.startswith('/tmp')]\n"
"import Main\n"
);
- Strict Polkit Seat Enforcement (
data/org.pardus.eta-remote.uinput.policy): Locked<allow_any>no</allow_any>and<allow_inactive>no</allow_inactive>so non-active/SSH sessions cannot invokepkexecwithout authentication. - Process Tree Verification (
src/client/actions.py): Targeted/usr/bin/python3instead ofsys.executableinsidePipeUInputHandlerand updatedauth_process()to verify the caller process chain safely.