Multiple stack-based buffer overflow flaws were found in the way hardlink, the tool for consolidation of duplicate files via hardlinks, processed directory trees with deeply nested directories. A remote attacker could provide a specially-crafted directory tree, and trick the local user into consolidating it, leading to hardlink executable crash, or, potentially arbitrary code execution with the privileges of the user running the hardlink executable.
Proposed patch (applied by the Owl Linux distribution):
These issues affect the versions of the hardlink package, as shipped with Fedora release of 14 and 15. Please schedule an update.
Created hardlink tracking bugs for this issue
Affects: fedora-all [bug 746715]
These issues affect the versions of the hardlink package, as shipped with
Red Hat Enterprise Linux 5 and 6.
The CVE identifier of CVE-2011-3630 has been assigned to these issues:
This is really not a stack-based overflow, but an BSS-buffer overflow.
It is caught by GCC "Object Size Checking Builtins", __builtin___strcat_chk in this particular case.
The overflow occurs at in hardlink.c at:
309 strcat (nambuf1, "/");
Since the allocated and the current size of the nambuf1 is already known, glibc can very easily determine if the current strcat() function would overflow the buffer and when it does it aborts the program and you can see the message
"*** buffer overflow detected ***: hardlink terminated"
As mentioned in
lstat() starts failing with ENAMETOOLONG shortly after the overflow occurs. This limits the size of the overflow, later hardlink crashes with "buffer overflow detectet" message.
In Red Hat Enterprise Linux 5 and 6, stack based buffer overflows are protected by FORTIFY_SOURCE. Though this is not stack-based buffer-overflow, FORTIFY_SOURCE along with the ability of the kernel to return an error when a exceedingly long path (because of buffer-overflow) is passed to lstat(), limits this vulnerability to just an application crash.
This issue does not affect the version of hardlink, as shipped with Red Hat Enterprise Linux 5 and 6.
This issue does not affect the version of hardlink as shipped with Fedora 14 and 15.
hardlink-1.0-12.fc16 has been pushed to the Fedora 16 stable repository. If problems still persist, please make note of it in this bug report.
hardlink-1.0-12.fc15 has been pushed to the Fedora 15 stable repository. If problems still persist, please make note of it in this bug report.