Browse code

svn merge -r 734:737 $SO/trunk/openvpn Security fixes from 2.0.3

git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@740 e7ae566f-a301-0410-adde-c780ea21d3b5

james authored on 2005/10/31 12:49:25
Showing 6 changed files
... ...
@@ -5,6 +5,25 @@ $Id$
5 5
 
6 6
 2005.10.xx -- Version 2.1-beta5
7 7
 
8
+* Security fix -- Affects non-Windows OpenVPN clients of
9
+  version 2.0 or higher which connect to a malicious or
10
+  compromised server.  A format string vulnerability
11
+  in the foreign_option function in options.c could
12
+  potentially allow a malicious or compromised server
13
+  to execute arbitrary code on the client.  Only
14
+  non-Windows clients are affected.  The vulnerability
15
+  only exists if (a) the client's TLS negotiation with
16
+  the server succeeds, (b) the server is malicious or
17
+  has been compromised such that it is configured to
18
+  push a maliciously crafted options string to the client,
19
+  and (c) the client indicates its willingness to accept
20
+  pushed options from the server by having "pull" or
21
+  "client" in its configuration file.
22
+* Security fix -- Potential DoS vulnerability on the
23
+  server in TCP mode.  If the TCP server accept() call
24
+  returns an error status, the resulting exception handler
25
+  may attempt to indirect through a NULL pointer, causing
26
+  a segfault.  Affects all OpenVPN 2.0 versions.
8 27
 * Fix attempt of assertion at multi.c:1586 (note that
9 28
   this precise line number will vary across different
10 29
   versions of OpenVPN).
... ...
@@ -2682,7 +2682,7 @@ inherit_context_child (struct context *dest,
2682 2682
 #endif
2683 2683
 
2684 2684
   /* context init */
2685
-  init_instance (dest, src->c2.es, CC_USR1_TO_HUP | CC_GC_FREE);
2685
+  init_instance (dest, src->c2.es, CC_NO_CLOSE | CC_USR1_TO_HUP);
2686 2686
   if (IS_SIG (dest))
2687 2687
     return;
2688 2688
 
... ...
@@ -2756,6 +2756,9 @@ inherit_context_top (struct context *dest,
2756 2756
 void
2757 2757
 close_context (struct context *c, int sig, unsigned int flags)
2758 2758
 {
2759
+  ASSERT (c);
2760
+  ASSERT (c->sig);
2761
+
2759 2762
   if (sig >= 0)
2760 2763
     c->sig->signal_received = sig;
2761 2764
 
... ...
@@ -2766,7 +2769,8 @@ close_context (struct context *c, int sig, unsigned int flags)
2766 2766
 	c->sig->signal_received = SIGHUP;
2767 2767
     }
2768 2768
 
2769
-  close_instance (c);
2769
+  if (!(flags & CC_NO_CLOSE))
2770
+    close_instance (c);
2770 2771
 
2771 2772
   if (flags & CC_GC_FREE)
2772 2773
     context_gc_free (c);
... ...
@@ -94,6 +94,8 @@ void inherit_context_top (struct context *dest,
94 94
 #define CC_GC_FREE          (1<<0)
95 95
 #define CC_USR1_TO_HUP      (1<<1)
96 96
 #define CC_HARD_USR1_TO_HUP (1<<2)
97
+#define CC_NO_CLOSE         (1<<3)
98
+
97 99
 void close_context (struct context *c, int sig, unsigned int flags);
98 100
 
99 101
 struct context_buffers *init_context_buffers (const struct frame *frame);
... ...
@@ -577,10 +577,10 @@ multi_create_instance (struct multi_context *m, const struct mroute_addr *real)
577 577
       generate_prefix (mi);
578 578
     }
579 579
 
580
+  mi->did_open_context = true;
580 581
   inherit_context_child (&mi->context, &m->top);
581 582
   if (IS_SIG (&mi->context))
582 583
     goto err;
583
-  mi->did_open_context = true;
584 584
 
585 585
   mi->context.c2.context_auth = CAS_PENDING;
586 586
 
... ...
@@ -398,10 +398,11 @@ struct context_2
398 398
   in_addr_t push_ifconfig_remote_netmask;
399 399
 
400 400
   /* client authentication state */
401
-# define CAS_SUCCEEDED 0
402
-# define CAS_PENDING   1
403
-# define CAS_FAILED    2
404
-# define CAS_PARTIAL   3 /* at least one client-connect script/plugin
401
+# define CAS_UNDEF     0
402
+# define CAS_SUCCEEDED 1
403
+# define CAS_PENDING   2
404
+# define CAS_FAILED    3
405
+# define CAS_PARTIAL   4 /* at least one client-connect script/plugin
405 406
 			    succeeded while a later one in the chain failed */
406 407
   int context_auth;
407 408
 #endif
... ...
@@ -2274,7 +2274,7 @@ foreign_option (struct options *o, char *argv[], int len, struct env_set *es)
2274 2274
 	    {
2275 2275
 	      if (!first)
2276 2276
 		buf_printf (&value, " ");
2277
-	      buf_printf (&value, argv[i]);
2277
+	      buf_printf (&value, "%s", argv[i]);
2278 2278
 	      first = false;
2279 2279
 	    }
2280 2280
 	}