aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan P. Stanić <mps@arvanta.net>2020-03-10 20:27:17 +0100
committerLeo <thinkabit.ukim@gmail.com>2020-03-10 16:36:17 -0300
commitdcccf9b95811b0b0c41e278c0190deafdc5640d2 (patch)
tree62d302cefe4c7ca5812f30666eebbb39c181b68f
parentec2cb0ea688e8d4c4ccf31b7434ab4b5cb111e66 (diff)
downloadaports-dcccf9b95811b0b0c41e278c0190deafdc5640d2.tar.gz
aports-dcccf9b95811b0b0c41e278c0190deafdc5640d2.tar.bz2
aports-dcccf9b95811b0b0c41e278c0190deafdc5640d2.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/APKBUILD27
-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, 15 deletions
diff --git a/main/ppp/APKBUILD b/main/ppp/APKBUILD
index feccc75260..a157df184e 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=5
+pkgrel=6
pkgdesc="A daemon which implements the PPP protocol for dial-up networking"
url="http://www.samba.org/ppp/"
arch="all"
@@ -26,10 +26,18 @@ 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"
_builddir="$srcdir"/$pkgname-$pkgver
+
+# secfixes:
+# 2.4.7-r7:
+# - CVE-2020-8597
+
prepare() {
local i
cd "$_builddir"
@@ -170,24 +178,13 @@ daemon() {
mv "$pkgdir"/* "$subpkgdir"/ || return 1
}
-md5sums="78818f40e6d33a1d1de68a1551f6595a ppp-2.4.7.tar.gz
-5a5c2d1bdca62979d9ed7a5a648e86d1 defaultroute-metric.3.patch
-8d2128c74d62a2844491a24794b05a3e musl-fix-headers.patch
-c8f78e010a776d114d687b1a742ca6bb fix-paths.patch
-995535911b0bc5390cd75cee1eae690b 0011-build-sys-don-t-put-connect-errors-log-to-etc-ppp.patch
-a88b40b1bf91eb5cca3762b7195e4fe2 ip-down
-fac0c773490371ea673f4be0977a230f ip-up"
-sha256sums="02e0a3dd3e4799e33103f70ec7df75348c8540966ee7c948e4ed8a42bbccfb30 ppp-2.4.7.tar.gz
-1f69c03747ed68eaaaa8b2f0a239e57f167967fc90a6f89d802dcfe77026846f defaultroute-metric.3.patch
-b136d5366e64a686a3ea24baaaeb4a37c2654c098dd7fcb263caebf9e9281956 musl-fix-headers.patch
-b6453eeb32a78d6748b3fc5ef9f21a7862f70f8316c3903097ad63f00497266b fix-paths.patch
-369bcf35e6746e32144357177c8e6650caf7b17018836889ade1019f80715bf3 0011-build-sys-don-t-put-connect-errors-log-to-etc-ppp.patch
-84f2b44c9f4b8abdbc9cfbfffb669fa19385b80da55f9c292df115189dc62bd6 ip-down
-7d44e21ed945434c32a385f44c690826f74c3d5ddac353deae8174692d8d1beb ip-up"
sha512sums="e34ce24020af6a73e7a26c83c4f73a9c83fa455b7b363794dba27bf01f70368be06bff779777843949bd77f4bc9385d6ad455ea48bf8fff4e0d73cc8fef16ae2 ppp-2.4.7.tar.gz
fccc7a6809ae4a617796ccf1d2132de8edb1cc0c71d76a95393585a5970b92be2a54da558702db355c8aea8d37b4dfffc64406129a2b3322f0b10e8f0481f685 defaultroute-metric.3.patch
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"
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
+