Skip to contentSkip to conversation

restorecon read symlink

PATCH Ivan Gyurdiev 2 participants 3 messages Mar 15, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

Without this restorecon sdir/* fails, where sdir is a symlink to a directory. Is this a security hole, or can it be patched?

Signature · 2 lines
Ivan Gyurdiev <[email protected]>
Cornell University
domains/program/restorecon.te +1 -0
diff -aur policy.old/domains/program/restorecon.te policy/domains/program/restorecon.te
@@ -37,6 +37,7 @@
 r_dir_file(restorecon_t, policy_config_t)
 
 allow restorecon_t file_type:dir r_dir_perms;
+allow restorecon_t file_type:lnk_file read;
 allow restorecon_t file_type:{ dir file lnk_file sock_file fifo_file } { getattr relabelfrom relabelto };
 allow restorecon_t unlabeled_t:dir_file_class_set { getattr relabelfrom };
 allow restorecon_t unlabeled_t:dir read;
#1 lore raw
Quoted 2 lines · Ivan Gyurdiev

Without this restorecon sdir/* fails, where sdir is a symlink to a directory. Is this a security hole, or can it be patched?

You don't want restorecon or setfiles (or any other trusted program) following untrustworthy symlinks, to avoid malicious symlink attacks. So you don't want file_type there; at most, you want a list of trusted file types that are only modifiable by the admin.

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 8 lines · Stephen Smalley
Quoted 2 lines · Ivan Gyurdiev

Without this restorecon sdir/* fails, where sdir is a symlink to a directory. Is this a security hole, or can it be patched?

You don't want restorecon or setfiles (or any other trusted program) following untrustworthy symlinks, to avoid malicious symlink attacks. So you don't want file_type there; at most, you want a list of trusted file types that are only modifiable by the admin.

Ok true, I realize that now - it should probably stay unchanged.

Signature · 8 lines
Ivan Gyurdiev <[email protected]>
Cornell University


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.