You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@hlsxx@reubenwong97 Hi! I suspect that some details in my reproduction steps were not clearly described, leading to discrepancies during reproduction. According to my tests, this issue still persists on the latest branch. Below is a more detailed and stable reproduction procedure.
Test OS: Ubuntu 22.04
Test commit: 34fd4beac3d790d7215115a1e13bb290efb53b02
Here are the reproduction steps (an example using /tmp and /home on different file systems),
# Source file on filesystem Aecho"PAYLOAD_FROM_SRC"> /tmp/src_file
# Victim file on filesystem B, readable/writable only by root
mkdir -p /home/$USER/secure
echo"ORIGINAL_SECRET"> /home/$USER/secure/victim
chmod 600 /home/$USER/secure/victim
sudo chown root:root /home/$USER/secure/victim
# Initial destination path (attacker-writable)echo"PLACEHOLDER"> /home/$USER/target
First run symlink.sh in one terminal. Then open another terminal to execute mv.sh. You will need to enter the root password for mv.sh to simulate root-user cross-filesystem mv operations.
Note that this case uses /tmp and /home. Please adjust according to your actual environment to adopt directories from two different filesystems.
By comparison, when running mv.sh with GNU mv, an error occurs: mv: cannot create regular file '/home/test/target': File exists. Meanwhile, the content of the /home/$USER/secure/victim file remains unchanged.
Fixed by #12170: cross-device mv now opens dest with O_NOFOLLOW via uucore::safe_copy::create_dest_restrictive, so a planted symlink at dest returns ELOOP instead of being written through.
Activity
reubenwong97 commentedon Feb 3, 2026
Hi! If this issue is still active, I'd like to work on it.
hlsxx commentedon Feb 6, 2026
Couldn't reproduce the problem
reubenwong97 commentedon Feb 6, 2026
@hlsxx ,
Are you doing this on different file systems?
df -h <dir>must show something different I believe.hlsxx commentedon Feb 6, 2026
@reubenwong97 sure, I have tried home as
ext4and tmp astmpfs.ziling-zellic commentedon Apr 20, 2026
@hlsxx @reubenwong97 Hi! I suspect that some details in my reproduction steps were not clearly described, leading to discrepancies during reproduction. According to my tests, this issue still persists on the latest branch. Below is a more detailed and stable reproduction procedure.
Test OS:
Ubuntu 22.04Test commit:
34fd4beac3d790d7215115a1e13bb290efb53b02Here are the reproduction steps (an example using
/tmpand/homeon different file systems),the
symlink.sh:and the
mv.sh(Please note to modify the followingcoreutilspath):First run
symlink.shin one terminal. Then open another terminal to executemv.sh. You will need to enter the root password formv.shto simulate root-user cross-filesystemmvoperations.After a short time,
$ sudo cat /home/$USER/secure/victim PAYLOAD_FROM_SRCNote that this case uses
/tmpand/home. Please adjust according to your actual environment to adopt directories from two different filesystems.By comparison, when running
mv.shwithGNU mv, an error occurs:mv: cannot create regular file '/home/test/target': File exists. Meanwhile, the content of the/home/$USER/secure/victimfile remains unchanged.Please let me know if you have any questions!
mv: drop pre-copy unlink of regular file destinations (uutils#10015)
mv: drop pre-copy unlink of regular file destinations (uutils#10015)
mv: drop pre-copy unlink of regular file destinations (uutils#10015)
mv: drop pre-copy unlink of regular file destinations (uutils#10015)
fixup! mv: drop pre-copy unlink of regular file destinations (uutils#…
fixup! mv: drop pre-copy unlink of regular file destinations (uutils#…
fixup! mv: drop pre-copy unlink of regular file destinations (uutils#…
1 remaining item
fixup! mv: drop pre-copy unlink of regular file destinations (uutils#…
fixup! mv: drop pre-copy unlink of regular file destinations (uutils#…
fixup! mv: drop pre-copy unlink of regular file destinations (uutils#…
mv: drop pre-copy unlink of regular file destinations (uutils#10015)
mv: drop pre-copy unlink of regular file destinations (uutils#10015)
mv: drop pre-copy unlink of regular file destinations (uutils#10015)
mv: drop pre-copy unlink of regular file destinations (uutils#10015)
sylvestre commentedon May 24, 2026
Fixed by #12170: cross-device mv now opens dest with O_NOFOLLOW via uucore::safe_copy::create_dest_restrictive, so a planted symlink at dest returns ELOOP instead of being written through.
mv: regression test + strace check for cross-device O_NOFOLLOW (uutil…
mv: regression test + strace check for cross-device O_NOFOLLOW (uutil…
mv: drop pre-copy unlink of regular file destinations (uutils#10015)
mv: regression test + strace check for cross-device O_NOFOLLOW (uutil…
mv: restore unlink-before-copy for cross-device destination overwrite
mv: regression test + strace check for cross-device O_NOFOLLOW (#10015)…