summaryrefslogtreecommitdiff
path: root/libcli/security
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-09-09 15:48:23 +0200
committerKarolin Seeger <kseeger@samba.org>2010-09-09 15:48:23 +0200
commitdf20a300758bc12286820e31fcf573bdfc2147bc (patch)
tree102df8225d4b95e554ca618004cae436b1442cbf /libcli/security
parent7f5159099bab7f9cd65d489f8a7577afe9aef032 (diff)
downloadsamba-df20a300758bc12286820e31fcf573bdfc2147bc.tar.gz
Fix bug #7669.
Fix bug #7669 (buffer overflow in sid_parse() in Samba3 and dom_sid_parse in Samba4). CVE-2010-3069: =========== Description =========== All current released versions of Samba are vulnerable to a buffer overrun vulnerability. The sid_parse() function (and related dom_sid_parse() function in the source4 code) do not correctly check their input lengths when reading a binary representation of a Windows SID (Security ID). This allows a malicious client to send a sid that can overflow the stack variable that is being used to store the SID in the Samba smbd server. A connection to a file share is needed to exploit this vulnerability, either authenticated or unauthenticated (guest connection).
Diffstat (limited to 'libcli/security')
-rw-r--r--libcli/security/dom_sid.c4
-rw-r--r--libcli/security/dom_sid.h4
2 files changed, 8 insertions, 0 deletions
diff --git a/libcli/security/dom_sid.c b/libcli/security/dom_sid.c
index 0c8890079af..350a14f311b 100644
--- a/libcli/security/dom_sid.c
+++ b/libcli/security/dom_sid.c
@@ -117,6 +117,10 @@ bool dom_sid_parse(const char *sidstr, struct dom_sid *ret)
if (sidstr[i] == '-') num_sub_auths++;
}
+ if (num_sub_auths > MAXSUBAUTHS) {
+ return false;
+ }
+
ret->sid_rev_num = rev;
ret->id_auth[0] = 0;
ret->id_auth[1] = 0;
diff --git a/libcli/security/dom_sid.h b/libcli/security/dom_sid.h
index e89253554e8..748e009117d 100644
--- a/libcli/security/dom_sid.h
+++ b/libcli/security/dom_sid.h
@@ -40,5 +40,9 @@ bool dom_sid_in_domain(const struct dom_sid *domain_sid,
const struct dom_sid *sid);
char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
+#ifndef MAXSUBAUTHS
+#define MAXSUBAUTHS 15 /* max sub authorities in a SID */
+#endif
+
#endif /*_DOM_SID_H_*/