diff options
author | Milan P. Stanić <mps@arvanta.net> | 2020-02-27 21:25:37 +0100 |
---|---|---|
committer | Leo <thinkabit.ukim@gmail.com> | 2020-02-27 22:51:57 -0300 |
commit | bc60bb71fcd31cf2ef7196cf61d7817d7f7392df (patch) | |
tree | d150da2c19184c6d1967a9f610fd9434c094acbf /main | |
parent | b013f9079210092f624c04cc9b8430a61d3c1598 (diff) | |
download | aports-bc60bb71fcd31cf2ef7196cf61d7817d7f7392df.tar.bz2 aports-bc60bb71fcd31cf2ef7196cf61d7817d7f7392df.tar.xz |
main/ppp: fix buffer overflow and EAP messages
cherry picked fixes from upstream
radius: Prevent buffer overflow in rc_mksid()
pppd: Ignore received EAP messages when not doing EAP
Diffstat (limited to 'main')
-rw-r--r-- | main/ppp/APKBUILD | 6 | ||||
-rw-r--r-- | main/ppp/pppd-Ignore-received-EAP-messages-when-not-doing-EAP.patch | 64 | ||||
-rw-r--r-- | main/ppp/radius-Prevent-buffer-overflow-in-rc_mksid.patch | 33 |
3 files changed, 102 insertions, 1 deletions
diff --git a/main/ppp/APKBUILD b/main/ppp/APKBUILD index 01e08cedb0..0c1f6da5c1 100644 --- a/main/ppp/APKBUILD +++ b/main/ppp/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=ppp pkgver=2.4.8 -pkgrel=1 +pkgrel=2 pkgdesc="A daemon which implements the PPP protocol for dial-up networking" url="https://ppp.samba.org/" arch="all" @@ -27,7 +27,9 @@ source="https://github.com/paulusmack/ppp/archive/ppp-$pkgver.tar.gz 0011-build-sys-don-t-put-connect-errors-log-to-etc-ppp.patch fix-pppd-magic.h.patch fix-pppd-pppoe.h.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" @@ -174,7 +176,9 @@ sha512sums="a99b3b6c7bd80cd133bda4e29d33c793a76f3b67e1f8db774547e88932ce29564fad b490971d03fef4de66b61123f80a0087270bcb88466ae8ed98ea9a08b35d4c7c46b2dadd304e2970a4206bb5760a14370d7e3873de6240119d88e927ecef840c 0011-build-sys-don-t-put-connect-errors-log-to-etc-ppp.patch d1067defff79d6c9f67121a9214e41a1bcca1e3b8a345ad905d223fdb8835142bad7cc3b556a3eca509ddf51cf808741773f31f4dca74e834b612a15854a5e6b fix-pppd-magic.h.patch d76237c82af0a3ed7ede9e814d6849b94221f1fd15e4ee68cadd33a308a32d87d635acd14f84508c9e38a10ad0a9e96ce391044da37e217d11b89a4f6631abf7 fix-pppd-pppoe.h.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/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 + |