aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan P. Stanić <mps@arvanta.net>2020-03-06 17:57:29 +0100
committerLeo <thinkabit.ukim@gmail.com>2020-03-10 16:30:47 -0300
commitba5a86b7cb037d86d5f8ad763c573e1ebdc20b55 (patch)
tree5972dd660a7c285296544fde910f5668702bc7ed
parentde8f6b009ad388a047a6b85ec224d599ad583676 (diff)
downloadaports-ba5a86b7cb037d86d5f8ad763c573e1ebdc20b55.tar.gz
aports-ba5a86b7cb037d86d5f8ad763c573e1ebdc20b55.tar.bz2
aports-ba5a86b7cb037d86d5f8ad763c573e1ebdc20b55.tar.xz
main/ppp: secfix for radius and EAP
backported security fixes from upstream: radius: Prevent buffer overflow in rc_mksid() pppd: Fix bounds check in EAP code pppd: Ignore received EAP messages when not doing EAP add 'secfixes'
-rw-r--r--main/ppp/APKBUILD13
-rw-r--r--main/ppp/fix-bound-check-eap.patch40
-rw-r--r--main/ppp/pppd-Ignore-received-EAP-messages-when-not-doing-EAP.patch64
-rw-r--r--main/ppp/radius-Prevent-buffer-overflow-in-rc_mksid.patch33
4 files changed, 149 insertions, 1 deletions
diff --git a/main/ppp/APKBUILD b/main/ppp/APKBUILD
index a51e463a73..de71cfacc5 100644
--- a/main/ppp/APKBUILD
+++ b/main/ppp/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=ppp
pkgver=2.4.7
-pkgrel=6
+pkgrel=7
pkgdesc="A daemon which implements the PPP protocol for dial-up networking"
url="http://www.samba.org/ppp/"
arch="all"
@@ -26,11 +26,19 @@ source="https://ftp.samba.org/pub/ppp/ppp-$pkgver.tar.gz
musl-fix-headers.patch
fix-paths.patch
0011-build-sys-don-t-put-connect-errors-log-to-etc-ppp.patch
+ radius-Prevent-buffer-overflow-in-rc_mksid.patch
+ fix-bound-check-eap.patch
+ pppd-Ignore-received-EAP-messages-when-not-doing-EAP.patch
ip-down
ip-up
pppd.initd"
_builddir="$srcdir"/$pkgname-$pkgver
+
+# secfixes:
+# 2.4.7-r7:
+# - CVE-2020-8597
+
prepare() {
local i
cd "$_builddir"
@@ -177,6 +185,9 @@ fccc7a6809ae4a617796ccf1d2132de8edb1cc0c71d76a95393585a5970b92be2a54da558702db35
2f071ea9db15e4abf1bed6cce8130dc81b710a31bfef5fa8f9370c353f845dbc47674b1551b8e040478e5156add6f98d480530206125e8bb308f0f4288d1eec6 musl-fix-headers.patch
8384afb992a98a7f97b484866e6aa1b1de51e901d7837f84f7ce2beba6815591450fab43957f03b65804424c4940c59640a9cd878979240a171aa77427e9c4ff fix-paths.patch
b490971d03fef4de66b61123f80a0087270bcb88466ae8ed98ea9a08b35d4c7c46b2dadd304e2970a4206bb5760a14370d7e3873de6240119d88e927ecef840c 0011-build-sys-don-t-put-connect-errors-log-to-etc-ppp.patch
+d175085eaa93ccf8ade7be4f9818efe353017da7cec41d9312ad2c6685e3763834aff76d673e9d2bb0b44336f926537569ddb86a6035ec33ab8b6a7de2340132 radius-Prevent-buffer-overflow-in-rc_mksid.patch
+ba0c062f93400008ddf47897ac2ab6a2f5017bc7f4167d1a93dd3a5c04068a922490eb4082b0da80f0c3aea6c87fdfbca3568548724a0abc148588ab86a6df32 fix-bound-check-eap.patch
+ce1bf3298f3f99a7de643bd070cb0e7e7b1dd9621926637ffc93fd2ef552781424ce9a68c88de6eb25dc2593d543e8e329eccc2d00982bde2493e8efb7903051 pppd-Ignore-received-EAP-messages-when-not-doing-EAP.patch
160260bd2a788beaac395eadb38efbfd1e0e1a458fe151555acacf2c4f3a12381d644672c664f9793db6e3459a4f05a54e3ff6d407b0d37e8014b15bd0f11bcc ip-down
8258c95a6b6e8e94d6001b5cd3a99bd3270f29ba0f2e5050a26c8d5f1b67eead8d039e71ce86a784d45e620047b0a2bb14b258d80a9ea62084ba588a4c2e2d84 ip-up
bd6f43588b037367ffdb57f5e331492dcaa5969003e219c2dc8b90e6be1aa407282ff6114b91d1379ebeff766983fa0622456520cc0ac592b4f0b1496acf21bf pppd.initd"
diff --git a/main/ppp/fix-bound-check-eap.patch b/main/ppp/fix-bound-check-eap.patch
new file mode 100644
index 0000000000..746eb70961
--- /dev/null
+++ b/main/ppp/fix-bound-check-eap.patch
@@ -0,0 +1,40 @@
+From 8d7970b8f3db727fe798b65f3377fe6787575426 Mon Sep 17 00:00:00 2001
+From: Paul Mackerras <paulus@ozlabs.org>
+Date: Mon, 3 Feb 2020 15:53:28 +1100
+Subject: [PATCH] pppd: Fix bounds check in EAP code
+
+Given that we have just checked vallen < len, it can never be the case
+that vallen >= len + sizeof(rhostname). This fixes the check so we
+actually avoid overflowing the rhostname array.
+
+Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
+Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
+---
+ pppd/eap.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pppd/eap.c b/pppd/eap.c
+index 94407f5..1b93db0 100644
+--- a/pppd/eap.c
++++ b/pppd/eap.c
+@@ -1420,7 +1420,7 @@ int len;
+ }
+
+ /* Not so likely to happen. */
+- if (vallen >= len + sizeof (rhostname)) {
++ if (len - vallen >= sizeof (rhostname)) {
+ dbglog("EAP: trimming really long peer name down");
+ BCOPY(inp + vallen, rhostname, sizeof (rhostname) - 1);
+ rhostname[sizeof (rhostname) - 1] = '\0';
+@@ -1846,7 +1846,7 @@ int len;
+ }
+
+ /* Not so likely to happen. */
+- if (vallen >= len + sizeof (rhostname)) {
++ if (len - vallen >= sizeof (rhostname)) {
+ dbglog("EAP: trimming really long peer name down");
+ BCOPY(inp + vallen, rhostname, sizeof (rhostname) - 1);
+ rhostname[sizeof (rhostname) - 1] = '\0';
+--
+2.25.0
+
diff --git a/main/ppp/pppd-Ignore-received-EAP-messages-when-not-doing-EAP.patch b/main/ppp/pppd-Ignore-received-EAP-messages-when-not-doing-EAP.patch
new file mode 100644
index 0000000000..e5442079ef
--- /dev/null
+++ b/main/ppp/pppd-Ignore-received-EAP-messages-when-not-doing-EAP.patch
@@ -0,0 +1,64 @@
+From 8d45443bb5c9372b4c6a362ba2f443d41c5636af Mon Sep 17 00:00:00 2001
+From: Paul Mackerras <paulus@ozlabs.org>
+Date: Mon, 3 Feb 2020 16:31:42 +1100
+Subject: [PATCH] pppd: Ignore received EAP messages when not doing EAP
+
+This adds some basic checks to the subroutines of eap_input to check
+that we have requested or agreed to doing EAP authentication before
+doing any processing on the received packet. The motivation is to
+make it harder for a malicious peer to disrupt the operation of pppd
+by sending unsolicited EAP packets. Note that eap_success() already
+has a check that the EAP client state is reasonable, and does nothing
+(apart from possibly printing a debug message) if not.
+
+Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
+---
+ pppd/eap.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/pppd/eap.c b/pppd/eap.c
+index 1b93db0..082e953 100644
+--- a/pppd/eap.c
++++ b/pppd/eap.c
+@@ -1328,6 +1328,12 @@ int len;
+ int fd;
+ #endif /* USE_SRP */
+
++ /*
++ * Ignore requests if we're not open
++ */
++ if (esp->es_client.ea_state <= eapClosed)
++ return;
++
+ /*
+ * Note: we update es_client.ea_id *only if* a Response
+ * message is being generated. Otherwise, we leave it the
+@@ -1736,6 +1742,12 @@ int len;
+ u_char dig[SHA_DIGESTSIZE];
+ #endif /* USE_SRP */
+
++ /*
++ * Ignore responses if we're not open
++ */
++ if (esp->es_server.ea_state <= eapClosed)
++ return;
++
+ if (esp->es_server.ea_id != id) {
+ dbglog("EAP: discarding Response %d; expected ID %d", id,
+ esp->es_server.ea_id);
+@@ -2047,6 +2059,12 @@ u_char *inp;
+ int id;
+ int len;
+ {
++ /*
++ * Ignore failure messages if we're not open
++ */
++ if (esp->es_client.ea_state <= eapClosed)
++ return;
++
+ if (!eap_client_active(esp)) {
+ dbglog("EAP unexpected failure message in state %s (%d)",
+ eap_state_name(esp->es_client.ea_state),
+--
+2.24.1
+
diff --git a/main/ppp/radius-Prevent-buffer-overflow-in-rc_mksid.patch b/main/ppp/radius-Prevent-buffer-overflow-in-rc_mksid.patch
new file mode 100644
index 0000000000..112b259802
--- /dev/null
+++ b/main/ppp/radius-Prevent-buffer-overflow-in-rc_mksid.patch
@@ -0,0 +1,33 @@
+From 858976b1fc3107f1261aae337831959b511b83c2 Mon Sep 17 00:00:00 2001
+From: Paul Mackerras <paulus@ozlabs.org>
+Date: Sat, 4 Jan 2020 12:01:32 +1100
+Subject: [PATCH] radius: Prevent buffer overflow in rc_mksid()
+
+On some systems getpid() can return a value greater than 65535.
+Increase the size of buf[] to allow for this, and use slprintf()
+to make sure we never overflow it.
+
+Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
+---
+ pppd/plugins/radius/util.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pppd/plugins/radius/util.c b/pppd/plugins/radius/util.c
+index 6f976a7..740131e 100644
+--- a/pppd/plugins/radius/util.c
++++ b/pppd/plugins/radius/util.c
+@@ -73,9 +73,9 @@ void rc_mdelay(int msecs)
+ char *
+ rc_mksid (void)
+ {
+- static char buf[15];
++ static char buf[32];
+ static unsigned short int cnt = 0;
+- sprintf (buf, "%08lX%04X%02hX",
++ slprintf(buf, sizeof(buf), "%08lX%04X%02hX",
+ (unsigned long int) time (NULL),
+ (unsigned int) getpid (),
+ cnt & 0xFF);
+--
+2.24.1
+