From 0abc658221eb396212a219c29a764a4134e86bc3 Mon Sep 17 00:00:00 2001 From: iglocska Date: Wed, 29 May 2013 16:53:01 +0200 Subject: [PATCH 01/13] Named pipes and mutex - added the 2 types under the artifacts dropped category --- app/Model/Attribute.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/Model/Attribute.php b/app/Model/Attribute.php index d8a192f6b..0b36fc48b 100755 --- a/app/Model/Attribute.php +++ b/app/Model/Attribute.php @@ -134,7 +134,9 @@ class Attribute extends AppModel { 'link' => array('desc' => 'Link to an external information'), 'comment' => array('desc' => 'Comment or description in a human language', 'formdesc' => 'Comment or description in a human language.
This will not be correlated with other attributes (NOT IMPLEMENTED YET)'), 'text' => array('desc' => 'Name, ID or a reference'), - 'other' => array('desc' => 'Other attribute') + 'other' => array('desc' => 'Other attribute'), + 'named pipe' => array('desc' => 'Named pipe, use the format \\.\pipe\'), + 'mutex' => array('desc' => 'Mutex, use the format \BaseNamedObjects\'), ); // definitions of categories @@ -155,7 +157,7 @@ class Attribute extends AppModel { ), 'Artifacts dropped' => array( 'desc' => 'Any artifact (files, registry keys etc.) dropped by the malware or other modifications to the system', - 'types' => array('md5', 'sha1', 'filename', 'filename|md5', 'filename|sha1', 'regkey', 'regkey|value', 'pattern-in-file', 'pattern-in-memory', 'yara', 'attachment', 'malware-sample', 'comment', 'text', 'other') + 'types' => array('md5', 'sha1', 'filename', 'filename|md5', 'filename|sha1', 'regkey', 'regkey|value', 'pattern-in-file', 'pattern-in-memory', 'yara', 'attachment', 'malware-sample', 'comment', 'text', 'other', 'named pipe', 'mutex') ), 'Payload installation' => array( 'desc' => 'Info on where the malware gets installed in the system', @@ -691,6 +693,16 @@ class Attribute extends AppModel { $returnValue = 'Invalid format. Expected: CVE-xxxx-xxxx.'; } break; + case 'named pipe': + if (preg_match('#^(\\\\\\\\.\\\\pipe\\\\)#', $value) && !preg_match("#\n#", $value)) { + $returnValue = true; + } + break; + case 'mutex': + if (preg_match('#^(\\\\BaseNamedObjects\\\\)#', $value) && !preg_match("#\n#", $value)) { + $returnValue = true; + } + break; case 'AS': case 'snort': case 'pattern-in-file': From bd444d3ed8bf63cf15c2e430fed011d59c5703f2 Mon Sep 17 00:00:00 2001 From: iglocska Date: Thu, 30 May 2013 14:01:55 +0200 Subject: [PATCH 02/13] Logos shown in memberslist --- app/View/Users/memberslist.ctp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/View/Users/memberslist.ctp b/app/View/Users/memberslist.ctp index 5990adb7d..058ed742f 100755 --- a/app/View/Users/memberslist.ctp +++ b/app/View/Users/memberslist.ctp @@ -4,13 +4,18 @@ Organisation # of members + Logo     - + + Html->image('orgs/' . h($org['User']['org']) . '.png', array('alt' => h($org['User']['org']),'width' => '48','hight' => '48'));?>  From 0d66ef931a95735ceaa5d56f9d683de37c32f264 Mon Sep 17 00:00:00 2001 From: Christophe Vandeplas Date: Thu, 6 Jun 2013 16:36:28 +0200 Subject: [PATCH 03/13] UI tooltip love --- app/View/Attributes/add.ctp | 61 +++++++++++++----------- app/View/Attributes/edit.ctp | 78 ++++++++++++++++--------------- app/View/Attributes/index.ctp | 13 +++++- app/View/Attributes/search.ctp | 55 ++++++++++------------ app/View/Elements/global_menu.ctp | 2 +- app/View/Events/add.ctp | 42 ++++++++--------- app/View/Events/edit.ctp | 49 ++++++++----------- app/View/Events/view.ctp | 41 +++++++++++----- 8 files changed, 177 insertions(+), 164 deletions(-) diff --git a/app/View/Attributes/add.ctp b/app/View/Attributes/add.ctp index 286f7babd..ddea58463 100755 --- a/app/View/Attributes/add.ctp +++ b/app/View/Attributes/add.ctp @@ -5,18 +5,15 @@ Form->hidden('event_id'); echo $this->Form->input('category', array( - 'after' => $this->Html->div('forminfo', '', array('id' => 'AttributeCategoryDiv')), 'empty' => '(choose one)' )); echo $this->Form->input('type', array( - 'after' => $this->Html->div('forminfo', '', array('id' => 'AttributeTypeDiv')), 'empty' => '(first choose category)' )); if ('true' == Configure::read('CyDefSIG.sync')) { echo $this->Form->input('distribution', array( 'label' => 'Distribution', 'selected' => $maxDist, - 'after' => $this->Html->div('forminfo', '', array('id' => 'AttributeDistributionDiv')) )); } echo $this->Form->input('value', array( @@ -30,18 +27,16 @@ Form->input('to_ids', array( 'checked' => true, - 'after' => $this->Html->div('forminfo', isset($attrDescriptions['signature']['formdesc']) ? $attrDescriptions['signature']['formdesc'] : $attrDescriptions['signature']['desc']), + 'data-content' => isset($attrDescriptions['signature']['formdesc']) ? $attrDescriptions['signature']['formdesc'] : $attrDescriptions['signature']['desc'], 'label' => 'IDS Signature?', )); echo $this->Form->input('batch_import', array( 'type' => 'checkbox', - 'after' => $this->Html->div('forminfo', 'Create multiple attributes one per line'), + 'data-content' => 'Create multiple attributes one per line', )); // link an onchange event to the form elements $this->Js->get('#AttributeCategory')->event('change', 'formCategoryChanged("#AttributeCategory")'); - $this->Js->get('#AttributeType')->event('change', 'showFormInfo("#AttributeType")'); - $this->Js->get('#AttributeDistribution')->event('change', 'showFormInfo("#AttributeDistribution")'); ?> Form->end();
-
diff --git a/app/View/Attributes/add_attachment.ctp b/app/View/Attributes/add_attachment.ctp index 77ab0d569..38a38787e 100755 --- a/app/View/Attributes/add_attachment.ctp +++ b/app/View/Attributes/add_attachment.ctp @@ -42,26 +42,21 @@ echo $this->Form->end();
diff --git a/app/View/Attributes/edit.ctp b/app/View/Attributes/edit.ctp index 2c95bbe9e..1ce2bae02 100755 --- a/app/View/Attributes/edit.ctp +++ b/app/View/Attributes/edit.ctp @@ -46,21 +46,21 @@ echo $this->Form->end();
diff --git a/app/View/Attributes/index.ctp b/app/View/Attributes/index.ctp index 859762b58..7438ad8a5 100755 --- a/app/View/Attributes/index.ctp +++ b/app/View/Attributes/index.ctp @@ -21,7 +21,7 @@ if ($isSearch == 1) { )); echo $this->Paginator->prev('« ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span')); - echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span')); + //echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span')); echo $this->Paginator->next(__('next') . ' »', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span')); ?> @@ -53,45 +53,47 @@ foreach ($attributes as $attribute):
+ onclick="document.location='/events/view/';"> Html->link($attribute['Event']['id'], array('controller' => 'events', 'action' => 'view', $attribute['Event']['id']), array('class' => 'SameOrgLink')); + $class='class="SameOrgLink"'; } else { - echo $this->Html->link($attribute['Event']['id'], array('controller' => 'events', 'action' => 'view', $attribute['Event']['id'])); + $class=''; } $currentCount++; ?> + >
- -   - -   - + +   + +   + Highlight->highlighter($sigDisplay, $replacePairs)); + $sigDisplay = $this->Highlight->highlighter($sigDisplay, $replacePairs); } if ('attachment' == $attribute['Attribute']['type'] || 'malware-sample' == $attribute['Attribute']['type']) { - echo $this->Html->link($sigDisplay, array('controller' => 'attributes', 'action' => 'download', $attribute['Attribute']['id']), array('escape' => FALSE)); + ?>Html->link($sigDisplay, nl2br(h($attribute['Attribute']['value'])), array('escape' => FALSE)); + ?>  - -   + +   + Html->link('', array('action' => 'edit', $attribute['Attribute']['id']), array('class' => 'icon-edit', 'title' => 'Edit')); - echo $this->Form->postLink('',array('action' => 'delete', $attribute['Attribute']['id']), array('class' => 'icon-trash', 'title' => 'Delete'), __('Are you sure you want to delete this attribute?')); - } - echo $this->Html->link('', array('controller' => 'events', 'action' => 'view', $attribute['Attribute']['event_id']), array('class' => 'icon-list-alt', 'title' => 'View')); - ?> + if ($isAdmin || ($isAclModify && $attribute['Event']['user_id'] == $me['id']) || ($isAclModifyOrg && $attribute['Event']['org'] == $me['org'])) { + ?>Form->postLink('',array('action' => 'delete', $attribute['Attribute']['id']), array('class' => 'icon-trash', 'title' => 'Delete'), __('Are you sure you want to delete this attribute?')); + } + ?> +
diff --git a/app/View/Attributes/search.ctp b/app/View/Attributes/search.ctp index 7d6f52557..b7b87fa50 100755 --- a/app/View/Attributes/search.ctp +++ b/app/View/Attributes/search.ctp @@ -166,6 +166,18 @@ $(document).ready(function() { } }); + // workaround for browsers like IE and Chrome that do now have an onmouseover on the 'options' of a select. + // disadvangate is that user needs to click on the item to see the tooltip. + // no solutions exist, except to generate the select completely using html. + $("#AttributeType, #AttributeCategory").on('change', function(e) { + var $e = $(e.target); + $('#'+e.currentTarget.id).popover('destroy'); + $('#'+e.currentTarget.id).popover({ + trigger: 'manual', + placement: 'right', + content: formInfoValues[$e.val()], + }).popover('show'); + }); }); @@ -176,17 +188,17 @@ $(document).ready(function() { Js->writeBuffer(); // Write cached scripts ?>
\ No newline at end of file diff --git a/app/View/Elements/global_menu.ctp b/app/View/Elements/global_menu.ctp index 1e76de380..de6c8b262 100755 --- a/app/View/Elements/global_menu.ctp +++ b/app/View/Elements/global_menu.ctp @@ -4,7 +4,7 @@ From 0cafc7ec6bee2628eff2ff4948fb147c0319fa9f Mon Sep 17 00:00:00 2001 From: Christophe Vandeplas Date: Mon, 10 Jun 2013 12:26:32 +0200 Subject: [PATCH 09/13] fix documentation link --- app/View/Elements/global_menu.ctp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/View/Elements/global_menu.ctp b/app/View/Elements/global_menu.ctp index de6c8b262..4a5017d9f 100755 --- a/app/View/Elements/global_menu.ctp +++ b/app/View/Elements/global_menu.ctp @@ -57,7 +57,7 @@
  • News
  • My Profile
  • Members List
  • -
  • User Guide
  • +
  • User Guide
  • Terms & Conditions
  • Log out
  • From 3ed50e2aeffa424e665f25a761d4bf8e6045bf06 Mon Sep 17 00:00:00 2001 From: Christophe Vandeplas Date: Mon, 10 Jun 2013 17:24:41 +0200 Subject: [PATCH 10/13] improve UI of event index filtering --- app/Controller/EventsController.php | 3 + app/View/Events/index.ctp | 274 +++++++++++++++++----------- app/View/Events/view.ctp | 2 +- 3 files changed, 170 insertions(+), 109 deletions(-) diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index d1376b387..856824932 100755 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -87,6 +87,9 @@ class EventsController extends AppController { public function index() { // list the events + // TODO information exposure vulnerability - as we don't limit the filter depending on the CyDefSIG.showorg parameter + // this filter will work if showorg=false and users will be able to perform the filtering and see what events were posted by what org. + // same goes for orgc in all cases //transform POST into GET if($this->request->is("post")) { $url = array('action'=>'index'); diff --git a/app/View/Events/index.ctp b/app/View/Events/index.ctp index 5671b96e9..ec58b9a72 100755 --- a/app/View/Events/index.ctp +++ b/app/View/Events/index.ctp @@ -7,130 +7,206 @@ - Form->create('', array('action' => 'index', 'style' => 'margin-bottom:0px')); ?> -
    -
    -
    + Form->create('', array('action' => 'index', 'style' => 'margin-bottom:0px')); + ?> + - - passedArgs as $k => $v) { - if ((substr($k, 0, 6) === 'search')) { - $searchTerm = substr($k, 6); - if ($searchTerm === 'published') { - switch ($v) { - case '0' : - $value = 'No'; - break; - case '1' : - $value = 'Yes'; - break; - case '2' : - continue 2; - break; - } - } else { - if (!$v) { - continue; - } - $value = $v; - } - ?> - +
    :
    + passedArgs as $k => $v) { + if ((substr($k, 0, 6) === 'search')) { + $searchTerm = substr($k, 6); + if ($searchTerm === 'published') { + switch ($v) { + case '0' : + $value = 'No'; + break; + case '1' : + $value = 'Yes'; + break; + case '2' : + continue 2; + break; + } + } else { + if (!$v) { + continue; + } + $value = $v; + } + ?> + + 0) { - ?> - - -
    + : + Html->link('', array('controller' => 'events', 'action' => 'index'), array('class' => 'icon-remove', 'title' => 'Remove filters'));?>
    - Form->end(); - ?> + if ($count > 0) { + ?> + + Html->link('', array('controller' => 'events', 'action' => 'index'), array('class' => 'icon-remove', 'title' => 'Remove filters'));?> + + + + + - + + if ('true' == Configure::read('CyDefSIG.showorg') || $isAdmin) { + if ($isSiteAdmin) { ?> - + - + - + - + - + + + Form->end(); + ?>
    Paginator->sort('published', 'Valid.');?>
    + Paginator->sort('published', 'Valid.');?> + +
    + Form->input('searchpublished', array( + 'options' => array('0' => 'No', '1' => 'Yes', '2' => 'Any'), + 'default' => 2, + 'label' => '', + 'class' => 'input-mini', + 'onchange' => "$('#EventIndexForm').submit()" + )); + ?> +
    +
    Paginator->sort('org'); ?> Paginator->sort('org'); ?>
    Paginator->sort('org'); ?> + + Paginator->sort('owner org');?>
    + Paginator->sort('owner org');?> + +
    + Form->input('searchorgc', array( + 'value' => $this->passedArgs['searchorgc'], + 'label' => '', + 'class' => 'input-mini')); + ?> +
    +
    Paginator->sort('id');?> Paginator->sort('attribute_count', '#Attr.');?> Paginator->sort('user_id', 'Email');?> Paginator->sort('date');?>
    + Paginator->sort('date');?> + +
    +
    + Form->input('searchDatefrom', array( + 'value' => $this->passedArgs['searchDatefrom'], + 'label' => false, + 'div' => false, + 'class' => 'span1 datepicker', + )); + ?> + + Form->input('searchDateuntil', array( + 'value' => $this->passedArgs['searchDateuntil'], + 'label' => false, + 'class' => 'span1 datepicker', + 'div' => false + )); + ?> +
    +
    Paginator->sort('risk');?> Paginator->sort('analysis');?> Paginator->sort('info');?>
    + Paginator->sort('info');?> + +
    + Form->input('searchinfo', array( + 'value' => $this->passedArgs['searchinfo'], + 'label' => '', + 'class' => 'input-large')); + ?> +
    +
    Paginator->sort('distribution');?> Actions
    @@ -239,37 +315,19 @@ \ No newline at end of file diff --git a/app/View/Events/view.ctp b/app/View/Events/view.ctp index 4c0ec7de3..3f4560054 100755 --- a/app/View/Events/view.ctp +++ b/app/View/Events/view.ctp @@ -11,7 +11,7 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
  • Html->link('Add Attribute', array('controller' => 'attributes', 'action' => 'add', $event['Event']['id']));?>
  • Html->link('Add Attachment', array('controller' => 'attributes', 'action' => 'add_attachment', $event['Event']['id']));?>
  • -
  • Html->link('Populate event from IOC', array('controller' => 'events', 'action' => 'addIOC', $event['Event']['id']));?>
  • +
  • Html->link('Populate from IOC', array('controller' => 'events', 'action' => 'addIOC', $event['Event']['id']));?>
  • Html->link('Propose Attribute', array('controller' => 'shadow_attributes', 'action' => 'add', $event['Event']['id']));?>
  • Html->link('Propose Attachment', array('controller' => 'shadow_attributes', 'action' => 'add_attachment', $event['Event']['id']));?>
  • From e0c0e7ccf5dde3cafab59823090eff31211a363b Mon Sep 17 00:00:00 2001 From: Christophe Vandeplas Date: Mon, 10 Jun 2013 17:57:20 +0200 Subject: [PATCH 11/13] unified links --- app/View/Events/add.ctp | 12 ++++---- app/View/Events/add_i_o_c.ctp | 32 +++++++++++++--------- app/View/Events/automation.ctp | 12 ++++---- app/View/Events/contact.ctp | 34 +++++++++++++---------- app/View/Events/edit.ctp | 30 ++++++++++---------- app/View/Events/export.ctp | 12 ++++---- app/View/Events/index.ctp | 50 +++++----------------------------- app/View/Events/view.ctp | 30 ++++++++++---------- 8 files changed, 94 insertions(+), 118 deletions(-) diff --git a/app/View/Events/add.ctp b/app/View/Events/add.ctp index 244dda8c0..a8d12e3b9 100755 --- a/app/View/Events/add.ctp +++ b/app/View/Events/add.ctp @@ -38,17 +38,17 @@ echo $this->Form->end();
    diff --git a/app/View/Events/add_i_o_c.ctp b/app/View/Events/add_i_o_c.ctp index ce834fc69..35ad77b23 100644 --- a/app/View/Events/add_i_o_c.ctp +++ b/app/View/Events/add_i_o_c.ctp @@ -16,26 +16,32 @@ echo $this->Form->end();
    \ No newline at end of file diff --git a/app/View/Events/automation.ctp b/app/View/Events/automation.ctp index 104ee9467..0819526e8 100644 --- a/app/View/Events/automation.ctp +++ b/app/View/Events/automation.ctp @@ -58,17 +58,17 @@ This would enable you to export:

    diff --git a/app/View/Events/contact.ctp b/app/View/Events/contact.ctp index 8ac364a29..c27bb3965 100755 --- a/app/View/Events/contact.ctp +++ b/app/View/Events/contact.ctp @@ -35,26 +35,32 @@ $mayPublish = ($isAclPublish && $this->request->data['Event']['orgc'] == $me['or
    -
    \ No newline at end of file + diff --git a/app/View/Events/edit.ctp b/app/View/Events/edit.ctp index 35a8dfc8f..916632009 100755 --- a/app/View/Events/edit.ctp +++ b/app/View/Events/edit.ctp @@ -36,35 +36,37 @@ echo $this->Form->end();
    +