Security Issues

33.9. Security Issues

33.9.1. Infected Shell Scripts

A brief warning about script security is indicated. A shell script may contain a worm, trojan, or even a virus. For that reason, never run as root a script (or permit it to be inserted into the system startup scripts in /etc/rc.d) unless you have obtained said script from a trusted source or you have carefully analyzed it to make certain it does nothing harmful.

Various researchers at Bell Labs and other sites, including M. Douglas McIlroy, Tom Duff, and Fred Cohen have investigated the implications of shell script viruses. They conclude that it is all too easy for even a novice, a "script kiddie," to write one. [1]

Here is yet another reason to learn scripting. Being able to look at and understand scripts may protect your system from being compromised by a rogue script.

33.9.2. Hiding Shell Script Source

For security purposes, it may be necessary to render a script unreadable. If only there were a utility to create a stripped binary executable from a script. Francisco Rosales' shc -- generic shell script compiler does exactly that.

Unfortunately, according to an article in the October, 2005 Linux Journal, the binary can, in at least some cases, be decrypted to recover the original script source. Still, this could be a useful method of keeping scripts secure from all but the most skilled hackers.

33.9.3. Writing Secure Shell Scripts

Dan Stromberg suggests the following guidelines for writing (relatively) secure shell scripts.

Notes

[1]

See Marius van Oers' article, Unix Shell Scripting Malware, and also the Denning reference in the bibliography.


192 visits (2 today, 9 this week, 32 this month, 192 this year)
Uptime: 12:07:06 up 10 days, 17:50, 5 users, load average: 0.03, 0.02, 0.00
18.119.123.10 GET from server z.larryforalaska.com

Saturday, December 28, 2024 @ 12:07:06 PM
z.ServerAdmin@lam1.us