Vulnerability in GNOME GLib Package (CVE-2021-27218)

glib Updated 02 Oct 2025

Summary

15/02/2021
N/A
Yes i
High
7.5

CVE-2021-27218: An issue was discovered in GNOME GLib before 2.66.7 and 2.67.x before 2.67.4. Affects glib across 3 version ranges.

< 2.66.7-r0 >= 8f0b968cd128915853d17bf7944f7e0ebd90a399, < 4236672170fcf643fd7425fcc74cc8d8340ebd79 < 95115f029d9c170c2e966cd7d3547b6394c92a4a

Fixed in 2.66.7-r0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

GNOME GLib is a library that provides various useful functions for C programming language. It is widely used in the GNOME desktop environment and other applications. This vulnerability (CVE-2021-27218) affects versions before 2.66.7 and 2.67.x before 2.67.4. The issue arises when the function g_byte_array_new_take() is called with a buffer of 4GB or more on a 64-bit platform. Due to a truncation error, the length of the buffer is unintentionally truncated modulo 2^32, leading to unintended length truncation.

Vulnerability Detail

The vulnerability in GNOME GLib (CVE-2021-27218) occurs when g_byte_array_new_take() is used with a large buffer on a 64-bit platform. The length of the buffer is incorrectly truncated modulo 2^32, resulting in unintended length truncation. This can lead to various issues, such as data corruption, memory access errors, and potential security vulnerabilities. An attacker may be able to exploit this vulnerability to manipulate the truncated data and cause a denial-of-service (DoS) condition or execute arbitrary code.

How To Fix

Minimum fixed version

2.66.7-r0

This is the first release that contains the fix.

sudo apk add --upgrade glib

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is essential to update the GNOME GLib package to the fixed version to mitigate the risk of exploitation.

Conclusion

The vulnerability in GNOME GLib (CVE-2021-27218) can have serious consequences, including data corruption and potential security risks. It is crucial to update the GNOME GLib package to the fixed version (2.66.7 or later) to mitigate the risk of exploitation. Regularly updating software and applying security patches is essential for maintaining a secure environment. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for glib →

Share this vulnerability

FAQ

GNOME GLib is a library that provides various useful functions for C programming language. It is commonly used in the GNOME desktop environment and other applications.

This vulnerability can lead to data corruption, memory access errors, and potential security vulnerabilities. An attacker may be able to exploit this vulnerability to cause a denial-of-service (DoS) condition or execute arbitrary code.

To fix this vulnerability, update the GNOME GLib package to version 2.66.7 or later. Download the updated package from the official GNOME website or use your package manager to install the latest version.

No, there is no known workaround for this vulnerability. It is crucial to update the GNOME GLib package to the fixed version.

You can find more information about this vulnerability in the CVE-2021-27218 JSON report available at the following source: https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-27218.json

Related vulnerabilities

Recent vulnerabilities recorded for glib.

How To Fix

Minimum fixed version

2.66.7-r0

This is the first release that contains the fix.

sudo apk add --upgrade glib

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback