REDHAT-BUG-2506145: Buffer Overflow
diff3 tool from GNU diffutils is vulnerable to a heap‑based buffer overflow due to multiple signed integer overflows in line‑mapping calculations. Incorrect arithmetic in mapping line ranges can result in corrupted values being used for memory allocation and loop bounds. When processing crafted diff output, these overflows may cause the application to allocate insufficient memory and subsequently perform out‑of‑bounds writes during internal processing. An attacker who can control the output of the diff program used by diff3 (e.g. via --diff-program pointing to a malicious script) can trigger out-of-bounds writes, resulting in a crash and potentially remote code execution depending on the environment.
This issue has been fixed in commit 9ff04d5b84743e331e80b589335a52c5480d1815
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Patch 9ff04d5b84743e331e80b589335a52c5480d1815
Event History
Frequently Asked Questions
What access does an attacker need to trigger this issue?
The attacker needs to control the output of the diff program that diff3 uses. One stated example is use of the --diff-program option to point diff3 at a malicious script.
Are normal diff3 invocations exposed?
The described attack path depends on a crafted diff-program output rather than ordinary input alone. Exposure is therefore most relevant where users, automation, or other processes can select or influence the diff program used by diff3.
What is the likely impact of successful exploitation?
The integer overflows can cause insufficient allocation followed by out-of-bounds writes, which can crash diff3. The issue may also permit remote code execution depending on the environment.
How can I determine whether my source includes the fix?
The issue is fixed by commit 9ff04d5b84743e331e80b589335a52c5480d1815. Check the source or package changelog for inclusion of that commit or its corresponding downstream fix.