Security: SUID/SGID bits preserved via metadata can escalate privileges #191
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: medium
Category: security
Location:
src/shared/metadata.c:96-107,src/shared/file.c:61-77Description:
When metadata preservation is enabled (
-M/--preserve), the receiver restores the source file mode withchmod(path, metadata->mode & 07777). No validation is performed on the received mode. A malicious client can send a file withS_ISUID/S_ISGID/S_IWOTHbits set. If the server runs as root, this can create setuid executables or world-writable files on the destination system, leading to privilege escalation or unauthorized modification.Suggested fix:
S_ISUID,S_ISGID,S_IWOTH) unless a new--preserve-perms=fullor--superflag is used.Labels: security, privilege-escalation