Menu

#577 SetUID, SetGID, and Sticky Bits are lost upon extraction

open
nobody
None
5
2024-07-31
2024-07-31
Mike
No

Description

SetUID, SetGID, and Sticky Bits are lost when extracting an archive containing files with such permissions.

That's likely due to security considerations, but it's expected to have a switch similar to -snld to accept the risk and extract the original permissions.

Version

7-Zip 23.01 (arm64) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20
 64-bit arm_v:8 locale=C.UTF-8 Threads:8 OPEN_MAX:1048576

Reproduction Path

mkdir src
touch src/test
chmod 4755 src/test
(cd src && 7z a test.tar .)
7z -odst x test.tar

The debug output shows the correct mode:

# 7z -slt l test.tar 

7-Zip 23.01 (arm64) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20
 64-bit arm_v:8 locale=C.UTF-8 Threads:8 OPEN_MAX:1048576

Scanning the drive for archives:
1 file, 1536 bytes (2 KiB)

Listing archive: test.tar

--
Path = test.tar
Type = tar
Physical Size = 1536
Headers Size = 1536
Code Page = UTF-8
Characteristics = GNU ASCII

----------
Path = test
Folder = -
Size = 0
Packed Size = 0
Modified = 2024-07-31 13:16:37
Created = 
Accessed = 
Mode = -rwsr-xr-x
User = 
Group = 
User ID = 0
Group ID = 0
Symbolic Link = 
Hard Link = 
Characteristics = 0 GNU ASCII
Comment = 
Device Major = 
Device Minor = 

But the extracted file doesn't have the SetUID bit:

# ls -la dst/test
-rwxr-xr-x 1 root root 0 Jul 31 13:16 dst/test

Discussion


Log in to post a comment.