Skip to contentSkip to conversation

smbfs chroot issue (CVE-2006-1864)

PATCH Superseded Chris Wright 2 participants 2 messages May 5, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smbfs chroot issue (CVE-2006-1864)

From: Olaf Kirch <[email protected]>

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 <[email protected]> wrote:

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

---
This fix is in -stable, but doesn't appear to be in your tree yet.

 fs/smbfs/dir.c |    5 +++++
 1 file changed, 5 insertions(+)
fs/smbfs/dir.c +5 -0
@@ -434,6 +434,11 @@ smb_lookup(struct inode *dir, struct den
 	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;
+
 	lock_kernel();
 	error = smb_proc_getattr(dentry, &finfo);
 #ifdef SMBFS_PARANOIA
#1 lore raw

Marcelo,

This patch also applies to 2.4, did you receive it on your side or do you want me to queue it in -upstream ?

Regards,
Willy

Quoted 37 lines · Chris Wright

From: Olaf Kirch <[email protected]>

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 <[email protected]> wrote:

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

---
This fix is in -stable, but doesn't appear to be in your tree yet.

 fs/smbfs/dir.c |    5 +++++
 1 file changed, 5 insertions(+)
fs/smbfs/dir.c +5 -1
@@ -434,6 +434,11 @@ smb_lookup(struct inode *dir, struct den
 	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;
+
 	lock_kernel();
 	error = smb_proc_getattr(dentry, &finfo);
 #ifdef SMBFS_PARANOIA
-

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/