Potential DoS against smbd in Samba 3.0.6 - 3.0.23d

2007.02.07
Risk: Low
Local: No
Remote: Yes
CWE: CWE-Other


CVSS Base Score: 6.8/10
Impact Subscore: 6.9/10
Exploitability Subscore: 8/10
Exploit range: Remote
Attack complexity: Low
Authentication: Single time
Confidentiality impact: None
Integrity impact: None
Availability impact: Complete

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 ========================================================== == == Subject: Potential Denial of Service bug in smbd == CVE ID#: CVE-2007-0452 == == Versions: Samba 3.0.6 - 3.0.23d (inclusive) == == Summary: A logic error in the deferred open code == can lead to an infinite loop in smbd == ========================================================== =========== Description =========== Internally Samba's file server daemon, smbd, implements support for deferred file open calls in an attempt to serve client requests that would otherwise fail due to a share mode violation. When renaming a file under certain circumstances it is possible that the request is never removed from the deferred open queue. smbd will then become stuck is a loop trying to service the open request. This bug may allow an authenticated user to exhaust resources such as memory and CPU on the server by opening multiple CIFS sessions, each of which will normally spawn a new smbd process, and sending each connection into an infinite loop. ================== Patch Availability ================== A patch against Samba 3.0.23d has been attached to this email. This fix has be incorporated into the Samba 3.0.24 release. Patches are also available from at the Samba Security page (http://www.samba.org/samba/security). ========== Workaround ========== The bug is believed to be exploitable only by an authenticated user. The server's exposure can be alleviated by disabling any suspect or hostile user accounts. ======= Credits ======= This vulnerability was found during internal regression testing by Samba developers. ========================================================== == Our Code, Our Bugs, Our Responsibility. == The Samba Team ========================================================== -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFxzBfIR7qMdg1EfYRAgpMAKCBiRQFeyl598Bf2V7WPxOEVZjQRQCgtQh7 ualQZpxcejQhlaYVxbKVpqg= =V048 -----END PGP SIGNATURE----- diff -urN samba-3.0.23d/source/printing/nt_printing.c samba/source/printing/nt_printing.c --- samba-3.0.23d/source/printing/nt_printing.c 2006-07-10 11:27:50.000000000 -0500 +++ samba/source/printing/nt_printing.c 2007-01-30 15:00:45.000000000 -0600 @@ -4839,7 +4839,7 @@ pstrcpy( file, s ); driver_unix_convert(file, conn, NULL, &bad_path, &st); DEBUG(10,("deleting driverfile [%s]n", s)); - unlink_internals(conn, 0, file, False); + unlink_internals(conn, 0, file, False, False); } } @@ -4848,7 +4848,7 @@ pstrcpy( file, s ); driver_unix_convert(file, conn, NULL, &bad_path, &st); DEBUG(10,("deleting configfile [%s]n", s)); - unlink_internals(conn, 0, file, False); + unlink_internals(conn, 0, file, False, False); } } @@ -4857,7 +4857,7 @@ pstrcpy( file, s ); driver_unix_convert(file, conn, NULL, &bad_path, &st); DEBUG(10,("deleting datafile [%s]n", s)); - unlink_internals(conn, 0, file, False); + unlink_internals(conn, 0, file, False, False); } } @@ -4866,7 +4866,7 @@ pstrcpy( file, s ); driver_unix_convert(file, conn, NULL, &bad_path, &st); DEBUG(10,("deleting helpfile [%s]n", s)); - unlink_internals(conn, 0, file, False); + unlink_internals(conn, 0, file, False, False); } } @@ -4882,7 +4882,7 @@ pstrcpy( file, p ); driver_unix_convert(file, conn, NULL, &bad_path, &st); DEBUG(10,("deleting dependent file [%s]n", file)); - unlink_internals(conn, 0, file, False); + unlink_internals(conn, 0, file, False, False); } i++; diff -urN samba-3.0.23d/source/smbd/nttrans.c samba/source/smbd/nttrans.c --- samba-3.0.23d/source/smbd/nttrans.c 2006-06-23 08:16:49.000000000 -0500 +++ samba/source/smbd/nttrans.c 2007-01-30 15:00:45.000000000 -0600 @@ -664,7 +664,7 @@ if (lp_acl_check_permissions(SNUM(conn)) && (share_access & FILE_SHARE_DELETE) && (access_mask & DELETE_ACCESS)) { #endif - status = can_delete(conn, fname, file_attributes, bad_path, True); + status = can_delete(conn, fname, file_attributes, bad_path, True, False); /* We're only going to fail here if it's access denied, as that's the only error we care about for "can we delete this ?" questions. */ if (!NT_STATUS_IS_OK(status) && (NT_STATUS_EQUAL(status,NT_STATUS_ACCESS_DENIED) || @@ -1281,7 +1281,7 @@ /* Setting FILE_SHARE_DELETE is the hint. */ if (lp_acl_check_permissions(SNUM(conn)) && (share_access & FILE_SHARE_DELETE) && (access_mask & DELETE_ACCESS)) { #endif - status = can_delete(conn, fname, file_attributes, bad_path, True); + status = can_delete(conn, fname, file_attributes, bad_path, True, False); /* We're only going to fail here if it's access denied, as that's the only error we care about for "can we delete this ?" questions. */ if (!NT_STATUS_IS_OK(status) && (NT_STATUS_EQUAL(status,NT_STATUS_ACCESS_DENIED) || @@ -1888,8 +1888,14 @@ status = rename_internals(conn, fsp->fsp_name, new_name, 0, replace_if_exists, path_contains_wcard); - if (!NT_STATUS_IS_OK(status)) + + if (!NT_STATUS_IS_OK(status)) { + if (open_was_deferred(SVAL(inbuf,smb_mid))) { + /* We have re-scheduled this call. */ + return -1; + } return ERROR_NT(status); + } /* * Rename was successful. diff -urN samba-3.0.23d/source/smbd/reply.c samba/source/smbd/reply.c --- samba-3.0.23d/source/smbd/reply.c 2006-06-23 08:16:49.000000000 -0500 +++ samba/source/smbd/reply.c 2007-01-30 15:00:45.000000000 -0600 @@ -1865,7 +1865,7 @@ Check if a user is allowed to delete a file. ********************************************************************/ -NTSTATUS can_delete(connection_struct *conn, char *fname, uint32 dirtype, BOOL bad_path, BOOL check_is_at_open) +NTSTATUS can_delete(connection_struct *conn, char *fname, uint32 dirtype, BOOL bad_path, BOOL check_is_at_open, BOOL can_defer) { SMB_STRUCT_STAT sbuf; uint32 fattr; @@ -1938,7 +1938,7 @@ FILE_OPEN, 0, FILE_ATTRIBUTE_NORMAL, - 0, + can_defer ? 0 : INTERNAL_OPEN_ONLY, NULL); if (!fsp) { @@ -1960,7 +1960,7 @@ code. ************************************************************************ ****/ -NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, char *name, BOOL has_wild) +NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, char *name, BOOL has_wild, BOOL can_defer) { pstring directory; pstring mask; @@ -2000,7 +2000,7 @@ if (!has_wild) { pstrcat(directory,"/"); pstrcat(directory,mask); - error = can_delete(conn,directory,dirtype,bad_path,False); + error = can_delete(conn,directory,dirtype,bad_path,False,can_defer); if (!NT_STATUS_IS_OK(error)) return error; @@ -2058,7 +2058,7 @@ } slprintf(fname,sizeof(fname)-1, "%s/%s",directory,dname); - error = can_delete(conn,fname,dirtype,bad_path,False); + error = can_delete(conn,fname,dirtype,bad_path,False,False); if (!NT_STATUS_IS_OK(error)) { continue; } @@ -2104,7 +2104,7 @@ DEBUG(3,("reply_unlink : %sn",name)); - status = unlink_internals(conn, dirtype, name, path_contains_wcard); + status = unlink_internals(conn, dirtype, name, path_contains_wcard, True); if (!NT_STATUS_IS_OK(status)) { if (open_was_deferred(SVAL(inbuf,smb_mid))) { /* We have re-scheduled this call. */ diff -urN samba-3.0.23d/source/smbd/trans2.c samba/source/smbd/trans2.c --- samba-3.0.23d/source/smbd/trans2.c 2006-11-14 08:42:12.000000000 -0600 +++ samba/source/smbd/trans2.c 2007-01-30 15:00:35.000000000 -0600 @@ -4446,9 +4446,15 @@ fname, newname )); status = rename_internals(conn, fname, base_name, 0, overwrite, False); } + if (!NT_STATUS_IS_OK(status)) { + if (open_was_deferred(SVAL(inbuf,smb_mid))) { + /* We have re-scheduled this call. */ + return -1; + } return ERROR_NT(status); } + process_pending_change_notify_queue((time_t)0); SSVAL(params,0,0); send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0); -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iD8DBQBFv7OdIR7qMdg1EfYRAvqJAKDxefpzTjYvJWyHB0D/7hZ+tx417QCfaD9k G+tjNn+wuqQeRDWcvuCcbY0= =I+1e -----END PGP SIGNATURE-----


Vote for this issue:
50%
50%


 

Thanks for you vote!


 

Thanks for you comment!
Your message is in quarantine 48 hours.

Comment it here.


(*) - required fields.  
{{ x.nick }} | Date: {{ x.ux * 1000 | date:'yyyy-MM-dd' }} {{ x.ux * 1000 | date:'HH:mm' }} CET+1
{{ x.comment }}

Copyright 2019, cxsecurity.com

 

Back to Top