Skip to main content

SFTP_PERM_MASK_UNTRUSTED

Constant SFTP_PERM_MASK_UNTRUSTED 

Source
pub const SFTP_PERM_MASK_UNTRUSTED: u32 = 0o0777;
Expand description

Permission mask applied to modes that arrive from the network (A3).

SFTP_PERM_MASK keeps setuid/setgid/sticky, which is correct when reading a mode from a local file we own and announcing it to the server. It is not correct in the opposite direction: a malicious or compromised server can mark a remote file setuid and have the download reproduce that bit on the local disk. Elevation bits must never be attacker-controlled, so inbound modes are clamped to plain rwx triples.