The Principle of Least Privilege suggests that software should be executed with no more authority than it requires to accomplish its task. Current security tools make it difficult to apply this principle: they either require significant modifications to applications or do not facilitate reasoning about combining untrustworthy components.

We propose Shill, a secure shell scripting language. Shill scripts enable compositional reasoning about security through contracts that limit the effects of script execution, including the effects of programs invoked by the script. Shill contracts are declarative security policies that act as documentation for consumers of Shill scripts, and are enforced through a combination of language design and sandboxing.

We have implemented a prototype of Shill for FreeBSD and used it for several case studies including a grading script and a script to download, compile, and install software. Our experience indicates that Shill is a practical and useful system security tool, and can provide fine-grained security guarantees.