<feed xmlns='http://www.w3.org/2005/Atom'>
<title>apt/apt-pkg/contrib/extracttar.cc, branch 2.9.0</title>
<subtitle>Debians commandline package manager</subtitle>
<id>https://git.kalnischkies.de/apt/atom?h=2.9.0</id>
<link rel='self' href='https://git.kalnischkies.de/apt/atom?h=2.9.0'/>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/'/>
<updated>2024-02-20T12:49:04Z</updated>
<entry>
<title>Modernize standard library includes</title>
<updated>2024-02-20T12:49:04Z</updated>
<author>
<name>Julian Andres Klode</name>
<email>julian.klode@canonical.com</email>
</author>
<published>2024-02-20T12:43:08Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=40a75722c43ae24cb9a99d6730a3b25b65819c49'/>
<id>urn:sha1:40a75722c43ae24cb9a99d6730a3b25b65819c49</id>
<content type='text'>
This was automated with sed and git-clang-format, and then I had to
fix up the top of policy.cc by hand as git-clang-format accidentally
indented it by two spaces.
</content>
</entry>
<entry>
<title>CVE-2020-27350: tarfile: integer overflow: Limit tar items to 128 GiB</title>
<updated>2020-12-09T16:30:43Z</updated>
<author>
<name>Julian Andres Klode</name>
<email>julian.klode@canonical.com</email>
</author>
<published>2020-12-05T18:55:30Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=df81895bce764dd02fbb4d67b92d28a730b5281f'/>
<id>urn:sha1:df81895bce764dd02fbb4d67b92d28a730b5281f</id>
<content type='text'>
The integer overflow was detected by DonKult who added a check like this:

(std::numeric_limits&lt;decltype(Itm.Size)&gt;::max() - (2 * sizeof(Block)))

Which deals with the code as is, but also still is a fairly big limit,
and could become fragile if we change the code. Let's limit our file
sizes to 128 GiB, which should be sufficient for everyone.

Original comment by DonKult:

The code assumes that it can add sizeof(Block)-1 to the size of the item
later on, but if we are close to a 64bit overflow this is not possible.
Fixing this seems too complex compared to just ensuring there is enough
room left given that we will have a lot more problems the moment we will
be acting on files that large as if the item is that large, the (valid)
tar including it probably doesn't fit in 64bit either.
</content>
</entry>
<entry>
<title>tarfile: OOM hardening: Limit size of long names/links to 1 MiB</title>
<updated>2020-12-09T16:30:43Z</updated>
<author>
<name>Julian Andres Klode</name>
<email>julian.klode@canonical.com</email>
</author>
<published>2020-12-04T11:37:19Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=822db13d68658a1a20df2d19c688c18faa331616'/>
<id>urn:sha1:822db13d68658a1a20df2d19c688c18faa331616</id>
<content type='text'>
Tarballs have long names and long link targets structured by a
special tar header with a GNU extension followed by the actual
content (padded to 512 bytes). Essentially, think of a name as
a special kind of file.

The limit of a file size in a header is 12 bytes, aka 10**12
or 1 TB. While this works OK-ish for file content that we stream
to extractors, we need to copy file names into memory, and this
opens us up to an OOM DoS attack.

Limit the file name size to 1 MiB, as libarchive does, to make
things safer.
</content>
</entry>
<entry>
<title>Skip reading data from tar members if nobody will look at it</title>
<updated>2020-05-18T13:55:36Z</updated>
<author>
<name>David Kalnischkies</name>
<email>david@kalnischkies.de</email>
</author>
<published>2020-05-15T11:29:36Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=19790db8900bc9baac29cf58600152997a8ecef8'/>
<id>urn:sha1:19790db8900bc9baac29cf58600152997a8ecef8</id>
<content type='text'>
The variable this is read to is named Junk and that it is for usecases
like apt-ftparchive which just looks at the items metadata, so instead
of performing this hunked read for data nobody will process we just tell
our FileFd to skip ahead (Internally it might still loop over the data
depending on which compressor is involved).
</content>
</entry>
<entry>
<title>Properly handle interrupted write() call in ExtractTar</title>
<updated>2020-05-18T13:55:36Z</updated>
<author>
<name>David Kalnischkies</name>
<email>david@kalnischkies.de</email>
</author>
<published>2020-05-13T21:01:38Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=5534bb3ad346ef4435e6fd0fe326771a4bde16a1'/>
<id>urn:sha1:5534bb3ad346ef4435e6fd0fe326771a4bde16a1</id>
<content type='text'>
With FileFd::Write we already have a helper for this situation we can
just make use of here instead of hoping for the best or rolling our own
solution here.
</content>
</entry>
<entry>
<title>SECURITY UPDATE: Fix out of bounds read in .ar and .tar implementation (CVE-2020-3810)</title>
<updated>2020-05-12T16:55:55Z</updated>
<author>
<name>Julian Andres Klode</name>
<email>julian.klode@canonical.com</email>
</author>
<published>2020-05-12T09:49:09Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=dceb1e49e4b8e4dadaf056be34088b415939cda6'/>
<id>urn:sha1:dceb1e49e4b8e4dadaf056be34088b415939cda6</id>
<content type='text'>
When normalizing ar member names by removing trailing whitespace
and slashes, an out-out-bound read can be caused if the ar member
name consists only of such characters, because the code did not
stop at 0, but would wrap around and continue reading from the
stack, without any limit.

Add a check to abort if we reached the first character in the
name, effectively rejecting the use of names consisting just
of slashes and spaces.

Furthermore, certain error cases in arfile.cc and extracttar.cc have
included member names in the output that were not checked at all and
might hence not be nul terminated, leading to further out of bound reads.

Fixes Debian/apt#111
LP: #1878177
</content>
</entry>
<entry>
<title>Merge libapt-inst into libapt-pkg</title>
<updated>2019-05-06T10:14:04Z</updated>
<author>
<name>Julian Andres Klode</name>
<email>julian.klode@canonical.com</email>
</author>
<published>2019-05-06T09:40:08Z</published>
<link rel='alternate' type='text/html' href='https://git.kalnischkies.de/apt/commit/?id=dfe2511e31f232a8a8880eba40af40d1deb0e49c'/>
<id>urn:sha1:dfe2511e31f232a8a8880eba40af40d1deb0e49c</id>
<content type='text'>
</content>
</entry>
</feed>
