zlib v1.3.1.2 Global Buffer Overflow in TGZfname() of zlib untgz Utility via Unbounded strcpy() on User-Supplied Archive Name
好的,我现在需要帮用户总结一篇文章的内容,控制在100字以内。首先,我得仔细阅读用户提供的文章内容,理解其中的关键点。 文章主要讨论的是zlib库中的一个全球缓冲区溢出漏洞。这个漏洞出现在untgz工具的TGZfname()函数中,问题出在strcpy()函数的使用上。用户提供的输入没有经过长度检查就被复制到一个固定大小的全局静态缓冲区中,导致溢出。 接下来,我需要提取关键信息:漏洞类型(缓冲区溢出)、影响(可能导致内存破坏、拒绝服务或代码执行)、原因(strcpy无边界检查)以及影响范围(可能影响后续程序行为)。 然后,我要将这些信息浓缩成一句话,确保不超过100字,并且不使用“文章内容总结”之类的开头。同时,要保持语言简洁明了,让读者一目了然。 最后,检查是否有遗漏的重要信息,并确保总结准确无误。 </think> zlib库中存在一个全球缓冲区溢出漏洞,源于TGZfname()函数对用户输入的无限制strcpy操作。攻击者通过提供超长文件名可导致内存破坏、拒绝服务或潜在代码执行。 2026-1-6 06:59:19 Author: seclists.org(查看原文) 阅读量:6 收藏

fulldisclosure logo

Full Disclosure mailing list archives


From: Ron E <ronaldjedgerson () gmail com>
Date: Mon, 29 Dec 2025 22:43:46 -0500

A global buffer overflow vulnerability exists in the TGZfname() function of
the zlib untgz utility due to the use of an unbounded strcpy() call on
attacker-controlled input. The utility copies a user-supplied archive name
(argv[arg]) into a fixed-size static global buffer of 1024 bytes without
performing any length validation. Supplying an archive name longer than
1024 bytes results in an out-of-bounds write past the end of the global
buffer, leading to memory corruption.
The vulnerable code is reached prior to any archive parsing or validation,
making the flaw trivially reachable through command-line input alone.

*Root Cause*
* arcname is derived directly from argv[]
* No bounds checking is performed before copying into buffer
* buffer is a global static array, not stack-allocated
* Overflow occurs immediately on function entry

*Impact*
An attacker can trigger a global buffer overflow by invoking untgz with a
sufficiently long filename argument.
Potential impacts include:
* Denial of Service (crash)
* Memory corruption of adjacent global objects
* Undefined behavior
* Potential code execution depending on:
    * compiler
    * architecture
    * build flags
    * memory layout
Because the overflow affects global memory, corruption may persist beyond
the scope of the function and influence later program behavior.

*Evidence:*
./untgz_asan $(python3 - <<'EOF'
print("A" * 4096)
EOF)

*ASAN Output:*
=================================================================
==3141495==ERROR: AddressSanitizer: global-buffer-overflow on address
0xaaaab54d8ec0 at pc 0xaaaab4a91bec bp 0xfffffd1e5150 sp 0xfffffd1e4940
WRITE of size 2001 at 0xaaaab54d8ec0 thread T0
    #0 0xaaaab4a91be8 in strcpy
(/root/zlib/contrib/untgz/untgz_asan+0xc1be8) (BuildId:
31ab7d499b8ab40a93265dad8bfb879e63c604ab)
    #1 0xaaaab4aee508 in TGZfname /root/zlib/contrib/untgz/untgz.c:136:3
    #2 0xaaaab4af2fec in main /root/zlib/contrib/untgz/untgz.c:638:20
    #3 0xffffbaa52598 in __libc_start_call_main
csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #4 0xffffbaa52678 in __libc_start_main csu/../csu/libc-start.c:360:3
    #5 0xaaaab4a079ac in _start
(/root/zlib/contrib/untgz/untgz_asan+0x379ac) (BuildId:
31ab7d499b8ab40a93265dad8bfb879e63c604ab)
_______________________________________________
Sent through the Full Disclosure mailing list
https://nmap.org/mailman/listinfo/fulldisclosure
Web Archives & RSS: https://seclists.org/fulldisclosure/


Current thread:

  • zlib v1.3.1.2 Global Buffer Overflow in TGZfname() of zlib untgz Utility via Unbounded strcpy() on User-Supplied Archive Name Ron E (Jan 05)

文章来源: https://seclists.org/fulldisclosure/2026/Jan/3
如有侵权请联系:admin#unsafe.sh