CVE-2026-139020 — Linux Kernel — NONE Vulnerability
In the Linux kernel, the following vulnerability has been resolved: gfs2: reject invalid inode sizes A corrupted GFS2 image can store a dinode size that is larger than what VFS i_size can represent. gfs2_dinode_in() reads the on-disk di_size as a u64 and writes it directly into inode->i_size. If the value is larger than S64_MAX, the incore i_size becomes negative. That negative value can bypass the existing stuffed inode size check: inode->i_size > gfs2_max_stuffed_size(ip) Later, gfs2_quotad may try to sync the quota file and unstuff the quota inode. gfs2_unstuffer_folio() reads the negative i_size into an unsigned length and passes it to memcpy(), turning it into a huge copy size and triggering a out-of-bound issue. Reject dinodes whose size exceeds sb->s_maxbytes before storing the value in inode->i_size. Also make the stuffed inode check use the raw on-disk size while it is still unsigned.
In the Linux kernel, the following vulnerability has been resolved: gfs2: reject invalid inode sizes A corrupted GFS2 image can store a dinode size that is larger than what VFS i_size can represent. gfs2_dinode_in() reads the on-disk di_size as a u64 and writes it directly into inode->i_size. If the value is larger than S64_MAX, the incore i_size becomes negative. That negative value can bypass the existing stuffed inode size check: inode->i_size > gfs2_max_stuffed_size(ip) Later, gfs2_quotad may try to sync the quota file and unstuff the quota inode. gfs2_unstuffer_folio() reads the negative i_size into an unsigned length and passes it to memcpy(), turning it into a huge copy size and triggering a out-of-bound issue. Reject dinodes whose size exceeds sb->s_maxbytes before storing the value in inode->i_size. Also make the stuffed inode check use the raw on-disk size while it is still unsigned.
🎯 What is this vulnerability?
Technical Flaw:
This vulnerability is a Type Confusion / Integer Overflow leading to Out-of-Bounds (OOB) Memory Read/Write in the Linux kernel's GFS2 (Global File System 2) driver.
Root Cause Analysis:
1. Input Validation Failure: The function gfs2_dinode_in() reads the di_size field from the on-disk GFS2 dinode structure. This field is a 64-bit unsigned integer (u64).
2. Signedness Mismatch: The code writes this u64 value directly into inode->i_size, which is a signed 64-bit integer (s64 or loff_t).
3. Bypass of Sanity Checks: If the on-disk di_size is greater than S64_MAX (i.e., the most significant bit is set), the resulting in-memory inode->i_size becomes a negative number.
4. Logic Bypass: The existing check for "stuffed" inodes (small files stored directly in the inode) compares inode->i_size > gfs2_max_stuffed_size(ip). Since a negative number is always less than a positive maximum size, this check passes incorrectly, allowing the kernel to proceed with operations on a corrupted size value.
5. Exploitation Primitive: Later, during quota synchronization (gfs2_quotad), the function gfs2_unstuffer_folio() casts the negative i_size to an unsigned length for a memcpy() operation. A negative s64 cast to u64 results in a very large positive number (e.g., 0xFFFFFFFFFFFFFFxx). This causes memcpy to read/write far beyond the allocated buffer, leading to memory corruption.
CWE Classification:
- CWE-190: Integer Overflow or Wraparound
- CWE-125: Out-of-bounds Read
- CWE-787: Out-of-bounds Write
- Local access with permission to mount filesystems (e.g.,
CAP_SYS_ADMINor root). - Or, a scenario where the system automatically mounts untrusted GFS2 volumes (e.g., USB drives, network shares, or container images).
CVSS Note: The provided CVSS score is 0/10 (NONE), which is technically inconsistent with the description of an OOB memory corruption issue in the kernel. Typically, such bugs are rated High or Critical (7.0–9.8) because they can lead to Denial of Service (kernel panic) or potentially Privilege Escalation if the memory corruption is controllable. The "0" score likely indicates a data entry error in the source feed or that the specific commit was assessed as having no direct external attack surface without a pre-existing corrupted filesystem. However, for security analysis, we must treat this as a High Severity local privilege escalation / DoS vector.
⚡ Attack Chain
Prerequisite: The attacker must have the ability to mount a malicious GFS2 filesystem image. This typically requires:
Step 1: Discovery & Reconnaissance
1. Identify GFS2 Usage: Check if the target system uses GFS2.# Check loaded modules
lsmod | grep gfs2
# Check mounted filesystems
mount | grep gfs2
# Check for GFS2 tools
which gfs2_tool2. Verify Kernel Version: Ensure the kernel is vulnerable (pre-patch). The fix involves rejecting dinodes with sizes exceeding sb->s_maxbytes.
Step 2: Exploitation (PoC Concept)
Note: This is an illustrative PoC. Actual exploitation requires crafting a specific GFS2 image with a corrupted dinode.1. Craft Malicious GFS2 Image:
* Create a GFS2 filesystem image.
* Use a tool like gfs2_tool or a custom Python script to modify the on-disk dinode of a specific file (e.g., the quota file).
* Set the di_size field to a value greater than S64_MAX (e.g., 0xFFFFFFFFFFFFFFFF).
# Illustrative Python snippet to corrupt dinode size
# Requires precise knowledge of GFS2 on-disk structure
import struct
# Assume we have a buffer representing the dinode
# di_size is typically at a specific offset in the dinode structure
# This is a placeholder for the actual offset
offset_di_size = 0x10 # Example offset, must be verified against gfs2.h
malicious_size = 0xFFFFFFFFFFFFFFFF # > S64_MAX
# Write the malicious size into the dinode buffer
dinode_buffer[offset_di_size:offset_di_size+8] = struct.pack('<Q', malicious_size)2. Mount the Malicious Filesystem:
# Mount the crafted image
sudo mkdir /mnt/gfs2_poc
sudo mount -t gfs2 /path/to/malicious_gfs2.img /mnt/gfs2_poc3. Trigger the Vulnerability:
* The vulnerability is triggered when gfs2_quotad attempts to sync the quota file.
* This may happen automatically upon mount if quotas are enabled, or when the quota file is accessed/modified.
* Alternatively, an attacker with local access can trigger a quota sync by writing to a file on the GFS2 volume.
# Trigger quota sync by writing to a file
sudo dd if=/dev/zero of=/mnt/gfs2_poc/testfile bs=1M count=14. Result:
* gfs2_unstuffer_folio() reads the negative i_size.
* memcpy() is called with a huge length.
* Outcome: Kernel panic (DoS) or memory corruption leading to potential code execution.
Step 3: Post-Exploitation
task_struct, cred), the attacker may escalate from a local user to root. This requires advanced exploitation techniques (e.g., heap spraying, ROP chains).🌍 Real World Impact
Practical Consequences:
🛡️ Remediation & Mitigation
1. Patching
sb->s_maxbytes.# Check kernel version
uname -r
# Check for specific patch (example, verify with your distribution's changelog)
git log --oneline | grep "gfs2: reject invalid inode sizes"2. Workarounds
# Unload GFS2 module
sudo modprobe -r gfs2
# Prevent automatic mounting
# Edit /etc/fstab to remove GFS2 entries
# Or use udev rules to ignore GFS2 devices# Use sudoers to restrict mount commands
# Example: Allow only root to mount GFS2
root ALL=(ALL) /bin/mount -t gfs2gfs2_quotad from triggering the vulnerability.# Remount without quota options
sudo mount -o remount,noquota /mnt/gfs23. Detection
# Check dmesg for GFS2 errors
dmesg | grep -i gfs2
# Look for specific error messages
dmesg | grep -i "out-of-bounds"# Use gfs2_tool to check filesystem integrity
sudo gfs2_tool check /dev/sdX# Use auditd to log mount events
auditctl -w /bin/mount -p x -k gfs2_mount⚠️ Urgency
Priority: HIGH
[🤖 CVE Professor AI Security Engine]
FOFA Query