[SCM] Samba Shared Repository - branch v3-5-stable updated

Karolin Seeger kseeger at samba.org
Wed Jan 30 01:54:58 MST 2013


The branch, v3-5-stable has been updated
       via  f6b6d3b swat: Use additional nonce on XSRF protection
       via  e9cd100 swat: Use X-Frame-Options header to avoid clickjacking
       via  4f0de0f WHATSNEW: Prepare release notes for Samba 3.5.21.
      from  71dbced WHATSNEW: Start release notes for Samba 3.5.21.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-stable


- Log -----------------------------------------------------------------
commit f6b6d3bf9d43d45560d352b76c12fe0c87a16fa3
Author: Kai Blin <kai at samba.org>
Date:   Mon Jan 28 23:13:43 2013 +0100

    swat: Use additional nonce on XSRF protection
    
    If the user had a weak password on the root account of a machine running
    SWAT, there still was a chance of being targetted by an XSRF on a
    malicious web site targetting the SWAT setup.
    
    Use a random nonce stored in secrets.tdb to close this possible attack
    window. Thanks to Jann Horn for reporting this issue.
    
    Signed-off-by: Kai Blin <kai at samba.org>
    
    Fix bug #9577: CVE-2013-0214: Potential XSRF in SWAT.

commit e9cd10049e0b5c1e24e454cc3277eb4bea033dfb
Author: Kai Blin <kai at samba.org>
Date:   Fri Jan 18 23:11:07 2013 +0100

    swat: Use X-Frame-Options header to avoid clickjacking
    
    Jann Horn reported a potential clickjacking vulnerability in SWAT where
    the SWAT page could be embedded into an attacker's page using a frame or
    iframe and then used to trick the user to change Samba settings.
    
    Avoid this by telling the browser to refuse the frame embedding via the
    X-Frame-Options: DENY header.
    
    Signed-off-by: Kai Blin <kai at samba.org>
    
    Fix bug #9576 - CVE-2013-0213: Clickjacking issue in SWAT.

commit 4f0de0faf15e2c157ad88800a11648c181d82b65
Author: Karolin Seeger <kseeger at samba.org>
Date:   Tue Jan 29 10:49:29 2013 +0100

    WHATSNEW: Prepare release notes for Samba 3.5.21.
    
    This is a Security Release in order to address
    CVE-2013-0213 (Clickjacking issue in SWAT) and
    CVE-2013-0214 (Potential XSRF in SWAT).
    
    Karolin

-----------------------------------------------------------------------

Summary of changes:
 WHATSNEW.txt             |   37 +++++++++++++++++++++++++++++++------
 source3/web/cgi.c        |   39 ++++++++++++++++++++++++++-------------
 source3/web/swat.c       |    5 ++++-
 source3/web/swat_proto.h |    1 +
 4 files changed, 62 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index c96f46f..a7766a9 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,19 +1,44 @@
                    ==============================
                    Release Notes for Samba 3.5.21
-			 , 2013
+			 January 30, 2013
                    ==============================
 
 
-This is the latest stable release of Samba 3.5.
-
-Major enhancements in Samba 3.5.21 include:
-
-o  
-
-Changes since 3.5.19:
+This is a security release in order to address
+CVE-2013-0213 (Clickjacking issue in SWAT) and
+CVE-2013-0214 (Potential XSRF in SWAT).
+
+o  CVE-2013-0213:
+   All current released versions of Samba are vulnerable to clickjacking in the
+   Samba Web Administration Tool (SWAT). When the SWAT pages are integrated into
+   a malicious web page via a frame or iframe and then overlaid by other content,
+   an attacker could trick an administrator to potentially change Samba settings.
+
+   In order to be vulnerable, SWAT must have been installed and enabled
+   either as a standalone server launched from inetd or xinetd, or as a
+   CGI plugin to Apache. If SWAT has not been installed or enabled (which
+   is the default install state for Samba) this advisory can be ignored.
+
+o  CVE-2013-0214:
+   All current released versions of Samba are vulnerable to a cross-site
+   request forgery in the Samba Web Administration Tool (SWAT). By guessing a
+   user's password and then tricking a user who is authenticated with SWAT into
+   clicking a manipulated URL on a different web page, it is possible to manipulate
+   SWAT.
+
+   In order to be vulnerable, the attacker needs to know the victim's password.
+   Additionally SWAT must have been installed and enabled either as a standalone
+   server launched from inetd or xinetd, or as a CGI plugin to Apache. If SWAT has
+   not been installed or enabled (which is the default install state for Samba)
+   this advisory can be ignored.
+
+
+Changes since 3.5.20:
 ---------------------
 
-o   Jeremy Allison <jra at samba.org>
+o   Kai Blin <kai at samba.org>
+    * BUG 9576: CVE-2013-0213: Fix clickjacking issue in SWAT.
+    * BUG 9577: CVE-2013-0214: Fix potential XSRF in SWAT.
 
 
 ######################################################################
diff --git a/source3/web/cgi.c b/source3/web/cgi.c
index 0c8e9cb..afa2e63 100644
--- a/source3/web/cgi.c
+++ b/source3/web/cgi.c
@@ -45,6 +45,7 @@ static const char *baseurl;
 static char *pathinfo;
 static char *C_user;
 static char *C_pass;
+static char *C_nonce;
 static bool inetd_server;
 static bool got_request;
 
@@ -326,19 +327,7 @@ static void cgi_web_auth(void)
 	C_user = SMB_STRDUP(user);
 
 	if (!setuid(0)) {
-		C_pass = secrets_fetch_generic("root", "SWAT");
-		if (C_pass == NULL) {
-			char *tmp_pass = NULL;
-			tmp_pass = generate_random_str(talloc_tos(), 16);
-			if (tmp_pass == NULL) {
-				printf("%sFailed to create random nonce for "
-				       "SWAT session\n<br>%s\n", head, tail);
-				exit(0);
-			}
-			secrets_store_generic("root", "SWAT", tmp_pass);
-			C_pass = SMB_STRDUP(tmp_pass);
-			TALLOC_FREE(tmp_pass);
-		}
+		C_pass = SMB_STRDUP(cgi_nonce());
 	}
 	setuid(pwd->pw_uid);
 	if (geteuid() != pwd->pw_uid || getuid() != pwd->pw_uid) {
@@ -451,6 +440,30 @@ char *cgi_user_pass(void)
 }
 
 /***************************************************************************
+return a ptr to the nonce
+  ***************************************************************************/
+char *cgi_nonce(void)
+{
+	const char *head = "Content-Type: text/html\r\n\r\n<HTML><BODY><H1>SWAT installation Error</H1>\n";
+	const char *tail = "</BODY></HTML>\r\n";
+	C_nonce = secrets_fetch_generic("root", "SWAT");
+	if (C_nonce == NULL) {
+		char *tmp_pass = NULL;
+		tmp_pass = generate_random_str(talloc_tos(), 16);
+		if (tmp_pass == NULL) {
+			printf("%sFailed to create random nonce for "
+			       "SWAT session\n<br>%s\n", head, tail);
+			exit(0);
+		}
+		secrets_store_generic("root", "SWAT", tmp_pass);
+		C_nonce = SMB_STRDUP(tmp_pass);
+		TALLOC_FREE(tmp_pass);
+	}
+	return(C_nonce);
+}
+
+
+/***************************************************************************
 handle a file download
   ***************************************************************************/
 static void cgi_download(char *file)
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 754e3ce..25a041f 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -148,6 +148,7 @@ void get_xsrf_token(const char *username, const char *pass,
 	struct MD5Context md5_ctx;
 	uint8_t token[16];
 	int i;
+	char *nonce = cgi_nonce();
 
 	token_str[0] = '\0';
 	ZERO_STRUCT(md5_ctx);
@@ -161,6 +162,7 @@ void get_xsrf_token(const char *username, const char *pass,
 	if (pass != NULL) {
 		MD5Update(&md5_ctx, (uint8_t *)pass, strlen(pass));
 	}
+	MD5Update(&md5_ctx, (uint8_t *)nonce, strlen(nonce));
 
 	MD5Final(token, &md5_ctx);
 
@@ -260,7 +262,8 @@ static void print_header(void)
 	if (!cgi_waspost()) {
 		printf("Expires: 0\r\n");
 	}
-	printf("Content-type: text/html\r\n\r\n");
+	printf("Content-type: text/html\r\n");
+	printf("X-Frame-Options: DENY\r\n\r\n");
 
 	if (!include_html("include/header.html")) {
 		printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
diff --git a/source3/web/swat_proto.h b/source3/web/swat_proto.h
index 424a3af..fe51b1f 100644
--- a/source3/web/swat_proto.h
+++ b/source3/web/swat_proto.h
@@ -32,6 +32,7 @@ const char *cgi_variable_nonull(const char *name);
 bool am_root(void);
 char *cgi_user_name(void);
 char *cgi_user_pass(void);
+char *cgi_nonce(void);
 void cgi_setup(const char *rootdir, int auth_required);
 const char *cgi_baseurl(void);
 const char *cgi_pathinfo(void);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list