| 1 |
<HTML> |
| 2 |
<HEAD> |
| 3 |
<TITLE>MHonArc FAQ: Security</TITLE></HEAD> |
| 4 |
<link rel="stylesheet" type="text/css" href="../docstyles.css"> |
| 5 |
<BODY> |
| 6 |
|
| 7 |
|
| 8 |
<table width="100%"><tr><td align="left"><nobr>[<a href="mime.html">Prev</a>]</nobr></td><td align="center" width="100%">[<a href="faq.html">TOC</a>][<a href="../mhonarc.html">Manual</a>][<a href="http://www.mhonarc.org/">Home</a>]</td><td align="right"><nobr>[Next]</nobr></td></tr></table> |
| 9 |
</p> |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
<HR> |
| 14 |
<H2><a name="security">Security</a></H2> |
| 15 |
|
| 16 |
|
| 17 |
<ul> |
| 18 |
<li><a href="#contact">Who do I contact if I find a vulnerability with MHonArc?</a></li> |
| 19 |
<li><a href="#spam">Can I obscure email addresses?</a></li> |
| 20 |
<li><a href="#mhonarc_db">How can I prevent web access to <tt>.mhonarc.db</tt> files?</a></li> |
| 21 |
<li><a href="#htmldata">Why are HTML messages a security risk?</a></li> |
| 22 |
<li><a href="#htmlexchow">So how can I exclude HTML mail?</a></li> |
| 23 |
<li><a href="#attachments">Why doesn't MHonArc, by default, use the specified filename when saving attachments?</a></li> |
| 24 |
<li><a href="#suid">Is it okay to run <tt>mhonarc</tt> setuid?</a></li> |
| 25 |
</ul> |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
<hr noshade size=1> |
| 30 |
<table border=0> |
| 31 |
<tr valign=baseline><td><img src="monicon.png" align="bottom" alt=""></td><td> |
| 32 |
<h3><b><a name="contact">Who do I contact if I find a vulnerability with MHonArc?</a></b></h3> |
| 33 |
</td></tr></table> |
| 34 |
|
| 35 |
<p>You can do one of the following: |
| 36 |
</p> |
| 37 |
<ul> |
| 38 |
<li><p>You can submit a report at |
| 39 |
<a href="http://savannah.nongnu.org/bugs/?func=addbug&group=mhonarc" |
| 40 |
><https://savannah.nongnu.org/bugs/?func=addbug&group=mhonarc></a>. |
| 41 |
Make sure to fill out all required information, and for the |
| 42 |
<b>Bug Group</b> form item, select <em>Security</em>. |
| 43 |
</p> |
| 44 |
<p><strong>Note:</strong> All reports submitted for MHonArc via savannah |
| 45 |
are automatically mailed to the |
| 46 |
<a href="mailto:mhonarc-dev%40mhonarc.org">mhonarc-dev |
| 47 |
@ |
| 48 |
mhonarc.org</a> |
| 49 |
list, which is archived at |
| 50 |
<a href="http://www.mhonarc.org/archive/html/" |
| 51 |
><http://www.mhonarc.org/archive/html/></a>. |
| 52 |
</p> |
| 53 |
</li> |
| 54 |
<li><p>Or, you can send a mail message to |
| 55 |
<a href="mailto:mhonarc%40mhonarc.org?subject=Security%20Vulnerability" |
| 56 |
>mhonarc |
| 57 |
@ |
| 58 |
mhonarc.org</a>. This address goes directly to the author(s) of |
| 59 |
MHonArc, and is <strong>not</strong> archived on any public site. |
| 60 |
</p></li> |
| 61 |
</ul> |
| 62 |
|
| 63 |
<p>Please indicate if it is okay to mention your name in any resulting |
| 64 |
advisories or patches that may result from your report. If you do |
| 65 |
not make any indications, all attempts will be made to keep your identity |
| 66 |
confidential. |
| 67 |
</p> |
| 68 |
|
| 69 |
|
| 70 |
<hr noshade size=1> |
| 71 |
<table border=0> |
| 72 |
<tr valign=baseline><td><img src="monicon.png" align="bottom" alt=""></td><td> |
| 73 |
<h3><b><a name="spam">Can I obscure email addresses?</a></b></h3> |
| 74 |
</td></tr></table> |
| 75 |
|
| 76 |
<p>See the <a href="../resources/spammode.html">SPAMMODE</a> resource. |
| 77 |
</p> |
| 78 |
|
| 79 |
|
| 80 |
<hr noshade size=1> |
| 81 |
<table border=0> |
| 82 |
<tr valign=baseline><td><img src="monicon.png" align="bottom" alt=""></td><td> |
| 83 |
<h3><b><a name="mhonarc_db">How can I prevent web access to <tt>.mhonarc.db</tt> files?</a></b></h3> |
| 84 |
</td></tr></table> |
| 85 |
|
| 86 |
<p>MHonArc database files may contain information that you do |
| 87 |
not want web users to directly access. The best example is when |
| 88 |
your archive is customized to obscure email addresses. However, |
| 89 |
in the MHonArc database file, the original, unobscured, addresses |
| 90 |
exist. |
| 91 |
</p> |
| 92 |
|
| 93 |
<p>There are multiple solutions to preventing access to database |
| 94 |
files: |
| 95 |
</p> |
| 96 |
|
| 97 |
<ul> |
| 98 |
<li><p>In v2.6, and later, the |
| 99 |
<a href="../resources/dbfileperms.html">DBFILEPERMS</a> resource |
| 100 |
exists to control the file permissions of the database file. By default, |
| 101 |
the resource is set to a value that denies world read access. If the |
| 102 |
archive files are owned by a different user ID than the web server |
| 103 |
process (which is normally the case), then access to database files |
| 104 |
will be denied. |
| 105 |
</p> |
| 106 |
<table class="note" width="100%"> |
| 107 |
<tr valign="baseline"> |
| 108 |
<td><strong>NOTE:</strong></td> |
| 109 |
<td width="100%"><p>DBFILEPERMS is applicable to Unix-based systems. |
| 110 |
Therefore, if using a different operating system, you may have to |
| 111 |
use one of the other solutions to deny access. |
| 112 |
</p> |
| 113 |
</td> |
| 114 |
</tr> |
| 115 |
</table> |
| 116 |
</li> |
| 117 |
|
| 118 |
<li><p>Generate the archive in a non-web accessible location, and |
| 119 |
then mirror files into a web-accesible locations, excluding the |
| 120 |
database file. The drawback to this approach is it adds extra |
| 121 |
administrative and processing overhead. |
| 122 |
</p> |
| 123 |
|
| 124 |
<li><p>Generally, web servers provide the ability deny access |
| 125 |
to files. Refer to your web server's documentation for the specifies. |
| 126 |
If you are using the <a href="http://httpd.apache.org/">Apache HTTP server</a>, |
| 127 |
the following configuration directive can be used: |
| 128 |
</p> |
| 129 |
<pre class="code"> |
| 130 |
<Files .mhonarc.db> |
| 131 |
Order allow,deny |
| 132 |
Deny from all |
| 133 |
</Files> |
| 134 |
</pre> |
| 135 |
<p>If you have <tt>mod_rewrite</tt> enabled, you could use the following |
| 136 |
instead: |
| 137 |
</p> |
| 138 |
<pre class="code"> |
| 139 |
RewriteRule ^(.*)/.mhonarc.db $1 [R=permanent] |
| 140 |
</pre> |
| 141 |
<p>This will redirect browsers to the parent directory, which is |
| 142 |
the actual archive associated with database file. |
| 143 |
</p> |
| 144 |
</li> |
| 145 |
|
| 146 |
<li><p>The <a href="../resources/dbfile.html">DBFILE</a> resource can |
| 147 |
be used to rename the database file to some arbitrary, not easily |
| 148 |
guessed, name of your choosing. However, this does not prevent brute |
| 149 |
force attempts to access the file. |
| 150 |
</p> |
| 151 |
</li> |
| 152 |
|
| 153 |
<li><p><a href="../resources/dbfile.html">DBFILE</a> resource can |
| 154 |
be set to a full pathname that is in a non-web server |
| 155 |
accessible location. |
| 156 |
</p> |
| 157 |
<table class="note" width="100%"> |
| 158 |
<tr valign="baseline"> |
| 159 |
<td><strong>NOTE:</strong></td> |
| 160 |
<td width="100%"><p> |
| 161 |
Using a full pathname for <a href="../resources/dbfile.html">DBFILE</a> is |
| 162 |
supported only in v2.5.13, or later. |
| 163 |
</p> |
| 164 |
</td> |
| 165 |
</tr> |
| 166 |
</table> |
| 167 |
</li> |
| 168 |
|
| 169 |
</ul> |
| 170 |
|
| 171 |
|
| 172 |
<hr noshade size=1> |
| 173 |
<table border=0> |
| 174 |
<tr valign=baseline><td><img src="monicon.png" align="bottom" alt=""></td><td> |
| 175 |
<h3><b><a name="htmldata">Why are HTML messages a security risk?</a></b></h3> |
| 176 |
</td></tr></table> |
| 177 |
|
| 178 |
<p>HTML can contain dynamic content, like JavaScript. If an |
| 179 |
HTML message is blindly archived, you are introducing foreign dynamic |
| 180 |
content to your web site that you have no control over. The best |
| 181 |
example of this danger is the problem web-based email sites (e.g. |
| 182 |
Hotmail) encountered when malicious people were sending HTML messages |
| 183 |
to web-based email users and the messages contained dynamic content |
| 184 |
that would popup windows (which had a similiar style of the web-based |
| 185 |
email hosting provider) requesting sensitive information from |
| 186 |
users (like passwords). |
| 187 |
</p> |
| 188 |
|
| 189 |
<p>These types of attacks are classified as <em>Cross-Site |
| 190 |
Scripting</em> (XSS) attacks by the security community. The common |
| 191 |
goal for XSS attacks is to obtain private information of a user, |
| 192 |
like browser cookies used for site authentication. </p> |
| 193 |
|
| 194 |
<p>The following is a brief list of some of the security issues |
| 195 |
related to HTML messages: |
| 196 |
</p> |
| 197 |
<ul> |
| 198 |
<li>Can contain foreign dynamic content. |
| 199 |
</li> |
| 200 |
<li>Can autoload URLs (via IMG, and similiar, elements) which |
| 201 |
can be used to collect statistics on unsuspected readers. |
| 202 |
</li> |
| 203 |
<li>Contain hidden contents (like server-side include comments) |
| 204 |
which may be processed by web servers to execute arbitrary |
| 205 |
programs or extract arbitrary system files. |
| 206 |
</li> |
| 207 |
</ul> |
| 208 |
|
| 209 |
<p>MHonArc's HTML filter (documented under the <a href="../resources/mimefilters.html">MIMEFILTERS</a>) |
| 210 |
resource provides functionality of stripping out HTML data to |
| 211 |
minimize security exploits. Check the document for full details. |
| 212 |
The general recommendation for the security conscience is to exclude |
| 213 |
any HTML message data (see <a href="#htmlexchow">next question</a>). |
| 214 |
|
| 215 |
|
| 216 |
<hr noshade size=1> |
| 217 |
<table border=0> |
| 218 |
<tr valign=baseline><td><img src="monicon.png" align="bottom" alt=""></td><td> |
| 219 |
<h3><b><a name="htmlexchow">So how can I exclude HTML mail?</a></b></h3> |
| 220 |
</td></tr></table> |
| 221 |
|
| 222 |
<p>The quickest method is |
| 223 |
via the <a href="../resources/mimeexcs.html">MIMEEXCS</a> resource: |
| 224 |
<p> |
| 225 |
<pre class="code"> |
| 226 |
<b><MIMEExcs></b> |
| 227 |
text/html |
| 228 |
text/x-html |
| 229 |
<b></MIMEExcs></b> |
| 230 |
</pre> |
| 231 |
|
| 232 |
<p>Unfortunately, for messages that contain only HTML data, the |
| 233 |
entire message body will be excluded. Therefore, you may still |
| 234 |
want to show the data, but have it so the HTML markup is completely |
| 235 |
neutralized. The following resource settings will neutralize the |
| 236 |
dangers of HTML messages without excluding message data: |
| 237 |
</p> |
| 238 |
|
| 239 |
<pre class="code"> |
| 240 |
<!-- It is common for popular MUA's to provide a text/plain version |
| 241 |
of the text/html version of a message body. Therefore, we |
| 242 |
use MIMEALTPREFS to choose the text/plain version if available. |
| 243 |
--> |
| 244 |
<b><a href="../resources/mimealtprefs.html"><MimeAltPrefs></a></b> |
| 245 |
text/plain |
| 246 |
text/html |
| 247 |
<b></MimeAltPrefs></b> |
| 248 |
|
| 249 |
<!-- For messages that do not have a text/plain alternative, we |
| 250 |
treat HTML data as text/plain so the content is not lost, but |
| 251 |
HTML markup is escaped and neutralized. |
| 252 |
--> |
| 253 |
<b><a href="../resources/mimefilters.html"><MIMEFilters></a></b> |
| 254 |
text/html; m2h_text_plain::filter; mhtxtplain.pl |
| 255 |
text/x-html; m2h_text_plain::filter; mhtxtplain.pl |
| 256 |
<b></MIMEFilters></b> |
| 257 |
</pre> |
| 258 |
|
| 259 |
|
| 260 |
<hr noshade size=1> |
| 261 |
<table border=0> |
| 262 |
<tr valign=baseline><td><img src="monicon.png" align="bottom" alt=""></td><td> |
| 263 |
<h3><b><a name="attachments">Why doesn't MHonArc, by default, use the specified filename when saving attachments?</a></b></h3> |
| 264 |
</td></tr></table> |
| 265 |
|
| 266 |
<p>A malicious person could send a message with an attachment filename |
| 267 |
that could overwrite existing content or be interpreted by the web |
| 268 |
server in some special manner to execute actions. Example: Apache |
| 269 |
allows for the support for creating <tt>.htaccess</tt> files to allow |
| 270 |
configuration settings within a directory. If you have this feature |
| 271 |
enabled and a message containes an attachment with the specified |
| 272 |
filename <tt>.htaccess</tt> and MHonArc blindly used the attachment |
| 273 |
filename, the attachment will override any existing <tt>.htaccess</tt> |
| 274 |
file you created with a version defined by the sender of the message. |
| 275 |
</p> |
| 276 |
|
| 277 |
<p>Another possibility is that web servers sometimes interpret |
| 278 |
filenames with certain extensions as executable content, like |
| 279 |
<tt>.shtml</tt>, <tt>.cgi</tt>, <tt>.phtml</tt>. If MHonArc used the |
| 280 |
attachment filename, or even just the attachment filename extension, |
| 281 |
anyone who can send mail that will be archived on your site can |
| 282 |
introduce executable content. |
| 283 |
</p> |
| 284 |
|
| 285 |
<p>It is because of the above reasons that the |
| 286 |
<a href="../resources/mimefilters.html#m2h_external"><tt>m2h_external::filter</tt></a> |
| 287 |
documented in the <a href="../resources/mimefilters.html">MIMEFILTERS</a> |
| 288 |
resource advises caution when using the filter options that enable |
| 289 |
the usage of attachment filenames or filename extensions. |
| 290 |
</p> |
| 291 |
|
| 292 |
|
| 293 |
<hr noshade size=1> |
| 294 |
<table border=0> |
| 295 |
<tr valign=baseline><td><img src="monicon.png" align="bottom" alt=""></td><td> |
| 296 |
<h3><b><a name="suid">Is it okay to run <tt>mhonarc</tt> setuid?</a></b></h3> |
| 297 |
</td></tr></table> |
| 298 |
|
| 299 |
<p><strong>NO!</strong> It is not okay. First, MHonArc does |
| 300 |
not pass Perl's taint checks. Second, MHonArc is vulnerable to |
| 301 |
symlink attacks. Hence, if <tt>mhonarc</tt> (or any of the utility |
| 302 |
programs) is setuid, <tt>mhonarc</tt> can be used for local priviledge |
| 303 |
escalation attacks. |
| 304 |
</p> |
| 305 |
|
| 306 |
|
| 307 |
<hr> |
| 308 |
|
| 309 |
|
| 310 |
<table width="100%"><tr><td align="left"><nobr>[<a href="mime.html">Prev</a>]</nobr></td><td align="center" width="100%">[<a href="faq.html">TOC</a>][<a href="../mhonarc.html">Manual</a>][<a href="http://www.mhonarc.org/">Home</a>]</td><td align="right"><nobr>[Next]</nobr></td></tr></table> |
| 311 |
</p> |
| 312 |
|
| 313 |
|
| 314 |
<HR> |
| 315 |
<address> |
| 316 |
$Date: 2005/05/25 19:51:01 $ <br> |
| 317 |
<img align="top" src="monicon.png" alt=""> |
| 318 |
<a href="http://www.mhonarc.org/" |
| 319 |
><strong>MHonArc</strong></a><br> |
| 320 |
Copyright © 2002, <a href="http://www.earlhood.com/" |
| 321 |
>Earl Hood</a>, <a href="mailto:mhonarc%40mhonarc.org" |
| 322 |
>mhonarc |
| 323 |
@ |
| 324 |
mhonarc.org</a><br> |
| 325 |
</address> |
| 326 |
</BODY> |
| 327 |
</HTML> |