Add protection against UDP inetd looping attacks

This patch adds protection against a common inetd attack vector wherein
the reply port to UDP inetd services is forged to an internal inetd
service port.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-07-18 17:27:37 +02:00
1 parent 5723b2e75b
commit 7dfdc2395b
8 files changed
+70 -6

No files matched your search

+5 -1
View File
@@ -27,6 +27,7 @@
#include "../plugin.h"
#define NAME "chargen"
#define PATTERN "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ "
static char *generator(char *buf, size_t len)
@@ -61,6 +62,9 @@ static int recv_peer(int sd, char *buf, ssize_t len, struct sockaddr *sa, sockle
if (-1 == len)
return -1; /* On error, close connection. */
if (inetd_check_loop(sa, *sa_len, NAME))
return -1;
return 0;
}
@@ -86,7 +90,7 @@ static int cb(int type)
}
static plugin_t plugin = {
.name = "chargen", /* Must match the inetd /etc/services entry */
.name = NAME, /* Must match the inetd /etc/services entry */
.inetd = {
.cmd = cb
},