It should be possible to detect if the root user already has a password set using relevance, but I havenāt actually figured that part out completely:
arrays "passwd" of dictionaries of files "/var/db/dslocal/nodes/Default/users/root.plist"
Wow, @jgstew ā¦ trying to make sense of plists on macOS and getting nowhere. Stuff like this works: (keys of it, sizes of arrays of values of it) of entries of dictionaries of files "/var/db/dslocal/nodes/Default/users/root.plist"
but actually getting the data in that array is eluding me. Any pointers?
length of string 0 of array "passwd" of dictionaries of files "/var/db/dslocal/nodes/Default/users/root.plist"
This yields results of either 1 or 8 based on my few tests. According to the stackexchange post, 1 = disabled root, 8 = enabled root. Right? So then, the relevance to detect a disabled root account would be: length of string 0 of array "passwd" of dictionaries of files "/var/db/dslocal/nodes/Default/users/root.plist" = 1
It is not hard to make it a specific password. I am intentionally making it a very random password and not storing it in any way so that it is NOT known on purpose.
Setting it to something that is known and the same on all of your computers is a potential security issue, but if that is what you want, just do the following:
wait sh -c "dscl . -passwd '/Users/root' MyP@ssw0rd!"
Iād prefer to just set the root user shell to false like you mentioned above. Doing that seems to have resolved the issue without making any password change to the root account.
I do have a question regarding changing the root user shell to false. Would this affect bigfix script usage on that machine in any way or does it just not allow a user to log in as root?
I was under the impression that bigfix ran all scripts as though it were root. Or does it just have root level access?
I donāt know for certain, but it should just prevent login as root, it should not prevent BigFix from running actions as root.
This will prevent interactive logins as root, but it will not prevent all possible uses of the root account. If you donāt set the password and activate the root account, then there will still be possible exploits. Setting the root shell to false is a more conservative approach, but not perfect.
The fix from apple changes the broken validation that caused the issue in the first place. It probably also disables the root user in case it was turned on due to this issue.
So how would we change the root user shell back to true manually?
I assume we could just change ā/usr/bin/falseā to ā/usr/bin/trueā and run that, but if we wanted to make this change on a single machine without running a fixlet how would we go about it?
You donāt need to change it back unless you have people logging into a mac as root, which you should not have that generally, so this might be a good thing to leave in place as an extra protection.
@jgstew - Not that it likely matters anymore now that Appleās released a patch, but it turns out that a computer that has had the flaw exploited also has a passwd of length 8, so the relevance is overly exclusive. Iām looking into what would identify an exploited root.
Sigh ā¦ looks like thereās no difference (that I can find anyway) between root user on a macOS 10.13 computer that has had the password explicitly set and that has had the vulnerability exploited. Guess we just have to deploy the patch.