~ubuntu-branches/ubuntu/trusty/abs-guide/trusty-proposed

« back to all changes in this revision

Viewing changes to HTML/securityissues.html

  • Committer: Package Import Robot
  • Author(s): Sandro Tosi
  • Date: 2012-06-03 10:57:27 UTC
  • mfrom: (1.2.6)
  • Revision ID: package-import@ubuntu.com-20120603105727-rm7frl4feikr2swm
Tags: 6.5-1
* New upstream release
* debian/watch
  - updated
* debian/abs-guide.lintian-overrides
  - updated for new upstream code
* debian/control
  - bump Standards-Version to 3.9.3 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>Security Issues</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
 
9
"><LINK
 
10
REL="HOME"
 
11
TITLE="Advanced Bash-Scripting Guide"
 
12
HREF="index.html"><LINK
 
13
REL="UP"
 
14
TITLE="Miscellany"
 
15
HREF="miscellany.html"><LINK
 
16
REL="PREVIOUS"
 
17
TITLE="Assorted Tips"
 
18
HREF="assortedtips.html"><LINK
 
19
REL="NEXT"
 
20
TITLE="Portability Issues"
 
21
HREF="portabilityissues.html"><META
 
22
HTTP-EQUIV="Content-Style-Type"
 
23
CONTENT="text/css"><LINK
 
24
REL="stylesheet"
 
25
HREF="common/kde-common.css"
 
26
TYPE="text/css"><META
 
27
HTTP-EQUIV="Content-Type"
 
28
CONTENT="text/html; charset=iso-8859-1"><META
 
29
HTTP-EQUIV="Content-Language"
 
30
CONTENT="en"><LINK
 
31
REL="stylesheet"
 
32
HREF="common/kde-localised.css"
 
33
TYPE="text/css"
 
34
TITLE="KDE-English"><LINK
 
35
REL="stylesheet"
 
36
HREF="common/kde-default.css"
 
37
TYPE="text/css"
 
38
TITLE="KDE-Default"></HEAD
 
39
><BODY
 
40
CLASS="SECT1"
 
41
BGCOLOR="#FFFFFF"
 
42
TEXT="#000000"
 
43
LINK="#AA0000"
 
44
VLINK="#AA0055"
 
45
ALINK="#AA0000"
 
46
STYLE="font-family: sans-serif;"
 
47
><DIV
 
48
CLASS="NAVHEADER"
 
49
><TABLE
 
50
SUMMARY="Header navigation table"
 
51
WIDTH="100%"
 
52
BORDER="0"
 
53
CELLPADDING="0"
 
54
CELLSPACING="0"
 
55
><TR
 
56
><TH
 
57
COLSPAN="3"
 
58
ALIGN="center"
 
59
>Advanced Bash-Scripting Guide: An in-depth exploration of the art of shell scripting</TH
 
60
></TR
 
61
><TR
 
62
><TD
 
63
WIDTH="10%"
 
64
ALIGN="left"
 
65
VALIGN="bottom"
 
66
><A
 
67
HREF="assortedtips.html"
 
68
ACCESSKEY="P"
 
69
>Prev</A
 
70
></TD
 
71
><TD
 
72
WIDTH="80%"
 
73
ALIGN="center"
 
74
VALIGN="bottom"
 
75
>Chapter 36. Miscellany</TD
 
76
><TD
 
77
WIDTH="10%"
 
78
ALIGN="right"
 
79
VALIGN="bottom"
 
80
><A
 
81
HREF="portabilityissues.html"
 
82
ACCESSKEY="N"
 
83
>Next</A
 
84
></TD
 
85
></TR
 
86
></TABLE
 
87
><HR
 
88
ALIGN="LEFT"
 
89
WIDTH="100%"></DIV
 
90
><DIV
 
91
CLASS="SECT1"
 
92
><H1
 
93
CLASS="SECT1"
 
94
><A
 
95
NAME="SECURITYISSUES"
 
96
></A
 
97
>36.8. Security Issues</H1
 
98
><DIV
 
99
CLASS="SECT2"
 
100
><H2
 
101
CLASS="SECT2"
 
102
><A
 
103
NAME="INFECTEDSCRIPTS"
 
104
></A
 
105
>36.8.1. Infected Shell Scripts</H2
 
106
><P
 
107
><A
 
108
NAME="INFECTEDSCRIPTS1"
 
109
></A
 
110
></P
 
111
><P
 
112
>A brief warning about script security is indicated.
 
113
          A shell script may contain a <I
 
114
CLASS="FIRSTTERM"
 
115
>worm</I
 
116
>,
 
117
          <I
 
118
CLASS="FIRSTTERM"
 
119
>trojan</I
 
120
>, or even a
 
121
          <I
 
122
CLASS="FIRSTTERM"
 
123
>virus</I
 
124
>. For that reason, never run
 
125
          as <I
 
126
CLASS="FIRSTTERM"
 
127
>root</I
 
128
> a script (or permit it to
 
129
          be inserted into the system startup scripts in <TT
 
130
CLASS="FILENAME"
 
131
>/etc/rc.d</TT
 
132
>) unless you have obtained
 
133
          said script from a trusted source or you have carefully analyzed
 
134
          it to make certain it does nothing harmful.</P
 
135
><P
 
136
>Various researchers at Bell Labs and other sites, including M.
 
137
          Douglas McIlroy, Tom Duff, and Fred Cohen have investigated the
 
138
          implications of shell script viruses. They conclude that it is
 
139
          all too easy for even a novice, a <SPAN
 
140
CLASS="QUOTE"
 
141
>"script kiddie,"</SPAN
 
142
>
 
143
          to write one.
 
144
            <A
 
145
NAME="AEN20573"
 
146
HREF="#FTN.AEN20573"
 
147
>[1]</A
 
148
>
 
149
          </P
 
150
><P
 
151
>Here is yet another reason to learn scripting. Being able to
 
152
          look at and understand scripts may protect your system from
 
153
          being compromised by a rogue script.</P
 
154
></DIV
 
155
><DIV
 
156
CLASS="SECT2"
 
157
><H2
 
158
CLASS="SECT2"
 
159
><A
 
160
NAME="HIDINGSOURCE"
 
161
></A
 
162
>36.8.2. Hiding Shell Script Source</H2
 
163
><P
 
164
>For security purposes, it may be necessary to render a script
 
165
          unreadable. If only there were a utility to create a stripped
 
166
          binary executable from a script. Francisco Rosales' <A
 
167
HREF="http://www.datsi.fi.upm.es/~frosal/sources/"
 
168
TARGET="_top"
 
169
>shc --
 
170
          generic shell script compiler</A
 
171
> does exactly that.</P
 
172
><P
 
173
>Unfortunately, according to <A
 
174
HREF="http://www.linuxjournal.com/article/8256"
 
175
TARGET="_top"
 
176
>an article</A
 
177
> in
 
178
         the October, 2005 <SPAN
 
179
CLASS="emphasis"
 
180
><I
 
181
CLASS="EMPHASIS"
 
182
>Linux Journal</I
 
183
></SPAN
 
184
>,
 
185
         the binary can, in at least some cases, be decrypted to recover
 
186
         the original script source. Still, this could be a useful
 
187
         method of keeping scripts secure from all but the most skilled
 
188
         hackers.</P
 
189
></DIV
 
190
><DIV
 
191
CLASS="SECT2"
 
192
><H2
 
193
CLASS="SECT2"
 
194
><A
 
195
NAME="SECURITYTIPS"
 
196
></A
 
197
>36.8.3. Writing Secure Shell Scripts</H2
 
198
><P
 
199
><A
 
200
NAME="SECURITYTIPS1"
 
201
></A
 
202
></P
 
203
><P
 
204
><SPAN
 
205
CLASS="emphasis"
 
206
><I
 
207
CLASS="EMPHASIS"
 
208
>Dan Stromberg</I
 
209
></SPAN
 
210
> suggests the following
 
211
          guidelines for writing (relatively) secure shell scripts.</P
 
212
><P
 
213
>         <UL
 
214
><LI
 
215
><P
 
216
>Don't put secret data in <A
 
217
HREF="othertypesv.html#ENVREF"
 
218
>environment variables</A
 
219
>.</P
 
220
></LI
 
221
><LI
 
222
><P
 
223
>Don't pass secret data in an external
 
224
              command's arguments (pass them in via a <A
 
225
HREF="special-chars.html#PIPEREF"
 
226
>pipe</A
 
227
> or <A
 
228
HREF="io-redirection.html#IOREDIRREF"
 
229
>redirection</A
 
230
> instead).</P
 
231
></LI
 
232
><LI
 
233
><P
 
234
>Set your <A
 
235
HREF="variables2.html#PATHREF"
 
236
>$PATH</A
 
237
>
 
238
              carefully. Don't just trust whatever path you
 
239
              inherit from the caller if your script is running as
 
240
              <I
 
241
CLASS="FIRSTTERM"
 
242
>root</I
 
243
>. In fact, whenever you use
 
244
              an environment variable inherited from the caller, think
 
245
              about what could happen if the caller put something
 
246
              misleading in the variable, e.g., if the caller set
 
247
              <A
 
248
HREF="variables2.html#HOMEDIRREF"
 
249
>$HOME</A
 
250
> to <TT
 
251
CLASS="FILENAME"
 
252
>/etc</TT
 
253
>.</P
 
254
></LI
 
255
></UL
 
256
>
 
257
        </P
 
258
></DIV
 
259
></DIV
 
260
><H3
 
261
CLASS="FOOTNOTES"
 
262
>Notes</H3
 
263
><TABLE
 
264
BORDER="0"
 
265
CLASS="FOOTNOTES"
 
266
WIDTH="100%"
 
267
><TR
 
268
><TD
 
269
ALIGN="LEFT"
 
270
VALIGN="TOP"
 
271
WIDTH="5%"
 
272
><A
 
273
NAME="FTN.AEN20573"
 
274
HREF="securityissues.html#AEN20573"
 
275
>[1]</A
 
276
></TD
 
277
><TD
 
278
ALIGN="LEFT"
 
279
VALIGN="TOP"
 
280
WIDTH="95%"
 
281
><P
 
282
>See Marius van Oers' article, <A
 
283
HREF="http://www.virusbtn.com/magazine/archives/200204/malshell.xml"
 
284
TARGET="_top"
 
285
>Unix
 
286
              Shell Scripting Malware</A
 
287
>, and also the
 
288
              <A
 
289
HREF="biblio.html#DENNINGREF"
 
290
><SPAN
 
291
CLASS="emphasis"
 
292
><I
 
293
CLASS="EMPHASIS"
 
294
>Denning</I
 
295
></SPAN
 
296
>
 
297
              reference</A
 
298
> in the
 
299
              <I
 
300
CLASS="FIRSTTERM"
 
301
>bibliography</I
 
302
>.</P
 
303
></TD
 
304
></TR
 
305
></TABLE
 
306
><DIV
 
307
CLASS="NAVFOOTER"
 
308
><HR
 
309
ALIGN="LEFT"
 
310
WIDTH="100%"><TABLE
 
311
SUMMARY="Footer navigation table"
 
312
WIDTH="100%"
 
313
BORDER="0"
 
314
CELLPADDING="0"
 
315
CELLSPACING="0"
 
316
><TR
 
317
><TD
 
318
WIDTH="33%"
 
319
ALIGN="left"
 
320
VALIGN="top"
 
321
><A
 
322
HREF="assortedtips.html"
 
323
ACCESSKEY="P"
 
324
>Prev</A
 
325
></TD
 
326
><TD
 
327
WIDTH="34%"
 
328
ALIGN="center"
 
329
VALIGN="top"
 
330
><A
 
331
HREF="index.html"
 
332
ACCESSKEY="H"
 
333
>Home</A
 
334
></TD
 
335
><TD
 
336
WIDTH="33%"
 
337
ALIGN="right"
 
338
VALIGN="top"
 
339
><A
 
340
HREF="portabilityissues.html"
 
341
ACCESSKEY="N"
 
342
>Next</A
 
343
></TD
 
344
></TR
 
345
><TR
 
346
><TD
 
347
WIDTH="33%"
 
348
ALIGN="left"
 
349
VALIGN="top"
 
350
>Assorted Tips</TD
 
351
><TD
 
352
WIDTH="34%"
 
353
ALIGN="center"
 
354
VALIGN="top"
 
355
><A
 
356
HREF="miscellany.html"
 
357
ACCESSKEY="U"
 
358
>Up</A
 
359
></TD
 
360
><TD
 
361
WIDTH="33%"
 
362
ALIGN="right"
 
363
VALIGN="top"
 
364
>Portability Issues</TD
 
365
></TR
 
366
></TABLE
 
367
></DIV
 
368
></BODY
 
369
></HTML
 
370
>
 
 
b'\\ No newline at end of file'