Description of problem: Description of problem: /etc/rc.sysinit makes | find -L /var/lock /var/run ! -type d -exec rm -f {} \; at every start. It is common practice to have daemon-writable subdirs below /var/run or /var/lock (e.g. /var/run/openldap). When such a daemon is compromised, an attack could create a | /var/run/openldap/foo -> / symlink which wipes whole system at next startup. Version-Release number of selected component (if applicable): initscripts-8.76.2-1.x86_64 How reproducible: 100% Steps to Reproduce: 1. mkdir /var/run/foo 2. chown nobody:nobody /var/run/foo 3. runuser nobody -s /bin/sh 'ln -s / /var/run/foo/bar' 4. reboot Actual results: a lot of 'command not found' errors on startup Additional info: Kudos to Herbert Poetzl about discovering this vulnerability.
Low security issue (requires malicious daemon with privileges to write into /var/run directory), affecting all versions of the initscripts package as shipped with Red Hat Enterprise Linux 2.1, 3, 4 and 5.
Bill could you provide your opinion to this issue and if it is worthy to fix (to include the fix into the initscripts packages as shipped with RHEL*).
afais, RHEL is *not* affected. This bug was introduced in F9 first by http://git.fedorahosted.org/git/?p=initscripts.git;a=commitdiff;h=b8fbfde343e39337bcbddc33cab0bc30ee4fb0e3
Sadly enough, some Fedora packages create world-writable subdirectories in /var/run, so they allow any local unprivileged user to take advantage of this flaw without having to exploit a flaw in any daemon service. Bill, may I ask what was the motivation behind using -L? Not using it should solve the issue and yet do the cleanup properly. Or is anything missed if -L is omitted what should be deleted?
There was a reason, as it was even added in a separate commit after the first one. But I'm not recalling what it was. I can always just remove it, push a test update, and see what breaks. It certainly works in smoke testing.
It looks like the change referenced by Enrico was done to make sure socket and symlink files in /var/{lib,run} are removed, which was not done with -type f. Along with '-type f' -> '! -type d' change, -L was added. Any file that exists in /var/{lib,run} should have a non-symlink path to it, so we do not seem to need to follow symlinks.
initscripts-8.76.3-1 has been submitted as an update for Fedora 9. http://admin.fedoraproject.org/updates/initscripts-8.76.3-1
initscripts-8.76.3-1 has been pushed to the Fedora 9 stable repository. If problems still persist, please make note of it in this bug report.
This issue was addressed in: Fedora: https://admin.fedoraproject.org/updates/F9/FEDORA-2008-7667