lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4aaea1fa-94de-3342-c01e-f9b108c474f6@mojatatu.com>
Date: Mon, 3 Jul 2023 11:21:22 -0300
From: Pedro Tammela <pctammela@...atatu.com>
To: Lin Ma <linma@....edu.cn>, jhs@...atatu.com, xiyou.wangcong@...il.com,
 jiri@...nulli.us, davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
 pabeni@...hat.com, netdev@...r.kernel.org
Subject: Re: [PATCH v1] net/sched: act_pedit: Add size check for
 TCA_PEDIT_PARMS_EX

On 03/07/2023 08:08, Lin Ma wrote:
> The attribute TCA_PEDIT_PARMS_EX is not be included in pedit_policy and
> one malicious user could fake a TCA_PEDIT_PARMS_EX whose length is
> smaller than the intended sizeof(struct tc_pedit). Hence, the
> dereference in tcf_pedit_init() could access dirty heap data.
> 
> static int tcf_pedit_init(...)
> {
>    // ...
>    pattr = tb[TCA_PEDIT_PARMS]; // TCA_PEDIT_PARMS is included
>    if (!pattr)
>      pattr = tb[TCA_PEDIT_PARMS_EX]; // but this is not
> 
>    // ...
>    parm = nla_data(pattr);
> 
>    index = parm->index; // parm is able to be smaller than 4 bytes
>                         // and this dereference gets dirty skb_buff
>                         // data created in netlink_sendmsg
> }
> 
> This commit adds TCA_PEDIT_PARMS_EX length in pedit_policy which avoid
> the above case, just like the TCA_PEDIT_PARMS.
> 
> Fixes: 71d0ed7079df ("net/act_pedit: Support using offset relative to the conventional network headers")
> Signed-off-by: Lin Ma <linma@....edu.cn>

LGTM,

Reviewed-by: Pedro Tammela <pctammela@...atatu.com>

> ---
>   net/sched/act_pedit.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
> index b562fc2bb5b1..1ef8fcfa9997 100644
> --- a/net/sched/act_pedit.c
> +++ b/net/sched/act_pedit.c
> @@ -29,6 +29,7 @@ static struct tc_action_ops act_pedit_ops;
>   
>   static const struct nla_policy pedit_policy[TCA_PEDIT_MAX + 1] = {
>   	[TCA_PEDIT_PARMS]	= { .len = sizeof(struct tc_pedit) },
> +	[TCA_PEDIT_PARMS_EX]	= { .len = sizeof(struct tc_pedit) },
>   	[TCA_PEDIT_KEYS_EX]   = { .type = NLA_NESTED },
>   };
>   


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ