Repository navigation
Conversation
Collaborator
Author
|
I developed the code on Fedora 46. It seems that valgrind is more hungry on older Fedoras. I will look what can be improved. |
ppisar
force-pushed
the
CVE-2026-92823
branch
from
November 3, 2026 15:51
830c67f to
c0af3ff
Compare
Collaborator
Author
The cause was CI valgrind tests configuring libmodulemd without compression support. I excluded the tests on those builds. |
Small compressed files can decompress to very large files. Then
processing the very large decompressed data consumes unexpectedly
large amount of memory. This amplification of use of resources can
be interpreted as a denial of service.
While libmodulemd uses a streaming YAML parser, effectivelly skipping
large sequences of white spaces, constructing YAML scalars from very long
sequences of the same character succesfully propages to higher level
data structures.
For example this YAML document:
document: modulemd
version: 2
data:
name: test
stream: a
version: 1
context: c
arch: x86_64
summary: Text
description: Text
license:
module:
- MITA...A
where "MITA...A" is a sequence of 2^26 "A" characters occupies roughly
64 MB uncompressed, but only 64 KB after compressing with gzip. When
processing the document with this library 265 MB of memory is
allocated:
$ ls -l /tmp/input.yaml.gz
-rw-r--r--. 1 test test 65297 Aug 6 13:10 /tmp/input.yaml.gz
$ /usr/bin/time -f %M modulemd-validator /tmp/input.yaml.gz
/tmp/input.yaml.gz validated successfully
271688
To avoid these decompression bombs, this patch adds a limit for
decompressed data. The limit is 64 MiB for small files, 64 times the
compressed size for large files. 64 MiB is 10 times more than the
largest modulemd YAML files observed in the wild and the factor of 64
is a doubled factor of XZ compression ratio on the largest observed
file.
Reaching the limit is explained with a Glib warning and reported with
FALSE return value from the public function (i.e.
modulemd_module_index_update_from_file()). The warning is used because
libyaml and libmodulemd do not support reporting a detailed cause of
a libyaml reader callback's error. Implementing the proper error
reporting is out of scope of this decompression bomb mitigation.
Implementation note: This patch adds a test which cannot check for
modulemd_module_index_update_from_file() return value because the
reader callback emits a warning which Glib unhelpully turns into
a SIGABORT if G_DEBUG=fatal-warning enviroment variable is set.
Instead, the test checks for the abortion. This is not a different
from reporting standard I/O error in libmodulemd.
This flaw was added with aad63a5
commit ("Add helpers for reading compressed files") and first released
in 2.8.0 version.
Acknowledgement: Aisle Research
Resolves: CVE-2026-92823
ppisar
force-pushed
the
CVE-2026-92823
branch
from
November 3, 2026 16:40
c0af3ff to
d5ed93d
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Small compressed files can decompress to very large files. Then processing the very large decompressed data consumes unexpectedly large amount of memory. This amplification of use of resources can be interpreted as a denial of service.
While libmodulemd uses a streaming YAML parser, effectivelly skipping large sequences of white spaces, constructing YAML scalars from very long sequences of the same character succesfully propages to higher level data structures.
For example this YAML document:
where "MITA...A" is a sequence of 2^26 "A" characters occupies roughly 64 MB uncompressed, but only 64 KB after compressing with gzip. When processing the document with this library 265 MB of memory is allocated:
To avoid these decompression bombs, this patch adds a limit for decompressed data. The limit is 64 MiB for small files, 64 times the compressed size for large files. 64 MiB is 10 times more than the largest modulemd YAML files observed in the wild and the factor of 64 is a doubled factor of XZ compression ratio on the largest observed file.
Reaching the limit is explained with a Glib warning and reported with FALSE return value from the public function (i.e.
modulemd_module_index_update_from_file()). The warning is used because libyaml and libmodulemd do not support reporting a detailed cause of a libyaml reader callback's error. Implementing the proper error reporting is out of scope of this decompression bomb mitigation.
Implementation note: This patch adds a test which cannot check for modulemd_module_index_update_from_file() return value because the reader callback emits a warning which Glib unhelpully turns into a SIGABORT if G_DEBUG=fatal-warning enviroment variable is set. Instead, the test checks for the abortion. This is not a different from reporting standard I/O error in libmodulemd.
This flaw was added with aad63a5 commit ("Add helpers for reading compressed files") and first released in 2.8.0 version.
Acknowledgement: Aisle Research
Resolves: CVE-2026-92823