public inbox for cip-dev@lists.cip-project.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Masami Ichikawa <masami.ichikawa@miraclelinux.com>
Cc: cip-dev <cip-dev@lists.cip-project.org>
Subject: Re: New CVE entries this week
Date: Wed, 1 Feb 2023 11:09:33 +0300	[thread overview]
Message-ID: <Y9oePa50jnpgnutu@kili> (raw)
In-Reply-To: <CAODzB9phGdgNo0dOTHLyovXP7Gcj9EgR1QDHHaNrAXhBxrHQzg@mail.gmail.com>

[ Still going through old stuff from the holiday season ]

On Thu, Dec 22, 2022 at 07:58:48AM +0900, Masami Ichikawa wrote:
> CVE-2022-47518: wifi: wilc1000: validate number of channels
> 
> CVSS v3 score is not provided
> 
> An issue was discovered in the Linux kernel before 6.0.11. Missing
> validation of the number of channels in
> drivers/net/wireless/microchip/wilc1000/cfg80211.c in the WILC1000
> wireless driver can trigger a heap-based buffer overflow when copying
> the list of operating channels from Wi-Fi management frames.
> 
> It looks like a vulnerable function is not present on 4.4 and 4.9.
> That function is present in 5.4 and 4.19 however, this driver is
> staging driver at that time.
> Also, implementation of wilc_wfi_cfg_parse_ch_attr() in 5.4 and 4.19
> are different from newer code. It seems as if they are not affected.
> 
> Fixed status
> mainline: [0cdfa9e6f0915e3d243e2393bfa8a22e12d553b0]
> stable/5.10: [3eb6b89a4e9f9e44c3170d70d8d16c3c8dc8c800]
> stable/5.15: [7aed1dd5d221dabe3fe258f13ecf5fc7df393cbb]
> stable/6.0: [6195b4838e10a557859862c4e7840dc0eafdd1cd]
> 
> CVE-2022-47519: wifi: wilc1000: validate length of
> IEEE80211_P2P_ATTR_OPER_CHANNEL attribute

This is probably something which could have been caught with static
analysis.  The first problem was that cfg80211_find_vendor_ie() takes
a struct and casts it to a char *.  Smatch correctly marks some of the
struct members as user data, but loses that information when the cast
happens.

It is easy to hard code cfg80211_find_vendor_ie() as returning user data
so we avoid this bug in the future.

diff --git a/smatch_points_to_user_data.c b/smatch_points_to_user_data.c
index 4267b85b53a7..f632d8c84452 100644
--- a/smatch_points_to_user_data.c
+++ b/smatch_points_to_user_data.c
@@ -49,7 +49,7 @@ STATE(user_data_set);
 static const char *returns_pointer_to_user_data[] = {
 	"nlmsg_data", "nla_data", "memdup_user", "kmap_atomic", "skb_network_header",
 	"cfg80211_find_elem_match", "ieee80211_bss_get_elem", "cfg80211_find_elem",
-	"ieee80211_bss_get_ie",
+	"ieee80211_bss_get_ie", "cfg80211_find_vendor_ie",
 };
 
 bool is_skb_data(struct expression *expr)

Then from there, I actually have an unpublished static checker warning
which would have triggered.

drivers/net/wireless/microchip/wilc1000/cfg80211.c:991 wilc_wfi_cfg_parse_ch_attr() warn: uncapped user loop: 'attr_size'

Currently it prints 178 warnings.  It warns for things like:

        for (i = 0; i < user_controlled_value; i++)

But it's kind of useless.  There are too many times where the loop is
uncapped but it doesn't result in an out of bounds access.  For example,
the user_controlled_value could be number of seconds instead of array
offsets.  I need to add to the check and cut down on the false
positives.  I will do that today.

Update on my employment situation:  I have been lazy about looking for
Smatch funding.  But a lot of the things I'm looking at are a
subscription model where people get the warnings instead of the source
code.  These emails are intended to help the Kernel security community
to understand better how to continue the work after I have moved on.
Please email me if you have questions, because right now I have time and
I want to help people take on this work.

regards,
dan carpenter


  reply	other threads:[~2023-02-01 13:04 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 22:58 New CVE entries this week Masami Ichikawa
2023-02-01  8:09 ` Dan Carpenter [this message]
2023-02-01 13:59   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2023-09-13 22:34 Masami Ichikawa
2023-09-06 23:22 Masami Ichikawa
2023-08-30 23:08 Masami Ichikawa
2023-08-23 22:47 Masami Ichikawa
2023-08-16 23:04 Masami Ichikawa
2023-08-10  0:04 Masami Ichikawa
2023-08-02 23:38 Masami Ichikawa
2023-07-26 23:15 Masami Ichikawa
2023-07-20  0:25 Masami Ichikawa
2023-07-12 23:24 Masami Ichikawa
2023-07-06  0:35 Masami Ichikawa
2023-06-29  0:26 Masami Ichikawa
2023-06-21 23:07 Masami Ichikawa
2023-06-14 22:43 Masami Ichikawa
2023-06-07 22:19 Masami Ichikawa
2023-05-31 23:54 Masami Ichikawa
2023-05-24 22:50 Masami Ichikawa
2023-05-17 23:10 Masami Ichikawa
2023-05-10 23:47 Masami Ichikawa
2023-05-03 22:53 Masami Ichikawa
2023-04-26 23:10 Masami Ichikawa
2023-04-19 23:49 Masami Ichikawa
2023-04-13  0:19 Masami Ichikawa
2023-04-06  0:19 Masami Ichikawa
2023-03-29 23:52 Masami Ichikawa
2023-03-22 23:10 Masami Ichikawa
2023-03-16  0:03 Masami Ichikawa
2023-03-08 23:53 Masami Ichikawa
2023-03-02  1:40 Masami Ichikawa
2023-02-22 23:33 Masami Ichikawa
2023-02-15 23:19 Masami Ichikawa
2023-02-08 23:44 Masami Ichikawa
2023-02-02  0:55 Masami Ichikawa
2023-01-25 23:59 Masami Ichikawa
2023-01-19  0:14 Masami Ichikawa
2023-03-03 14:08 ` Dan Carpenter
2023-01-12  0:21 Masami Ichikawa
2023-01-05  1:04 Masami Ichikawa
2022-12-29  0:00 Masami Ichikawa
2022-12-15  3:25 Masami Ichikawa
2023-01-19  7:51 ` Dan Carpenter
2023-01-19 13:56   ` Masami Ichikawa
2023-01-19 15:24     ` Dan Carpenter
2022-12-07 23:25 Masami Ichikawa
2022-11-30 23:26 Masami Ichikawa
2022-11-24  1:24 Masami Ichikawa
2022-11-17  0:11 Masami Ichikawa
2022-11-09 23:02 Masami Ichikawa
2022-11-02 23:20 Masami Ichikawa
2022-10-27  0:55 Masami Ichikawa
2022-10-20  0:48 Masami Ichikawa
2022-10-12 23:43 Masami Ichikawa
2022-10-05 23:53 Masami Ichikawa
2022-09-28 23:42 Masami Ichikawa
2022-09-22  0:06 Masami Ichikawa
2022-09-14 23:53 Masami Ichikawa
2022-09-07 23:07 Masami Ichikawa
2022-09-01  0:12 Masami Ichikawa
2022-08-25  1:18 Masami Ichikawa
2022-08-17 23:23 Masami Ichikawa
2022-08-10 23:20 Masami Ichikawa
2022-08-04  0:29 Masami Ichikawa
2022-07-27 23:45 Masami Ichikawa
2022-07-21  0:01 Masami Ichikawa
2022-07-14  0:54 Masami Ichikawa
2022-07-06 23:21 Masami Ichikawa
2022-06-29 22:50 Masami Ichikawa
2022-06-22 23:47 Masami Ichikawa
2022-06-15 23:44 Masami Ichikawa
2022-06-08 23:44 Masami Ichikawa
2022-06-02  0:14 Masami Ichikawa
2022-05-25 23:12 Masami Ichikawa
2022-05-19  0:21 Masami Ichikawa
2022-05-12  0:15 Masami Ichikawa
2022-05-04 22:53 Masami Ichikawa
2022-04-27 23:03 Masami Ichikawa
2022-04-21  0:00 Masami Ichikawa
2022-04-14  0:10 Masami Ichikawa
2022-04-06 23:50 Masami Ichikawa
2022-03-30 23:22 Masami Ichikawa
2022-03-24  0:42 Masami Ichikawa
2022-03-16 23:34 Masami Ichikawa
2022-03-09 23:55 Masami Ichikawa
2022-03-02 23:50 Masami Ichikawa
2022-02-23 23:41 Masami Ichikawa
2022-02-17  0:09 Masami Ichikawa
2022-02-10  1:35 Masami Ichikawa
2022-02-03  0:28 Masami Ichikawa
2022-01-05 23:31 Masami Ichikawa
2021-10-28  0:05 Masami Ichikawa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y9oePa50jnpgnutu@kili \
    --to=error27@gmail.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=masami.ichikawa@miraclelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox