OSDN Git Service

[PATCH] smbfs chroot issue (CVE-2006-1864)
authorOlaf Kirch <okir@suse.de>
Fri, 5 May 2006 01:40:41 +0000 (18:40 -0700)
committerWilly TARREAU <willy@pcw.(none)>
Sun, 7 May 2006 19:11:33 +0000 (21:11 +0200)
Mark Moseley reported that a chroot environment on a SMB share can be
left via "cd ..\\".  Similar to CVE-2006-1863 issue with cifs, this fix
is for smbfs.

Steven French <sfrench@us.ibm.com> wrote:

Looks fine to me.  This should catch the slash on lookup or equivalent,
which will be all obvious paths of interest.

Back-ported to 2.4 by Willy Tarreau.
Signed-off-by: Willy Tarreau <willy@w.ods.org>
fs/smbfs/dir.c

index 7c0a0de..9ace0a4 100644 (file)
@@ -416,6 +416,11 @@ smb_lookup(struct inode *dir, struct dentry *dentry)
        if (dentry->d_name.len > SMB_MAXNAMELEN)
                goto out;
 
+       /* Do not allow lookup of names with backslashes in */
+       error = -EINVAL;
+       if (memchr(dentry->d_name.name, '\\', dentry->d_name.len))
+               goto out;
+
        error = smb_proc_getattr(dentry, &finfo);
 #ifdef SMBFS_PARANOIA
        if (error && error != -ENOENT)