Skip to content

Commit b64ae67

Browse files
committed
added a comment under Miscellaneous about the crazy macOS default sudo
behaviour of not changing the HOME environment variable when you escalate.
1 parent 551231b commit b64ae67

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,6 +1994,15 @@ Consider [sandboxing](https://developer.apple.com/library/mac/documentation/Darw
19941994

19951995
Did you know Apple has not shipped a computer with TPM since [2006](http://osxbook.com/book/bonus/chapter10/tpm/)?
19961996

1997+
MacOS comes with this line in /etc/sudoers:
1998+
1999+
````
2000+
Defaults env_keep += "HOME MAIL"
2001+
````
2002+
2003+
Which stops sudo from changing the HOME variable when you elevate privileges. This means it will execute as root the bash dotfiles in the non-root user's home directory when you run "sudo bash". It is adviseable to comment this line out to avoid a potentially easy way for malware or a local attacker to escalate privileges to root.
2004+
2005+
19972006
## Related software
19982007

19992008
[Santa](https://github.com/google/santa/) - A binary whitelisting/blacklisting system for macOS.

0 commit comments

Comments
 (0)