Skip to contentSkip to conversation

package/fastd: fix CVE-2020-27638

PATCH New Fabrice Fontaine 4 participants 5 messages Oct 31, 2020 – Nov 3, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/fastd: fix CVE-2020-27638

receive.c in fastd before v21 allows denial of service (assertion failure) when receiving packets with an invalid type code.

---
 ...-leak-when-receiving-invalid-packets.patch | 45 +++++++++++++++++++
 package/fastd/fastd.mk                        |  3 ++
 2 files changed, 48 insertions(+)
 create mode 100644 package/fastd/0002-receive-fix-buffer-leak-when-receiving-invalid-packets.patch
package/fastd/0002-receive-fix-buffer-leak-when-receiving-invalid-packets.patch new file +45 -0
new file mode 100644
index 0000000000..f4a44fea6d
@@ -0,0 +1,45 @@
+From 737925113363b6130879729cdff9ccc46c33eaea Mon Sep 17 00:00:00 2001
+From: Matthias Schiffer <[email protected]>
+Date: Mon, 19 Oct 2020 21:08:16 +0200
+Subject: [PATCH] receive: fix buffer leak when receiving invalid packets
+
+For fastd versions before v20, this was just a memory leak (which could
+still be used for DoS, as it's remotely triggerable). With the new
+buffer management of fastd v20, this will trigger an assertion failure
+instead as soon as the buffer pool is empty.
+
+[Retrieved from:
+https://github.com/NeoRaider/fastd/commit/737925113363b6130879729cdff9ccc46c33eaea]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ src/receive.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/receive.c b/src/receive.c
+index 043c9f2..6bca9f4 100644
+--- a/src/receive.c
++++ b/src/receive.c
+@@ -169,6 +169,11 @@ static inline void handle_socket_receive_known(
+ 
+ 	case PACKET_HANDSHAKE:
+ 		fastd_handshake_handle(sock, local_addr, remote_addr, peer, buffer);
++		break;
++
++	default:
++		fastd_buffer_free(buffer);
++		pr_debug("received packet with invalid type from %P[%I]", peer, remote_addr);
+ 	}
+ }
+ 
+@@ -195,6 +200,11 @@ static inline void handle_socket_receive_unknown(
+ 
+ 	case PACKET_HANDSHAKE:
+ 		fastd_handshake_handle(sock, local_addr, remote_addr, NULL, buffer);
++		break;
++
++	default:
++		fastd_buffer_free(buffer);
++		pr_debug("received packet with invalid type from unknown address %I", remote_addr);
+ 	}
+ }
+ 
package/fastd/fastd.mk +3 -0
index b1261f0fa5..d556e2fbb1 100644
@@ -12,6 +12,9 @@ FASTD_LICENSE_FILES = COPYRIGHT
 FASTD_CONF_OPTS = -DENABLE_LIBSODIUM=ON
 FASTD_DEPENDENCIES = host-bison host-pkgconf libuecc libsodium libcap
 
+# 0002-receive-fix-buffer-leak-when-receiving-invalid-packets.patch
+FASTD_IGNORE_CVES += CVE-2020-27638
+
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 FASTD_CONF_OPTS += -DENABLE_OPENSSL=ON
 FASTD_DEPENDENCIES += openssl
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/1 package/fastd: fix CVE-2020-27638

Hei hei,

Quoted 4 lines · Fabrice Fontaine

receive.c in fastd before v21 allows denial of service (assertion failure) when receiving packets with an invalid type code.

Note: with v21 fastd switched from CMake to Meson. I have no experience with Meson so far, so I might need some time for an upgrade. If someone else wants to step in, do not hesitate.

Greets
Alex

Quoted 78 lines
---
 ...-leak-when-receiving-invalid-packets.patch | 45 +++++++++++++++++++
 package/fastd/fastd.mk                        |  3 ++
 2 files changed, 48 insertions(+)
 create mode 100644 package/fastd/0002-receive-fix-buffer-leak-when-receiving-invalid-packets.patch
package/fastd/0002-receive-fix-buffer-leak-when-receiving-invalid-packets.patch new file +45 -0
new file mode 100644
index 0000000000..f4a44fea6d
@@ -0,0 +1,45 @@
+From 737925113363b6130879729cdff9ccc46c33eaea Mon Sep 17 00:00:00 2001
+From: Matthias Schiffer <[email protected]>
+Date: Mon, 19 Oct 2020 21:08:16 +0200
+Subject: [PATCH] receive: fix buffer leak when receiving invalid packets
+
+For fastd versions before v20, this was just a memory leak (which could
+still be used for DoS, as it's remotely triggerable). With the new
+buffer management of fastd v20, this will trigger an assertion failure
+instead as soon as the buffer pool is empty.
+
+[Retrieved from:
+https://github.com/NeoRaider/fastd/commit/737925113363b6130879729cdff9ccc46c33eaea]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ src/receive.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/receive.c b/src/receive.c
+index 043c9f2..6bca9f4 100644
+--- a/src/receive.c
++++ b/src/receive.c
+@@ -169,6 +169,11 @@ static inline void handle_socket_receive_known(
+ 
+ 	case PACKET_HANDSHAKE:
+ 		fastd_handshake_handle(sock, local_addr, remote_addr, peer, buffer);
++		break;
++
++	default:
++		fastd_buffer_free(buffer);
++		pr_debug("received packet with invalid type from %P[%I]", peer, remote_addr);
+ 	}
+ }
+ 
+@@ -195,6 +200,11 @@ static inline void handle_socket_receive_unknown(
+ 
+ 	case PACKET_HANDSHAKE:
+ 		fastd_handshake_handle(sock, local_addr, remote_addr, NULL, buffer);
++		break;
++
++	default:
++		fastd_buffer_free(buffer);
++		pr_debug("received packet with invalid type from unknown address %I", remote_addr);
+ 	}
+ }
+ 
package/fastd/fastd.mk +3 -0
index b1261f0fa5..d556e2fbb1 100644
@@ -12,6 +12,9 @@ FASTD_LICENSE_FILES = COPYRIGHT
 FASTD_CONF_OPTS = -DENABLE_LIBSODIUM=ON
 FASTD_DEPENDENCIES = host-bison host-pkgconf libuecc libsodium libcap
 
+# 0002-receive-fix-buffer-leak-when-receiving-invalid-packets.patch
+FASTD_IGNORE_CVES += CVE-2020-27638
+
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 FASTD_CONF_OPTS += -DENABLE_OPENSSL=ON
 FASTD_DEPENDENCIES += openssl
Signature · 6 lines
2.28.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 11 lines
/"\ ASCII RIBBON | ?With the first link, the chain is forged. The first
\ / CAMPAIGN     | speech censured, the first thought forbidden, the
 X  AGAINST      | first freedom denied, chains us all irrevocably.?
/ \ HTML MAIL    | (Jean-Luc Picard, quoting Judge Aaron Satie)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20201031/73ed62b9/attachment.asc>
#2 lore raw

PATCH 1/1 package/fastd: fix CVE-2020-27638

Hi Alexander,

Le sam. 31 oct. 2020 ? 18:20, Alexander Dahl <[email protected]> a ?crit :

Quoted 7 lines

Hei hei,

Quoted 3 lines · Fabrice Fontaine

receive.c in fastd before v21 allows denial of service (assertion failure) when receiving packets with an invalid type code.

Quoted 7 lines
Quoted 1 line

Note: with v21 fastd switched from CMake to Meson. I have no experience with Meson so far, so I might need some time for an upgrade. If someone else wants to step in, do not hesitate.

I prepared a patch to bump fastd to v21, I'll send it after this one is merged.

Quoted 84 lines

Greets
Alex

Quoted 74 lines
---
 ...-leak-when-receiving-invalid-packets.patch | 45 +++++++++++++++++++
 package/fastd/fastd.mk                        |  3 ++
 2 files changed, 48 insertions(+)
 create mode 100644 package/fastd/0002-receive-fix-buffer-leak-when-receiving-invalid-packets.patch
package/fastd/0002-receive-fix-buffer-leak-when-receiving-invalid-packets.patch new file +45 -0
new file mode 100644
index 0000000000..f4a44fea6d
@@ -0,0 +1,45 @@
+From 737925113363b6130879729cdff9ccc46c33eaea Mon Sep 17 00:00:00 2001
+From: Matthias Schiffer <[email protected]>
+Date: Mon, 19 Oct 2020 21:08:16 +0200
+Subject: [PATCH] receive: fix buffer leak when receiving invalid packets
+
+For fastd versions before v20, this was just a memory leak (which could
+still be used for DoS, as it's remotely triggerable). With the new
+buffer management of fastd v20, this will trigger an assertion failure
+instead as soon as the buffer pool is empty.
+
+[Retrieved from:
+https://github.com/NeoRaider/fastd/commit/737925113363b6130879729cdff9ccc46c33eaea]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ src/receive.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/receive.c b/src/receive.c
+index 043c9f2..6bca9f4 100644
+--- a/src/receive.c
++++ b/src/receive.c
+@@ -169,6 +169,11 @@ static inline void handle_socket_receive_known(
+
+     case PACKET_HANDSHAKE:
+             fastd_handshake_handle(sock, local_addr, remote_addr, peer, buffer);
++            break;
++
++    default:
++            fastd_buffer_free(buffer);
++            pr_debug("received packet with invalid type from %P[%I]", peer, remote_addr);
+     }
+ }
+
+@@ -195,6 +200,11 @@ static inline void handle_socket_receive_unknown(
+
+     case PACKET_HANDSHAKE:
+             fastd_handshake_handle(sock, local_addr, remote_addr, NULL, buffer);
++            break;
++
++    default:
++            fastd_buffer_free(buffer);
++            pr_debug("received packet with invalid type from unknown address %I", remote_addr);
+     }
+ }
+
package/fastd/fastd.mk +3 -1
index b1261f0fa5..d556e2fbb1 100644
@@ -12,6 +12,9 @@ FASTD_LICENSE_FILES = COPYRIGHT
 FASTD_CONF_OPTS = -DENABLE_LIBSODIUM=ON
 FASTD_DEPENDENCIES = host-bison host-pkgconf libuecc libsodium libcap
 
+# 0002-receive-fix-buffer-leak-when-receiving-invalid-packets.patch
+FASTD_IGNORE_CVES += CVE-2020-27638
+
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 FASTD_CONF_OPTS += -DENABLE_OPENSSL=ON
 FASTD_DEPENDENCIES += openssl
--

2.28.0

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--

Quoted 4 lines
/"\ ASCII RIBBON | ?With the first link, the chain is forged. The first
\ / CAMPAIGN     | speech censured, the first thought forbidden, the
 X  AGAINST      | first freedom denied, chains us all irrevocably.?
/ \ HTML MAIL    | (Jean-Luc Picard, quoting Judge Aaron Satie)

Best Regards,

Fabrice

#3 lore raw

PATCH 1/1 package/fastd: fix CVE-2020-27638

In reply to Fabrice Fontaine
Quoted 9 lines · On Sat, 31 Oct 2020 17:34:20 +0100 Fabrice Fontaine…

receive.c in fastd before v21 allows denial of service (assertion failure) when receiving packets with an invalid type code.

---
 ...-leak-when-receiving-invalid-packets.patch | 45 +++++++++++++++++++
 package/fastd/fastd.mk                        |  3 ++
 2 files changed, 48 insertions(+)
 create mode 100644 package/fastd/0002-receive-fix-buffer-leak-when-receiving-invalid-packets.patch

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 1/1 package/fastd: fix CVE-2020-27638

In reply to Fabrice Fontaine
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

receive.c in fastd before v21 allows denial of service (assertion failure) when receiving packets with an invalid type code.

Committed to 2020.02.x and 2020.08.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard