From 4b480055b9d8c393ee76492b2950256dec577001 Mon Sep 17 00:00:00 2001 From: Christian Studer Date: Fri, 28 Apr 2023 09:54:41 +0200 Subject: [PATCH 01/96] fix: [taxii_push] The path `resolve` method needs to be called --- app/files/scripts/taxii/taxii_push.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/files/scripts/taxii/taxii_push.py b/app/files/scripts/taxii/taxii_push.py index 948f42ebd..9276e9102 100644 --- a/app/files/scripts/taxii/taxii_push.py +++ b/app/files/scripts/taxii/taxii_push.py @@ -12,7 +12,7 @@ from base64 import b64decode from pathlib import Path from requests.auth import HTTPBasicAuth -_script_path = Path(__file__).resolve.parents[1] +_script_path = Path(__file__).resolve().parents[1] sys.path.insert(0, str(_script_path / 'misp-stix')) import misp_stix_converter From 26ad0ef607f182ae93fe5a074c1742e95112fe28 Mon Sep 17 00:00:00 2001 From: iglocska Date: Thu, 29 Jun 2023 12:38:29 +0200 Subject: [PATCH 02/96] fix: [customauth] Don't renew the session with each query - Leave the session handling to the normal life-cycle management - should solve the issues where CSRF keeps kicking users off --- app/Controller/AppController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php index 19f01ac6e..6ae7b001f 100755 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -1112,7 +1112,7 @@ class AppController extends Controller $user['User'] = $temp; if ($user['User']) { $this->User->updateLoginTimes($user['User']); - $this->Session->renew(); + //$this->Session->renew(); $this->Session->write(AuthComponent::$sessionKey, $user['User']); if (Configure::read('MISP.log_auth')) { $this->Log = ClassRegistry::init('Log'); From 4a2734bb115fc99fdbdbb5c6566017361b4c3e7b Mon Sep 17 00:00:00 2001 From: Alex Jarvis-Blanks <45558436+ajb3932@users.noreply.github.com> Date: Thu, 29 Jun 2023 16:33:59 +0100 Subject: [PATCH 03/96] Update INSTALL.sh The current command adds the line "Listen 443" after the line containing "Listen 80" even if "Listen 443" already exists. In my update, the "Listen 443" line will only be added if it doesn't already exist in the file. --- INSTALL/INSTALL.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTALL/INSTALL.sh b/INSTALL/INSTALL.sh index ce2132009..46f5d4739 100755 --- a/INSTALL/INSTALL.sh +++ b/INSTALL/INSTALL.sh @@ -2543,7 +2543,7 @@ apacheConfig_RHEL7 () { #sudo sed -i "s/SetHandler/\#SetHandler/g" /etc/httpd/conf.d/misp.ssl.conf sudo rm /etc/httpd/conf.d/ssl.conf sudo chmod 644 /etc/httpd/conf.d/misp.ssl.conf - sudo sed -i '/Listen 80/a Listen 443' /etc/httpd/conf/httpd.conf + sudo sed -i '/Listen 443/!s/Listen 80/a Listen 443/' /etc/httpd/conf/httpd.conf # If a valid SSL certificate is not already created for the server, create a self-signed certificate: echo "The Common Name used below will be: ${OPENSSL_CN}" @@ -2591,7 +2591,7 @@ apacheConfig_RHEL8 () { #sudo sed -i "s/SetHandler/\#SetHandler/g" /etc/httpd/conf.d/misp.ssl.conf sudo rm /etc/httpd/conf.d/ssl.conf sudo chmod 644 /etc/httpd/conf.d/misp.ssl.conf - sudo sed -i '/Listen 80/a Listen 443' /etc/httpd/conf/httpd.conf + sudo sed -i '/Listen 443/!s/Listen 80/a Listen 443/' /etc/httpd/conf/httpd.conf # If a valid SSL certificate is not already created for the server, create a self-signed certificate: echo "The Common Name used below will be: ${OPENSSL_CN}" From f3a30ac38c4d75f294329c8eec379211a399def0 Mon Sep 17 00:00:00 2001 From: Steve Clement Date: Sat, 1 Jul 2023 17:10:16 +0200 Subject: [PATCH 04/96] chg: [doc] "Listen 443" line will only be added if it doesn't already exist in the file." --- docs/INSTALL.rhel7.md | 2 +- docs/INSTALL.rhel8.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/INSTALL.rhel7.md b/docs/INSTALL.rhel7.md index 003e36713..b392da793 100644 --- a/docs/INSTALL.rhel7.md +++ b/docs/INSTALL.rhel7.md @@ -411,7 +411,7 @@ apacheConfig_RHEL7 () { #sudo sed -i "s/SetHandler/\#SetHandler/g" /etc/httpd/conf.d/misp.ssl.conf sudo rm /etc/httpd/conf.d/ssl.conf sudo chmod 644 /etc/httpd/conf.d/misp.ssl.conf - sudo sed -i '/Listen 80/a Listen 443' /etc/httpd/conf/httpd.conf + sudo sed -i '/Listen 443/!s/Listen 80/a Listen 443/' /etc/httpd/conf/httpd.conf # If a valid SSL certificate is not already created for the server, create a self-signed certificate: echo "The Common Name used below will be: ${OPENSSL_CN}" diff --git a/docs/INSTALL.rhel8.md b/docs/INSTALL.rhel8.md index 5db35de42..3e8243ee8 100644 --- a/docs/INSTALL.rhel8.md +++ b/docs/INSTALL.rhel8.md @@ -452,7 +452,7 @@ apacheConfig_RHEL8 () { #sudo sed -i "s/SetHandler/\#SetHandler/g" /etc/httpd/conf.d/misp.ssl.conf sudo rm /etc/httpd/conf.d/ssl.conf sudo chmod 644 /etc/httpd/conf.d/misp.ssl.conf - sudo sed -i '/Listen 80/a Listen 443' /etc/httpd/conf/httpd.conf + sudo sed -i '/Listen 443/!s/Listen 80/a Listen 443/' /etc/httpd/conf/httpd.conf # If a valid SSL certificate is not already created for the server, create a self-signed certificate: echo "The Common Name used below will be: ${OPENSSL_CN}" From 648c1c9ea21b85e2d360033a65882fe33c8b9bbe Mon Sep 17 00:00:00 2001 From: Steve Clement Date: Sat, 1 Jul 2023 17:15:15 +0200 Subject: [PATCH 05/96] chg: [installer] Updated installer to latest version. --- INSTALL/INSTALL.sh | 10 +++++++++- INSTALL/INSTALL.sh.sfv | 6 +++--- INSTALL/INSTALL.sh.sha1 | 2 +- INSTALL/INSTALL.sh.sha256 | 2 +- INSTALL/INSTALL.sh.sha384 | 2 +- INSTALL/INSTALL.sh.sha512 | 2 +- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/INSTALL/INSTALL.sh b/INSTALL/INSTALL.sh index 46f5d4739..4e01e2c20 100755 --- a/INSTALL/INSTALL.sh +++ b/INSTALL/INSTALL.sh @@ -1509,9 +1509,17 @@ coreCAKE () { ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "GnuPG.homedir" "${PATH_TO_MISP}/.gnupg" ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "GnuPG.password" "${GPG_PASSPHRASE}" ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "GnuPG.obscure_subject" true + ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "GnuPG.key_fetching_disabled" false # FIXME: what if we have not gpg binary but a gpg2 one? ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "GnuPG.binary" "$(which gpg)" + # LinOTP + ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "LinOTPAuth.enabled" false + ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "LinOTPAuth.baseUrl" "https://" + ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "LinOTPAuth.realm" "lino" + ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "LinOTPAuth.verifyssl" true + ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "LinOTPAuth.mixedauth" false + # Enable installer org and tune some configurables ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "MISP.host_org_id" 1 ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "MISP.email" "info@admin.test" @@ -1870,7 +1878,7 @@ mispmodules () { modulesCAKE () { # Enable Enrichment, set better timeouts ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "Plugin.Enrichment_services_enable" true - ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "Plugin.Enrichment_hover_enable" true + ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "Plugin.Enrichment_hover_enable" false ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "Plugin.Enrichment_hover_popover_only" false ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "Plugin.Enrichment_hover_timeout" 150 ${SUDO_WWW} ${RUN_PHP} -- ${CAKE} Admin setSetting "Plugin.Enrichment_timeout" 300 diff --git a/INSTALL/INSTALL.sh.sfv b/INSTALL/INSTALL.sh.sfv index 6f53f2312..1e88b1879 100644 --- a/INSTALL/INSTALL.sh.sfv +++ b/INSTALL/INSTALL.sh.sfv @@ -1,5 +1,5 @@ -; Generated by RHash v1.4.2 on 2022-05-23 at 12:45.34 +; Generated by RHash v1.4.2 on 2023-07-01 at 17:15.04 ; Written by Kravchenko Aleksey (Akademgorodok) - http://rhash.sf.net/ ; -; 160126 12:45.34 2022-05-23 INSTALL.sh -INSTALL.sh 4296D40B11B3002DF3FDFD69A508ED5ECACB8C13 D32E5A4B0F37F4C937CD4F85927E998D917BCBE89E4E0E864FFD7EA09E29ADEF BD093D8018C351E3D3722646E269C4B60E6DA19F42150338CE6FD72FEE293B8B89AA69D48A84B19D3EFDDAE25EC9E646 ECACC3071E130058C3DDECC86E1CBF27DD4F11389D10F43B14293B1915F7A24F02D0DA51E299706A38C00F2D2A7505B0FE46E33B705E53594383CE65461F2B08 +; 160686 17:15.04 2023-07-01 INSTALL.sh +INSTALL.sh 9576C31EC5BD942E1C9B12413E6408E4623252F7 78B708FE1FC6B39BE081B9F05C6AA5E1478F8762CAF5A8A7671A12EBA4D3C1C5 27991471FB5788F42AF3BBF86FC80A95341AA17AE9487016EEC94961A48437172702EB8E2D6CB300387E87D9E8E0E3E5 C1C21FD491AEFD662C87C3EF62837D769E63E9CF2446B9BD607CCEF8AFD72528824A8F408C6892FD51109390104010EF90DA7F4828950A8671D2986A6B8E216F diff --git a/INSTALL/INSTALL.sh.sha1 b/INSTALL/INSTALL.sh.sha1 index 90e04e1ef..e1db6c05b 100644 --- a/INSTALL/INSTALL.sh.sha1 +++ b/INSTALL/INSTALL.sh.sha1 @@ -1 +1 @@ -4296d40b11b3002df3fdfd69a508ed5ecacb8c13 INSTALL.sh +9576c31ec5bd942e1c9b12413e6408e4623252f7 INSTALL.sh diff --git a/INSTALL/INSTALL.sh.sha256 b/INSTALL/INSTALL.sh.sha256 index 80d0ca800..6622f0558 100644 --- a/INSTALL/INSTALL.sh.sha256 +++ b/INSTALL/INSTALL.sh.sha256 @@ -1 +1 @@ -d32e5a4b0f37f4c937cd4f85927e998d917bcbe89e4e0e864ffd7ea09e29adef INSTALL.sh +78b708fe1fc6b39be081b9f05c6aa5e1478f8762caf5a8a7671a12eba4d3c1c5 INSTALL.sh diff --git a/INSTALL/INSTALL.sh.sha384 b/INSTALL/INSTALL.sh.sha384 index 58d22834f..0f9ebbe68 100644 --- a/INSTALL/INSTALL.sh.sha384 +++ b/INSTALL/INSTALL.sh.sha384 @@ -1 +1 @@ -bd093d8018c351e3d3722646e269c4b60e6da19f42150338ce6fd72fee293b8b89aa69d48a84b19d3efddae25ec9e646 INSTALL.sh +27991471fb5788f42af3bbf86fc80a95341aa17ae9487016eec94961a48437172702eb8e2d6cb300387e87d9e8e0e3e5 INSTALL.sh diff --git a/INSTALL/INSTALL.sh.sha512 b/INSTALL/INSTALL.sh.sha512 index e83897162..fa8fc6529 100644 --- a/INSTALL/INSTALL.sh.sha512 +++ b/INSTALL/INSTALL.sh.sha512 @@ -1 +1 @@ -ecacc3071e130058c3ddecc86e1cbf27dd4f11389d10f43b14293b1915f7a24f02d0da51e299706a38c00f2d2a7505b0fe46e33b705e53594383ce65461f2b08 INSTALL.sh +c1c21fd491aefd662c87c3ef62837d769e63e9cf2446b9bd607ccef8afd72528824a8f408c6892fd51109390104010ef90da7f4828950a8671d2986a6b8e216f INSTALL.sh From 3cc3549bac9ea42da0202bbed42ad914c0f0fcd7 Mon Sep 17 00:00:00 2001 From: vincenzocaputo <32276363+vincenzocaputo@users.noreply.github.com> Date: Sun, 2 Jul 2023 22:36:17 +0200 Subject: [PATCH 06/96] Add dashboard widget for monthly number of events per org --- app/Lib/Dashboard/OrgEventsWidget.php | 121 ++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 app/Lib/Dashboard/OrgEventsWidget.php diff --git a/app/Lib/Dashboard/OrgEventsWidget.php b/app/Lib/Dashboard/OrgEventsWidget.php new file mode 100644 index 000000000..cf74e9a88 --- /dev/null +++ b/app/Lib/Dashboard/OrgEventsWidget.php @@ -0,0 +1,121 @@ + 'A list of organisation names to filter out', + 'months' => 'Number of past months to consider for the graph', + 'logarithmic' => 'Visualize data on logarithmic scale' + ); + + public $placeholder = +'{ + "blocklist_orgs": ["Orgs to filter"], + "months": "6", + "logarithmic": "true" +}'; + + + + + + /* + * Target_month must be from 1 to 12 + * Target year must be 4 digits + */ + private function org_events_count($user, $org, $target_month, $target_year) { + $events_count = 0; + + $start_date = $target_year.'-'.$target_month.'-01'; + if($target_month == 12) { + $end_date = ($target_year+1).'-01-01'; + } else { + $end_date = $target_year.'-'.($target_month+1).'-01'; + } + $conditions = array('Event.orgc_id' => $org['Organisation']['id'], 'Event.date >=' => $start_date, 'Event.date <' => $end_date); + + //This is required to enforce the ACL (not pull directly from the DB) + $eventIds = $this->Event->fetchSimpleEventIds($user, array('conditions' => $conditions)); + + if(!empty($eventIds)) { + $params = array('Event.id' => $eventIds); + $events = $this->Event->find('all', array('conditions' => array('AND' => $params))); + foreach($events as $event) { + $events_count+= 1; + } + } + return $events_count; + } + + private function filter_ghost_orgs(&$data, $orgs){ + foreach ($data['data'] as &$item) { + foreach(array_keys($orgs) as $org_name) { + unset($item[$org_name]); + } + } + } + + public function handler($user, $options = array()) + { + $this->Log = ClassRegistry::init('Log'); + $this->Org = ClassRegistry::init('Organisation'); + $this->Event = ClassRegistry::init('Event'); + $orgs = $this->Org->find('all', array( 'conditions' => array('Organisation.local' => 1))); + $current_month = date('n'); + $current_year = date('Y'); + $limit = 6; // months + if(!empty($options['months'])) { + $limit = (int) ($options['months']); + } + $offset = 0; + $ghost_orgs = array(); // track orgs without any contribution + // We start by putting all orgs_id in there: + foreach($orgs as $org) { + // We check for blocklisted orgs + if(!empty($options['blocklist_orgs']) && in_array($org['Organisation']['name'], $options['blocklist_orgs'])) { + unset($orgs[$offset]); + } else { + $ghost_orgs[$org['Organisation']['name']] = true; + } + $offset++; + } + $data = array(); + $data['data'] = array(); + for ($i=0; $i < $limit; $i++) { + $target_month = $current_month - $i; + $target_year = $current_year; + if ($target_month < 1) { + $target_month += 12; + $target_year -= 1; + } + $item = array(); + $item ['date'] = $target_year.'-'.$target_month.'-01'; + foreach($orgs as $org) { + $count = $this->org_events_count($user, $org, $target_month, $target_year); + if($options['logarithmic'] === "true" || $options['logarithmic'] === "1") { + $item[$org['Organisation']['name']] = (int) round(log($count, 1.1)); // taking the logarithmic view + } else if(empty($options['logarithmic']) || $options['logarithmic'] === "true" || $options['logarithmic'] === "1"){ + $item[$org['Organisation']['name']] = $count; + } + // if a positive score is detected at least once it's enough to be + // considered for the graph + if($count > 0) { + unset($ghost_orgs[$org['Organisation']['name']]); + } + } + $data['data'][] = $item; + } + $this->filter_ghost_orgs($data, $ghost_orgs); + return $data; + } +} From 6d7d2cbb453aec8c21e4e5af1971067abbab7957 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Tue, 4 Jul 2023 14:59:59 +0200 Subject: [PATCH 07/96] chg: [misp-warninglists] updated --- app/files/warninglists | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/files/warninglists b/app/files/warninglists index 911aafb91..1a94fcd66 160000 --- a/app/files/warninglists +++ b/app/files/warninglists @@ -1 +1 @@ -Subproject commit 911aafb91a38a68bbf6f5474c06e77a039469c93 +Subproject commit 1a94fcd666bbf7eb505d4fbbc47ef6170c375706 From 1e99d7022f1d7802f2cd98dbbada56e66ec935e3 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Tue, 4 Jul 2023 15:01:27 +0200 Subject: [PATCH 08/96] chg: [misp-objects] updated --- app/files/misp-objects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/files/misp-objects b/app/files/misp-objects index 2ca2667d7..da801ab14 160000 --- a/app/files/misp-objects +++ b/app/files/misp-objects @@ -1 +1 @@ -Subproject commit 2ca2667d7668067f906e9601e0c97a79d4c7ccf1 +Subproject commit da801ab146fb622a6447c8d2922a95b6049bb70a From 2962ecbe824acc5f23fc6bcfd6a44b0b37b8077d Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Tue, 4 Jul 2023 15:02:30 +0200 Subject: [PATCH 09/96] chg: [misp-galaxy] updated --- app/files/misp-galaxy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/files/misp-galaxy b/app/files/misp-galaxy index 734d57edf..7028860c0 160000 --- a/app/files/misp-galaxy +++ b/app/files/misp-galaxy @@ -1 +1 @@ -Subproject commit 734d57edf5e76900cd0c8d5d48d6f5910e29b84e +Subproject commit 7028860c0aa8c471324008d3dc651b7ea9e07c0a From 297f0f73a652369a33bffb75e817a1ebcc652698 Mon Sep 17 00:00:00 2001 From: Sura De Silva Date: Fri, 7 Jul 2023 12:30:03 +1000 Subject: [PATCH 10/96] fix: localisation workflow typo --- app/View/Workflows/editor.ctp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/View/Workflows/editor.ctp b/app/View/Workflows/editor.ctp index d5aec5529..566bacee0 100644 --- a/app/View/Workflows/editor.ctp +++ b/app/View/Workflows/editor.ctp @@ -184,7 +184,7 @@ $debugEnabled = !empty($selectedWorkflow['Workflow']['debug_enabled']);