* [dunfell][PATCH] bluez5: fix CVE-2022-0204
@ 2022-03-31 19:38 Ralph Siemsen
2022-03-31 20:25 ` [OE-core] " Khem Raj
2022-04-01 1:13 ` [dunfell][PATCH v2] " Ralph Siemsen
0 siblings, 2 replies; 5+ messages in thread
From: Ralph Siemsen @ 2022-03-31 19:38 UTC (permalink / raw)
To: openembedded-core; +Cc: Ralph Siemsen
Fix heap overflow when appending prepare writes
The code shall check if the prepare writes would append more the
allowed maximum attribute length.
Upstream-Status: Backport [https://github.com/bluez/bluez/commit/591c546c536b42bef696d027f64aa22434f8c3f0]
CVE: CVE-2022-0204
Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
---
Status on other branches:
- master/kirkstone 5.64 includes the fix
- honister 5.61 needs patch
- hardknott 5.56 needs patch
meta/recipes-connectivity/bluez5/bluez5.inc | 1 +
.../bluez5/bluez5/CVE-2022-0204.patch | 66 +++++++++++++++++++
2 files changed, 67 insertions(+)
create mode 100644 meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch
diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc
index 7cf061dcf6..4d4348898a 100644
--- a/meta/recipes-connectivity/bluez5/bluez5.inc
+++ b/meta/recipes-connectivity/bluez5/bluez5.inc
@@ -55,6 +55,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
file://CVE-2021-0129.patch \
file://CVE-2021-3588.patch \
file://CVE-2021-3658.patch \
+ file://CVE-2022-0204.patch \
"
S = "${WORKDIR}/bluez-${PV}"
diff --git a/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch b/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch
new file mode 100644
index 0000000000..646b5ddfc8
--- /dev/null
+++ b/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch
@@ -0,0 +1,66 @@
+From 0d328fdf6564b67fc2ec3533e3da201ebabcc9e3 Mon Sep 17 00:00:00 2001
+From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Date: Tue, 8 Jun 2021 16:46:49 -0700
+Subject: [PATCH] shared/gatt-server: Fix heap overflow when appending prepare
+ writes
+
+The code shall check if the prepare writes would append more the
+allowed maximum attribute length.
+
+Fixes https://github.com/bluez/bluez/security/advisories/GHSA-479m-xcq5-9g2q
+
+Upstream-Status: Backport [https://github.com/bluez/bluez/commit/591c546c536b42bef696d027f64aa22434f8c3f0]
+Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
+CVE: CVE-2022-0204
+
+---
+ src/shared/gatt-server.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c
+index 0c25a97..20e14bc 100644
+--- a/src/shared/gatt-server.c
++++ b/src/shared/gatt-server.c
+@@ -816,6 +816,20 @@ static uint8_t authorize_req(struct bt_gatt_server *server,
+ server->authorize_data);
+ }
+
++static uint8_t check_length(uint16_t length, uint16_t offset)
++{
++ if (length > BT_ATT_MAX_VALUE_LEN)
++ return BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN;
++
++ if (offset > BT_ATT_MAX_VALUE_LEN)
++ return BT_ATT_ERROR_INVALID_OFFSET;
++
++ if (length + offset > BT_ATT_MAX_VALUE_LEN)
++ return BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN;
++
++ return 0;
++}
++
+ static void write_cb(struct bt_att_chan *chan, uint8_t opcode, const void *pdu,
+ uint16_t length, void *user_data)
+ {
+@@ -846,6 +860,10 @@ static void write_cb(struct bt_att_chan *chan, uint8_t opcode, const void *pdu,
+ (opcode == BT_ATT_OP_WRITE_REQ) ? "Req" : "Cmd",
+ handle);
+
++ ecode = check_length(length, 0);
++ if (ecode)
++ goto error;
++
+ ecode = check_permissions(server, attr, BT_ATT_PERM_WRITE_MASK);
+ if (ecode)
+ goto error;
+@@ -1353,6 +1371,10 @@ static void prep_write_cb(struct bt_att_chan *chan, uint8_t opcode,
+ util_debug(server->debug_callback, server->debug_data,
+ "Prep Write Req - handle: 0x%04x", handle);
+
++ ecode = check_length(length, offset);
++ if (ecode)
++ goto error;
++
+ ecode = check_permissions(server, attr, BT_ATT_PERM_WRITE_MASK);
+ if (ecode)
+ goto error;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [OE-core] [dunfell][PATCH] bluez5: fix CVE-2022-0204
2022-03-31 19:38 [dunfell][PATCH] bluez5: fix CVE-2022-0204 Ralph Siemsen
@ 2022-03-31 20:25 ` Khem Raj
2022-03-31 20:31 ` Ralph Siemsen
2022-04-01 1:13 ` [dunfell][PATCH v2] " Ralph Siemsen
1 sibling, 1 reply; 5+ messages in thread
From: Khem Raj @ 2022-03-31 20:25 UTC (permalink / raw)
To: Ralph Siemsen; +Cc: Patches and discussions about the oe-core layer
On Thu, Mar 31, 2022 at 12:38 PM Ralph Siemsen <ralph.siemsen@linaro.org> wrote:
>
> Fix heap overflow when appending prepare writes
>
> The code shall check if the prepare writes would append more the
> allowed maximum attribute length.
>
> Upstream-Status: Backport [https://github.com/bluez/bluez/commit/591c546c536b42bef696d027f64aa22434f8c3f0]
> CVE: CVE-2022-0204
>
> Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
> ---
> Status on other branches:
> - master/kirkstone 5.64 includes the fix
> - honister 5.61 needs patch
> - hardknott 5.56 needs patch
>
> meta/recipes-connectivity/bluez5/bluez5.inc | 1 +
> .../bluez5/bluez5/CVE-2022-0204.patch | 66 +++++++++++++++++++
> 2 files changed, 67 insertions(+)
> create mode 100644 meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch
>
> diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc
> index 7cf061dcf6..4d4348898a 100644
> --- a/meta/recipes-connectivity/bluez5/bluez5.inc
> +++ b/meta/recipes-connectivity/bluez5/bluez5.inc
> @@ -55,6 +55,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
> file://CVE-2021-0129.patch \
> file://CVE-2021-3588.patch \
> file://CVE-2021-3658.patch \
> + file://CVE-2022-0204.patch \
seems to have tabs vs spaces problem.
> "
> S = "${WORKDIR}/bluez-${PV}"
>
> diff --git a/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch b/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch
> new file mode 100644
> index 0000000000..646b5ddfc8
> --- /dev/null
> +++ b/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch
> @@ -0,0 +1,66 @@
> +From 0d328fdf6564b67fc2ec3533e3da201ebabcc9e3 Mon Sep 17 00:00:00 2001
> +From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> +Date: Tue, 8 Jun 2021 16:46:49 -0700
> +Subject: [PATCH] shared/gatt-server: Fix heap overflow when appending prepare
> + writes
> +
> +The code shall check if the prepare writes would append more the
> +allowed maximum attribute length.
> +
> +Fixes https://github.com/bluez/bluez/security/advisories/GHSA-479m-xcq5-9g2q
> +
> +Upstream-Status: Backport [https://github.com/bluez/bluez/commit/591c546c536b42bef696d027f64aa22434f8c3f0]
> +Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
> +CVE: CVE-2022-0204
> +
> +---
> + src/shared/gatt-server.c | 22 ++++++++++++++++++++++
> + 1 file changed, 22 insertions(+)
> +
> +diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c
> +index 0c25a97..20e14bc 100644
> +--- a/src/shared/gatt-server.c
> ++++ b/src/shared/gatt-server.c
> +@@ -816,6 +816,20 @@ static uint8_t authorize_req(struct bt_gatt_server *server,
> + server->authorize_data);
> + }
> +
> ++static uint8_t check_length(uint16_t length, uint16_t offset)
> ++{
> ++ if (length > BT_ATT_MAX_VALUE_LEN)
> ++ return BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN;
> ++
> ++ if (offset > BT_ATT_MAX_VALUE_LEN)
> ++ return BT_ATT_ERROR_INVALID_OFFSET;
> ++
> ++ if (length + offset > BT_ATT_MAX_VALUE_LEN)
> ++ return BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN;
> ++
> ++ return 0;
> ++}
> ++
> + static void write_cb(struct bt_att_chan *chan, uint8_t opcode, const void *pdu,
> + uint16_t length, void *user_data)
> + {
> +@@ -846,6 +860,10 @@ static void write_cb(struct bt_att_chan *chan, uint8_t opcode, const void *pdu,
> + (opcode == BT_ATT_OP_WRITE_REQ) ? "Req" : "Cmd",
> + handle);
> +
> ++ ecode = check_length(length, 0);
> ++ if (ecode)
> ++ goto error;
> ++
> + ecode = check_permissions(server, attr, BT_ATT_PERM_WRITE_MASK);
> + if (ecode)
> + goto error;
> +@@ -1353,6 +1371,10 @@ static void prep_write_cb(struct bt_att_chan *chan, uint8_t opcode,
> + util_debug(server->debug_callback, server->debug_data,
> + "Prep Write Req - handle: 0x%04x", handle);
> +
> ++ ecode = check_length(length, offset);
> ++ if (ecode)
> ++ goto error;
> ++
> + ecode = check_permissions(server, attr, BT_ATT_PERM_WRITE_MASK);
> + if (ecode)
> + goto error;
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#163867): https://lists.openembedded.org/g/openembedded-core/message/163867
> Mute This Topic: https://lists.openembedded.org/mt/90162847/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [dunfell][PATCH] bluez5: fix CVE-2022-0204
2022-03-31 20:25 ` [OE-core] " Khem Raj
@ 2022-03-31 20:31 ` Ralph Siemsen
2022-03-31 20:57 ` Steve Sakoman
0 siblings, 1 reply; 5+ messages in thread
From: Ralph Siemsen @ 2022-03-31 20:31 UTC (permalink / raw)
To: Khem Raj; +Cc: Patches and discussions about the oe-core layer
Yep, I must have fumbled it before sending it out.
Please ignore this one, I'll do a v2 later.
Any comments on the usefulness/format of the "Status in other
branches" would be appreciated.
Ralph
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [dunfell][PATCH] bluez5: fix CVE-2022-0204
2022-03-31 20:31 ` Ralph Siemsen
@ 2022-03-31 20:57 ` Steve Sakoman
0 siblings, 0 replies; 5+ messages in thread
From: Steve Sakoman @ 2022-03-31 20:57 UTC (permalink / raw)
To: Ralph Siemsen; +Cc: Khem Raj, Patches and discussions about the oe-core layer
On Thu, Mar 31, 2022 at 10:32 AM Ralph Siemsen <ralph.siemsen@linaro.org> wrote:
>
> Yep, I must have fumbled it before sending it out.
> Please ignore this one, I'll do a v2 later.
>
> Any comments on the usefulness/format of the "Status in other
> branches" would be appreciated.
I approve of the location and format. And it is useful too :-)
Steve
>
> Ralph
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#163869): https://lists.openembedded.org/g/openembedded-core/message/163869
> Mute This Topic: https://lists.openembedded.org/mt/90162847/3617601
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [sakoman@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dunfell][PATCH v2] bluez5: fix CVE-2022-0204
2022-03-31 19:38 [dunfell][PATCH] bluez5: fix CVE-2022-0204 Ralph Siemsen
2022-03-31 20:25 ` [OE-core] " Khem Raj
@ 2022-04-01 1:13 ` Ralph Siemsen
1 sibling, 0 replies; 5+ messages in thread
From: Ralph Siemsen @ 2022-04-01 1:13 UTC (permalink / raw)
To: openembedded-core
Fix heap overflow when appending prepare writes
The code shall check if the prepare writes would append more the
allowed maximum attribute length.
Upstream-Status: Backport [https://github.com/bluez/bluez/commit/591c546c536b42bef696d027f64aa22434f8c3f0]
CVE: CVE-2022-0204
Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
---
v2: fix accidental patch damage
Status on other branches:
- master/kirkstone 5.64 includes the fix
- honister 5.61 needs patch
- hardknott 5.56 needs patch
meta/recipes-connectivity/bluez5/bluez5.inc | 1 +
.../bluez5/bluez5/CVE-2022-0204.patch | 66 +++++++++++++++++++
2 files changed, 67 insertions(+)
create mode 100644 meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch
diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc
index 7cf061dcf6..4d4348898a 100644
--- a/meta/recipes-connectivity/bluez5/bluez5.inc
+++ b/meta/recipes-connectivity/bluez5/bluez5.inc
@@ -55,6 +55,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
file://CVE-2021-0129.patch \
file://CVE-2021-3588.patch \
file://CVE-2021-3658.patch \
+ file://CVE-2022-0204.patch \
"
S = "${WORKDIR}/bluez-${PV}"
diff --git a/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch b/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch
new file mode 100644
index 0000000000..646b5ddfc8
--- /dev/null
+++ b/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-0204.patch
@@ -0,0 +1,66 @@
+From 0d328fdf6564b67fc2ec3533e3da201ebabcc9e3 Mon Sep 17 00:00:00 2001
+From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Date: Tue, 8 Jun 2021 16:46:49 -0700
+Subject: [PATCH] shared/gatt-server: Fix heap overflow when appending prepare
+ writes
+
+The code shall check if the prepare writes would append more the
+allowed maximum attribute length.
+
+Fixes https://github.com/bluez/bluez/security/advisories/GHSA-479m-xcq5-9g2q
+
+Upstream-Status: Backport [https://github.com/bluez/bluez/commit/591c546c536b42bef696d027f64aa22434f8c3f0]
+Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
+CVE: CVE-2022-0204
+
+---
+ src/shared/gatt-server.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c
+index 0c25a97..20e14bc 100644
+--- a/src/shared/gatt-server.c
++++ b/src/shared/gatt-server.c
+@@ -816,6 +816,20 @@ static uint8_t authorize_req(struct bt_gatt_server *server,
+ server->authorize_data);
+ }
+
++static uint8_t check_length(uint16_t length, uint16_t offset)
++{
++ if (length > BT_ATT_MAX_VALUE_LEN)
++ return BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN;
++
++ if (offset > BT_ATT_MAX_VALUE_LEN)
++ return BT_ATT_ERROR_INVALID_OFFSET;
++
++ if (length + offset > BT_ATT_MAX_VALUE_LEN)
++ return BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN;
++
++ return 0;
++}
++
+ static void write_cb(struct bt_att_chan *chan, uint8_t opcode, const void *pdu,
+ uint16_t length, void *user_data)
+ {
+@@ -846,6 +860,10 @@ static void write_cb(struct bt_att_chan *chan, uint8_t opcode, const void *pdu,
+ (opcode == BT_ATT_OP_WRITE_REQ) ? "Req" : "Cmd",
+ handle);
+
++ ecode = check_length(length, 0);
++ if (ecode)
++ goto error;
++
+ ecode = check_permissions(server, attr, BT_ATT_PERM_WRITE_MASK);
+ if (ecode)
+ goto error;
+@@ -1353,6 +1371,10 @@ static void prep_write_cb(struct bt_att_chan *chan, uint8_t opcode,
+ util_debug(server->debug_callback, server->debug_data,
+ "Prep Write Req - handle: 0x%04x", handle);
+
++ ecode = check_length(length, offset);
++ if (ecode)
++ goto error;
++
+ ecode = check_permissions(server, attr, BT_ATT_PERM_WRITE_MASK);
+ if (ecode)
+ goto error;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-01 1:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31 19:38 [dunfell][PATCH] bluez5: fix CVE-2022-0204 Ralph Siemsen
2022-03-31 20:25 ` [OE-core] " Khem Raj
2022-03-31 20:31 ` Ralph Siemsen
2022-03-31 20:57 ` Steve Sakoman
2022-04-01 1:13 ` [dunfell][PATCH v2] " Ralph Siemsen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.