Add .gitignore file.
[rsync-web.git] / security.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>rsync</TITLE>
5 <style>
6 .security { color: red; }
7 h3 { margin-bottom: 0px; }
8 .date { color: #D25A0B; }
9 </style>
10 </HEAD>
11 <!--#include virtual="header.html" -->
12
13 <H2 align="center">Rsync Security Advisories</H2>
14
15 <p><a name="s3_0_2"></a><hr>
16 <h3>Xattr security fix in 3.0.2</h3>
17 <i class=date>April 8th, 2008</i>
18
19 <p>If you're using a version of rsync from 2.6.9 to 3.0.1 that has extended
20 attribute (xattr) support enabled, you should upgrade to 3.0.2 to avoid a
21 potential buffer overflow problem.  All 3.x versions have the potential to
22 support xattrs (depending on OS availability and the configure options used),
23 but version 2.6.9 had to be patched for this support.  You can run the command
24 "rsync --version" and look for the string "xattrs" (as long as it is not
25 "no&nbsp;xattrs") to see if your rsync is affected.
26
27 <p>For those running affected versions, there is
28 <a href="https://download.samba.org/pub/rsync/security/rsync-3.0.1-xattr-alloc.diff">a
29 patch with the fix available</a>.
30
31 <p>Those running a writable rsync daemon can opt to refuse the "xattrs" option
32 as a way to avoid the problem without an upgrade:
33
34 <blockquote><pre>refuse options = xattrs</pre></blockquote>
35
36 <p>(If you already refuse options, be sure to append "xattrs" to your existing
37 config parameter rather than adding another refuse directive.)
38
39 <p><a name="s3_0_0"></a><hr>
40 <h3>Daemon security fixes in 3.0.0 (with patches for 2.6.9)</h3>
41 <i class=date>First published on November 28th, 2007;<br>
42 Updated on December 16th, 2007;<br>
43 Item 3 added on February 15th, 2008</i>
44
45 <p>Three security advisories affect people who run a <b>writable</b> rsync
46 daemon:  The first affects only those with "use chroot = no" (which is not a
47 very safe combination in general), the second affects a daemon that has
48 daemon-excluded files that are being hidden in a module's hierarchy, and
49 the third affects only those with "use chroot = yes".
50 Included are simple config-change suggestions that should help you to
51 avoid the security issues and patches that make things safer.
52 These advisories affect all rsync versions.
53
54 <h4>1. Daemon advisory for "use chroot = no"</h4>
55
56 <p>If you are running a writable rsync daemon with "use chroot = no", there
57 is at least one way for someone to trick rsync into creating a symlink
58 that points outside of the module's hierarchy.
59
60 <p>This means that if you are allowing access from users who you don't
61 trust, that you should either figure out a way to turn on "use chroot",
62 or configure the daemon to refuse the "links" option (see "refuse
63 options" in the rsyncd.conf manpage) which will disable the ability of
64 the rsync module to receive symlinks.  After doing so, you should also
65 check that any existing symlinks in the daemon hierarchy are safe.
66
67 <p>Starting with the 3.0.0-pre6 release, there is a new daemon parameter
68 available: "munge symlinks".  This allows an rsync daemon to accept
69 symlinks and return them intact (with even a leading slash still there,
70 which is new for a non-chroot daemon), but will not allow the symlinks
71 to be used while they are in the daemon's hierarchy.
72
73 <p>For those running
74 2.6.9, there is
75 <a href="https://download.samba.org/pub/rsync/security/rsync-2.6.9-munge-symlinks.diff">a
76 patch for 2.6.9 to implement this parameter</a>.
77
78 <p>Any admin applying that patch should read the "munge symlinks" section
79 of the modified rsyncd.conf manpage for more information.  You can also
80 read about this parameter in the
81 <a href="https://download.samba.org/pub/rsync/rsyncd.conf.html">rsyncd.conf
82 manpage from a 3.x version</a>.
83
84 <h4>2. Daemon advisory for daemon excludes</h4>
85
86 <p>If you are running a writable rsync daemon that is using one of the
87 "exclude", "exclude from", or "filter" parameters in the rsyncd.conf file
88 to hide data from your users, you should be aware that there are tricks
89 that a user can play with symlinks and/or certain options that can allow
90 a user that knows the name of a hidden file to access it or overwrite it
91 (if file permissions allow that).
92
93 <p>You can avoid the symlink problem using the suggestions in the advisory
94 above.
95
96 <p>When a daemon has "use chroot = no" set , there was some buggy
97 exclude-checking for these options: <code>--compare-dest</code>,
98 <code>--link-dest</code>, <code>--copy-dest</code>, <code>--partial-dir</code>,
99 <code>--backup-dir</code>, <code>--temp-dir</code>, and
100 <code>--files-from</code>.  These are fixed in the 3.0.0pre7 release.  For
101 those running 2.6.9, there is <a
102 href="https://download.samba.org/pub/rsync/security/rsync-2.6.9-daemon-exclude.diff">a patch for
103 2.6.9</a> to fix these checks.
104
105 <p>Some of the above options can still cause problems if an excluded
106 sub-directory or filename is inside the option's directory hierarchy and the
107 names of a transferred file clashes with it.  The affected options are the
108 various <code>--*-dest</code> options (of which only <code>--link-dest</code>
109 is particularly worrisome),
110 <code>--backup-dir</code>, and <code>--partial-dir</code>.
111
112 <p>You can avoid these sub-path problems by putting the following "refuse
113 options" setting into your rsyncd.conf file:
114
115 <blockquote><pre>refuse options = link-dest backup-dir partial-dir</pre></blockquote>
116
117 <p>Those who aren't using an rsync with the latest exclude fixes may want to add
118 some of the other affected options as well.
119
120 <h4>3. Daemon advisory for "use chroot = yes"</h4>
121
122 <p>If you are running a writable rsync daemon with "use chroot = yes", you
123 should take care that users cannot upload their own library files and attempt
124 to load them.
125
126 <p>Beginning with rsync 3.0.0pre10, you can specify an inside-chroot path that
127 makes the top of the transfer a subdirectory inside the chroot area, and that
128 automatically makes library loading occur outside the transfer area (assuming
129 you didn't pick an unwise subdirectory name for the transfer area and you
130 don't have symlinks that point outside the transfer area).
131
132 <p>If that solution is not good for you, the easiest way to protect your daemon
133 is to create some appropriate directories in the top of your module's path
134 hierarchy, such as "/etc", "/lib", and "/usr" (and any other top-level dirs
135 that might be in the load path), chown those directories to some other user
136 than the one that the module runs as (so that rsync will not be able to write
137 files there, assuming that it is not run as root), and then hide the dirs using
138 an exclude directive (either add a new one or extend your existing one):
139
140 <blockquote><pre>exclude = /etc /lib /usr</pre></blockquote>
141
142 <p>Doing all that will assure you that no user will be able to use rsync to
143 upload a library that can be potentially loaded while rsync is attempting to
144 perform an action, such as translating a username.  You can feel free to put
145 trusted libraries that you want rsync to access in the protected hierarchies,
146 as desired.
147
148 <p>Also available in rsync 3.0.0pre10 is a new daemon parameter that allows you
149 to avoid the accessing of user/group-name translation libraries by a chrooted
150 rsync:  the "numeric ids" daemon parameter lets you turn on a forced
151 numeric-only mode.  The default for a chroot module is to enable this
152 parameter, while the default for a non-chroot module is to disable it.
153
154 <p>For those running 2.6.9, there is <a
155 href="https://download.samba.org/pub/rsync/security/rsync-2.6.9-daemon-ids.diff">a patch for
156 2.6.9</a> to add the "numeric ids" daemon config parameter.  (The patch will
157 only apply cleanly if you've already applied the munge-symlinks diff mentioned
158 above.)
159
160 <p><a name="s2_6_8"></a><hr>
161 <h3>Xattr security fix in 2.6.8</h3>
162 <i class=date>April 22th, 2006</i>
163
164 <p>If you're using a version of rsync prior to 2.6.8 that was patched to
165 include extended attribute (xattr) support, you should upgrade to 2.6.8 or
166 later to avoid a potential buffer overflow problem.
167
168 <p><a name="s2_6_6"></a><hr>
169 <h3>Zlib security fix in 2.6.6</h3>
170 <i class=date>July 28th, 2005</i>
171
172 <p>If you're using a version of rsync prior to 2.6.6, there is a potential
173 null-pointer security bug in the zlib code.  You can avoid its affect in an
174 rsync daemon situation by configuring rsync to refuse the "compress" option.
175
176 <p><a name="s2_6_3"></a><hr>
177 <h3>Daemon path-sanitizing fix in 2.6.3</h3>
178 <i class=date>August 12th, 2004</i>
179
180 <p>There is a path-sanitizing bug that affects daemon-mode in
181 rsync versions prior to 2.6.3, but only if "use chroot" is disabled.  It
182 does <b>not</b> affect the normal send/receive filenames that specify what
183 files should be transferred (this is because these names happen to get
184 sanitized twice, and thus the second call removes any lingering leading
185 slash(es) that the first call left behind).  It does affect certain
186 option paths that cause auxiliary files to be read or written.
187
188 <p>One potential fix that doesn't require recompiling rsync is to set
189 "use chroot = true" for all the modules in the rsyncd.conf file.
190
191 <p><a name="s2_6_1"></a><hr>
192 <h3>Daemon security fix in 2.6.1</h3>
193 <i class=date>April 26th, 2004</i>
194
195 <p>There is a security problem in all versions prior to 2.6.1 that affects only
196 people running a read/write daemon with "use chroot" disabled.  If the user privs
197 of a module in the daemon config is anything above "nobody", you are at risk
198 of someone crafting an attack that could write a file outside of the module's
199 "path" setting (where all its files should be stored).  Please either enable
200 chroot or upgrade to 2.6.1.  People not running a daemon, running a read-only
201 daemon, or running a chrooted daemon are totally unaffected.
202
203 <p><a name="s2_5_7"></a><hr>
204 <h3>Memory overflow fix in 2.5.7</h3>
205 <i class=date>December 4th, 2003</i>
206
207 <p>Rsync versions prior to 2.5.7 contain a heap overflow vulnerability that
208 could be used to remotely run arbitrary code, but this only affects the use of
209 rsync as an "rsync daemon" (where rsync handles incoming socket connections,
210 typically on port 873).
211
212 <!--#include virtual="footer.html" -->
213 <br>&nbsp;
214 <br>&nbsp;
215 <br>&nbsp;
216 <br>&nbsp;
217 <br>&nbsp;
218 <br>&nbsp;
219 <br>&nbsp;
220 <br>&nbsp;
221 <br>&nbsp;
222 <br>&nbsp;
223 <br>&nbsp;
224 <br>&nbsp;
225 <br>&nbsp;