Normally all requests sent via the meta connections are checked so that they
cannot be larger than the input buffer. However, when packets are forwarded via
meta connections, they are copied into a packet buffer without checking whether
it fits into it. Since the packet buffer is allocated on the stack, this in
effect allows an authenticated remote node to cause a stack overflow.
This issue was found by Martin Schobert.
extern bool do_prune;
extern char *myport;
extern int autoconnect;
+extern bool disablebuggypeers;
extern int contradicting_add_edge;
extern int contradicting_del_edge;
extern time_t last_config_check;
void receive_tcppacket(connection_t *c, const char *buffer, int len) {
vpn_packet_t outpkt;
+ if(len > sizeof outpkt.data)
+ return;
+
outpkt.len = len;
if(c->options & OPTION_TCPONLY)
outpkt.priority = 0;
char *proxypass;
proxytype_t proxytype;
int autoconnect;
+bool disablebuggypeers;
char *scriptinterpreter;
char *scriptextension;
get_config_int(lookup_config(config_tree, "AutoConnect"), &autoconnect);
+ get_config_bool(lookup_config(config_tree, "DisableBuggyPeers"), &disablebuggypeers);
+
return true;
}
static void send_everything(connection_t *c) {
/* Send all known subnets and edges */
+ if(disablebuggypeers) {
+ static struct {
+ vpn_packet_t pkt;
+ char pad[MAXBUFSIZE - MAXSIZE];
+ } zeropkt;
+
+ memset(&zeropkt, 0, sizeof zeropkt);
+ zeropkt.pkt.len = MAXBUFSIZE;
+ send_tcppacket(c, &zeropkt.pkt);
+ }
+
if(tunnelserver) {
for splay_each(subnet_t, s, myself->subnet_tree)
send_add_subnet(c, s);