Debian Codegraph @

devel-docs/security.rst

raw
1 Security
2 ========
3
4 Reporting security bugs
5 -----------------------
6
7 Please mail the maintainer at [email protected]. You can use the GPG
8 public key from https://viruta.org/docs/fmq-gpg.asc to send encrypted
9 mail.
10
11 Librsvg releases with security fixes
12 ------------------------------------
13
14 Librsvg releases have a version number like major.minor.micro.
15
16 Before version 2.55.x, librsvg's versioning scheme was such that a
17 release with an *even* minor number was considered a stable release
18 suitable for production use (e.g. 2.54.x), and an *odd* minor number
19 was a development release only.
20
21 Starting with 2.55.x, all minor numbers are considered stable.
22 Development and beta versions have a micro version starting at 90
23 (e.g. 2.55.90), per `GNOME's release versioning as of 2022/September
24 <https://discourse.gnome.org/t/even-odd-versioning-is-confusing-lets-stop-doing-it/10391>`_.
25
26 The following list is only for stable release streams.
27
28 2.57.4
29 ~~~~~~
30
31 :rustsec:`2024-0421` - idna accepts Punycode labels that do not
32 produce any non-ASCII when decoded
33
34 :rustsec:`2024-0404` - Unsoundness in anstream
35
36 2.56.5
37 ~~~~~~
38
39 :rustsec:`2024-0421` - idna accepts Punycode labels that do not
40 produce any non-ASCII when decoded
41
42 :rustsec:`2024-0404` - Unsoundness in anstream
43
44 `GHSA-c827-hfw6-qwvm
45 <https://github.com/advisories/GHSA-c827-hfw6-qwvm>`__
46 (CVE-2024-43806) - memory explosion in rustix.
47
48 2.56.3
49 ~~~~~~
50
51 .. The CVE URL is used directly here because Sphinx's `cve` role can't be
52 used in a substitution since it generates a target for an index entry.
53
54 .. |CVE-2023-38633| replace::
55
56 `CVE-2023-38633 <https://www.cve.org/CVERecord?id=CVE-2023-38633>`__ -
57 :issue:`996` - Arbitrary file read when xinclude href has special
58 characters.
59
60 |CVE-2023-38633|
61
62 2.55.3
63 ~~~~~~
64
65 |CVE-2023-38633|
66
67 2.54.7
68 ~~~~~~
69
70 |CVE-2023-38633|
71
72 2.52.12
73 ~~~~~~~
74
75 :rustsec:`2024-0421` - idna accepts Punycode labels that do not
76 produce any non-ASCII when decoded
77
78 :rustsec:`2024-0404` - Unsoundness in anstream
79
80 `GHSA-c827-hfw6-qwvm
81 <https://github.com/advisories/GHSA-c827-hfw6-qwvm>`__
82 (CVE-2024-43806) - memory explosion in rustix.
83
84
85 2.52.11
86 ~~~~~~~
87
88 |CVE-2023-38633|
89
90 2.50.9
91 ~~~~~~
92
93 |CVE-2023-38633|
94
95 2.50.4
96 ~~~~~~
97
98 :rustsec:`2020-0146` - lifetime erasure in generic-array.
99
100 2.48.12
101 ~~~~~~~
102
103 |CVE-2023-38633|
104
105 2.48.10
106 ~~~~~~~
107
108 :cve:`2020-35905` - :rustsec:`2020-0059` - data race in futures-util.
109
110 :cve:`2020-35906` - :rustsec:`2020-0060` - use-after-free in futures-task.
111
112 :cve:`2021-25900` - :rustsec:`2021-0003` - buffer overflow in smallvec.
113
114 :rustsec:`2020-0146` - lifetime erasure in generic-array.
115
116 2.48.0
117 ~~~~~~
118
119 :cve:`2019-20446` - guard against exponential growth of CPU time from
120 malicious SVGs.
121
122 .. |see libcroco notes| replace::
123
124 See notes below on :ref:`libcroco <libcroco>`.
125
126 .. caution::
127
128 **Releases older than 2.48.0 are not recommended.**
129 |see libcroco notes|
130
131 2.46.7
132 ~~~~~~
133
134 |CVE-2023-38633|
135
136 |see libcroco notes|
137
138 2.46.5
139 ~~~~~~
140
141 :rustsec:`2020-0146` - lifetime erasure in generic-array.
142
143 :cve:`2021-25900` - :rustsec:`2021-0003` - buffer overflow in smallvec.
144
145 |see libcroco notes|
146
147 2.44.17
148 ~~~~~~~
149
150 :rustsec:`2020-0146` - lifetime erasure in generic-array.
151
152 :cve:`2019-15554` - :rustsec:`2019-0012` - memory corruption in smallvec.
153
154 :cve:`2019-15551` - :rustsec:`2019-0009` - double-free and use-after-free
155 in smallvec.
156
157 :cve:`2021-25900` - :rustsec:`2021-0003` - buffer overflow in smallvec.
158
159 |see libcroco notes|
160
161 2.44.16
162 ~~~~~~~
163
164 :cve:`2019-20446` - guard against exponential growth of CPU time from
165 malicious SVGs.
166
167 |see libcroco notes|
168
169 2.42.8
170 ~~~~~~
171
172 :cve:`2019-20446` - guard against exponential growth of CPU time from
173 malicious SVGs.
174
175 |see libcroco notes|
176
177 2.42.9
178 ~~~~~~
179
180 :cve:`2018-20991` - :rustsec:`2018-0003` - double-free in smallvec.
181
182 |see libcroco notes|
183
184 2.40.21
185 ~~~~~~~
186
187 :cve:`2019-20446` - guard against exponential growth of CPU time from
188 malicious SVGs.
189
190 |see libcroco notes|
191
192 2.40.18
193 ~~~~~~~
194
195 :cve:`2017-11464` - Fix division-by-zero in the Gaussian blur code.
196
197 |see libcroco notes|
198
199 .. attention::
200
201 **Earlier releases should be avoided and are not listed here.**
202
203 .. _libcroco:
204
205 .. admonition:: Important note on libcroco
206
207 Note that librsvg 2.46.x and earlier use
208 `libcroco <https://gitlab.gnome.org/Archive/libcroco/>`__ for parsing
209 CSS, but that library is deprecated, unmaintained, and has open CVEs as
210 of May 2021.
211
212 If your application processes untrusted data, please avoid using librsvg
213 2.46.x or earlier. The first release of librsvg that does not use
214 libcroco is 2.48.0.
215
216 Librsvg’s C dependencies
217 ------------------------
218
219 Librsvg depends on the following libraries implemented in memory-unsafe
220 languages:
221
222 - **libxml2** - loading XML data.
223 - **cairo** - 2D rendering engine.
224 - **freetype2** - font renderer.
225 - **harfbuzz** - text shaping engine.
226 - **pango** - high-level text rendering.
227 - **fontconfig** - system fonts and rules for using them.
228
229 And of course, their recursive dependencies as well, such as
230 **glib/gio**.
231
232 The required versions for those libraries are not pinned (fixed to a
233 specific version). Instead, the minimum required version is checked
234 via the ``meson`` build system, for shared library builds, or by Rust's
235 ``system-deps`` which uses ``pkg-config`` underneath.
236
237
238 Librsvg's Rust dependencies
239 ---------------------------
240
241 Librsvg's Rust dependencies are pinned to specific versions with
242 ``Cargo.lock``. We track the security and recency of these versions in
243 various ways:
244
245 * There is a ``deny`` job in the CI which runs `cargo-deny
246 <https://github.com/EmbarkStudios/cargo-deny>`_. This presents
247 information about dependencies with vulnerabilities, duplicate
248 versions of dependencies, and other interesting data.
249
250 * There is a project badge in the `main librsvg project page
251 <https://gitlab.gnome.org/GNOME/librsvg>`_ which points to
252 ``deps.rs``. This checks whether dependencies are out of date, and
253 flags vulnerable versions as well.
254
255
256 Security considerations for the image-rs crate
257 ----------------------------------------------
258
259 Librsvg uses the `image-rs <https://github.com/image-rs/image>`_ crate
260 for decoding raster images. You may want to look at its dependencies
261 for specific codecs like the ``png`` or ``zune-jpeg`` crates.
262
263 Librsvg explicitly compiles ``image-rs`` with support for only the following formats:
264
265 * JPEG
266 * PNG
267 * GIF
268 * WEBP
269
270 The following formats are optional, and selected at compilation time:
271
272 * AVIF (compile-time option ``avif``)
273
274 See the :ref:`compile_time_options` section in :doc:`compiling` for details.
275
276
277 Security considerations for libxml2
278 -----------------------------------
279
280 Librsvg uses the following configuration for the SAX2 parser in libxml2:
281
282 - ``XML_PARSE_NONET`` - forbid network access.
283 - ``XML_PARSE_BIG_LINES`` - store big line numbers.
284
285 As a special case, librsvg enables ``replaceEntities`` in the
286 ``_xmlParserCtxtPtr`` struct so that libxml2 will expand references only
287 to internal entities declared in the DTD subset. External entities are
288 disabled.
289
290 For example, the following document renders two rectangles that are
291 expanded from internal entities:
292
293 ::
294
295 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd" [
296 <!ENTITY Rect1 "<rect x='15' y='10' width='20' height='30' fill='blue'/>">
297 <!ENTITY Rect2 "<rect x='10' y='5' width='10' height='20' fill='green'/>">
298 ]>
299 <svg xmlns="http://www.w3.org/2000/svg" width="60" height="60">
300 &Rect1;
301 &Rect2;
302 </svg>
303
304 However, an external entity like
305
306 ::
307
308 <!ENTITY foo SYSTEM "foo.xml">
309
310 will generate an XML parse error and the document will not be loaded.
311
312 Security considerations for Cairo
313 ---------------------------------
314
315 Cairo versions before 1.17.0 are easy to crash if given coordinates
316 that fall outside the range of its 24.8 fixed-point numbers. Please
317 make sure that you use librsvg with Cairo 1.17.0 or newer.
318
319 The first version of librsvg to require at least Cairo 1.17.0 is
320 librsvg 2.56.90 (development), or librsvg 2.57.0 (stable).
321
322 Security considerations for librsvg
323 -----------------------------------
324
325 **Built-in limits:** Librsvg has built-in limits for the following:
326
327 - Limit on the maximum number of loaded XML elements, set to 1,000,000
328 (one million). SVG documents with more than this number of elements
329 will fail to load. This is a mitigation for malicious documents that
330 would otherwise consume large amounts of memory, for example by
331 including a huge number of ``<g/>`` elements with no useful content.
332 This is set in the file ``rsvg/src/limits.rs`` in the
333 ``MAX_LOADED_ELEMENTS`` constant.
334
335 - Limit on the maximum number of referenced elements while rendering.
336 The ``<use>`` element in SVG and others like ``<pattern>`` can
337 reference other elements in the document. Malicious documents can
338 cause an exponential number of references to be resolved, so librsvg
339 places a limit of 500,000 references (half a million) to avoid
340 unbounded consumption of CPU time. This is set in the file
341 ``rsvg/src/limits.rs`` in the ``MAX_REFERENCED_ELEMENTS`` constant.
342
343 - Limit on the nesting level for XML Includes (``xi:include``), to
344 avoid infinite recursion from an SVG file that includes itself.
345 This is set in the file ``rsvg/src/limits.rs`` in the
346 ``MAX_XINCLUDE_DEPTH`` constant.
347
348 - Limit on the depth of nested groups and layers, to avoid unbounded
349 recursion. This is set in the file ``rsvg/src/limits.rs`` in the
350 ``MAX_LAYER_NESTING_DEPTH`` constant.
351
352 Librsvg has no built-in limits on the total amount of memory or CPU time
353 consumed to process a document. Your application may want to place
354 limits on this, especially if it processes untrusted SVG documents.
355
356 **Processing external files:** Librsvg processes references to
357 external files by itself: XML XInclude, ``xlink:href`` attributes,
358 etc. Please see the section "`Security and locations of referenced
359 files
360 <https://gnome.pages.gitlab.gnome.org/librsvg/Rsvg-2.0/class.Handle.html#security-and-locations-of-referenced-files>`_"
361 in the reference documentation to see what criteria are used to accept
362 or reject a file based on its location. If your application has more
363 stringent requirements, it may need to sandbox its use of librsvg.
364
365 **SVG features:** Librsvg ignores animations, scripts, and events
366 declared in SVG documents. It always handles referenced images, similar
367 to SVG’s `static processing
368 mode <https://www.w3.org/TR/SVG2/conform.html#static-mode>`__.