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

system-config-selinux allows shell code injection #458

Open
mgerstner opened this issue Dec 30, 2024 · 0 comments
Open

system-config-selinux allows shell code injection #458

mgerstner opened this issue Dec 30, 2024 · 0 comments

Comments

@mgerstner
Copy link

The GUI code for system-config-selinux uses Python's subprocess.getstatusoutput() a lot to call utilities like semanage or semodule. getstatusoutput() passes the command line to the shell and is thus susceptible to injection of shell code. In various spots the GUI utility passes on strings unfiltered from text input fields to getstatusoutput(), which can result in unexpected errors or even damage to the system.

For a simple reproducer follow these steps:

  • run system-config-selinux on an SELinux enabled sytem.
  • In "File Labeling" click "+" for adding an entry.
  • put something like '; touch /tmp/evil_file; ls ' into the "File Specification" field.
  • /tmp/evil_file will be created by root when adding the entry.

system-config-selinux is typically run as root via Polkit (pkexec) and requires entering the administrator password. Thus I don't consider this a security issue. The code is still unclean in this area and I believe it should be fixed.

From a quick grep I see potentially problematic uses of getstatusoutput() with format specifiers in gui/loginsPage.py, gui/usersPage.py, gui/modulesPage.py, gui/booleansPage.py, gui/fcontextPage.py, gui/portsPage.py, gui/domainsPage.py and also in python/sepolicy/sepolicy/manpage.py and python/sepolicy/sepolicy/interface.py.

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

1 participant