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: <CAPhsuW7f4KoL59OYMOH6vCvzAiQkwSnr-Qph+75cAa=dv3vCGg@mail.gmail.com>
Date:   Tue, 4 Dec 2018 15:17:37 -0800
From:   Song Liu <liu.song.a23@...il.com>
To:     Stanislav Fomichev <sdf@...gle.com>
Cc:     Networking <netdev@...r.kernel.org>,
        "David S . Miller" <davem@...emloft.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        simon.horman@...ronome.com
Subject: Re: [PATCH bpf-next v2 4/5] net/flow_dissector: correctly cap nhoff
 and thoff in case of BPF

On Mon, Dec 3, 2018 at 8:01 PM Stanislav Fomichev <sdf@...gle.com> wrote:
>
> We want to make sure that the following condition holds:
> 0 <= nhoff <= thoff <= skb->len
>
> BPF program can set out-of-bounds nhoff and thoff, which is dangerous, see
> recent commit d0c081b49137 ("flow_dissector: properly cap thoff field")'.
>
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> ---
>  net/core/flow_dissector.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index ac19da6f390b..bb1a54747d64 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -716,6 +716,10 @@ bool __skb_flow_bpf_dissect(struct bpf_prog *prog,
>         /* Restore state */
>         memcpy(cb, &cb_saved, sizeof(cb_saved));
>
> +       flow_keys->nhoff = clamp_t(u16, flow_keys->nhoff, 0, skb->len);
> +       flow_keys->thoff = clamp_t(u16, flow_keys->thoff,
> +                                  flow_keys->nhoff, skb->len);
> +
>         return result == BPF_OK;
>  }
>
> @@ -808,8 +812,6 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
>                                                      &flow_keys);
>                         __skb_flow_bpf_to_target(&flow_keys, flow_dissector,
>                                                  target_container);
> -                       key_control->thoff = min_t(u16, key_control->thoff,
> -                                                  skb->len);
>                         rcu_read_unlock();
>                         return ret;
>                 }
> --
> 2.20.0.rc1.387.gf8505762e3-goog
>

Same question as 3/5:

Do we need this fix without this set? If yes, do we need it for bpf
tree as well?

Thanks,
Song

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ