netfilter: cttimeout: fix buffer overflow
Subsystems (3)
Florian Westphal
maintainerPATCH 1/1 netfilter: cttimeout: fix buffer overflow
Chen Gang reports:
the length of nla_data(cda[CTA_TIMEOUT_NAME]) is not limited in server side.
And indeed, its used to strcpy to a fixed-sized buffer.
Fortunately, nfnetlink users need CAP_NET_ADMIN.
Reported-by Chen Gang <[email protected]>
Signed-off-by Florian Westphal <[email protected]>
--- net/netfilter/nfnetlink_cttimeout.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/netfilter/nfnetlink_cttimeout.c +2 -1
@@ -41,7 +41,8 @@ MODULE_DESCRIPTION("cttimeout: Extended Netfilter Connection Tracking timeout tustatic LIST_HEAD (cttimeout_list);static const struct nla_policy cttimeout_nla_policy[CTA_TIMEOUT_MAX +1 ] = { - [CTA_TIMEOUT_NAME ] = { .type =NLA_NUL_STRING }, + [CTA_TIMEOUT_NAME ] = { .type =NLA_NUL_STRING , + .len =CTNL_TIMEOUT_NAME_MAX -1 }, [CTA_TIMEOUT_L3PROTO ] = { .type =NLA_U16 }, [CTA_TIMEOUT_L4PROTO ] = { .type =NLA_U8 }, [CTA_TIMEOUT_DATA ] = { .type =NLA_NESTED },
Signature · 1 line
1.7.8.6
Pablo Neira Ayuso
maintainerQuoted 6 lines · Florian Westphal
Chen Gang reports:
the length ofnla_data(cda[CTA_TIMEOUT_NAME])is not limited in server side.And indeed, its used to strcpy to a fixed-sized buffer.
Fortunately, nfnetlink users need
CAP_NET_ADMIN.
Good catch, applied thanks.