<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="http://arnaudloos.com/feed.xml" rel="self" type="application/atom+xml" /><link href="http://arnaudloos.com/" rel="alternate" type="text/html" /><updated>2019-10-29T18:23:19-04:00</updated><id>http://arnaudloos.com/</id><title type="html">Arnaud Loos</title><subtitle>All things IT</subtitle><author><name>arnaud</name></author><entry><title type="html">Elasticsearch 7.4 - Snapshot and Restore</title><link href="http://arnaudloos.com/2019/elasticsearch-snapshot-and-restore/" rel="alternate" type="text/html" title="Elasticsearch 7.4 - Snapshot and Restore" /><published>2019-10-03T12:00:00-04:00</published><updated>2019-10-03T12:00:00-04:00</updated><id>http://arnaudloos.com/2019/elasticsearch-snapshot-and-restore</id><content type="html" xml:base="http://arnaudloos.com/2019/elasticsearch-snapshot-and-restore/">&lt;p&gt;The recent 7.4 release of the ELK stack now includes the ability to snapshot (backup) and restore indices from within Kibana as well as manage repositories and policies. In this walkthrough we’ll configure Elasticsearch to snapshot to an Amazon S3 bucket. Note that Azure and Google Cloud are supported as well.&lt;/p&gt;

&lt;p&gt;In short we’ll be creating a new S3 bucket, creating an IAM account with permissions to just the new bucket, installing the Elasticsearch &lt;a href=&quot;https://www.elastic.co/guide/en/elasticsearch/plugins/7.4/repository-s3.html&quot;&gt;S3 Repository Plugin&lt;/a&gt;, creating a repository, and creating an associated Policy to specify which indexes to backup and how often. I’ll then test restoring a single index with a new name.&lt;/p&gt;

&lt;h4 id=&quot;configure-aws&quot;&gt;Configure AWS&lt;/h4&gt;

&lt;p&gt;Let’s start by logging into AWS and navigating to S3.&lt;/p&gt;

&lt;p&gt;Create a new S3 bucket. I’m calling mine “filebeat-backup”.&lt;br /&gt;
Accept all the other defaults and create the bucket.&lt;/p&gt;

&lt;p&gt;Now navigate to &lt;a href=&quot;https://console.aws.amazon.com/iam/home&quot;&gt;IAM&lt;/a&gt; in the AWS console.&lt;br /&gt;
Users &amp;gt; Add User.&lt;br /&gt;
I’m naming my user &lt;code class=&quot;highlighter-rouge&quot;&gt;es-backup&lt;/code&gt; and giving the account &lt;code class=&quot;highlighter-rouge&quot;&gt;Progmatic Access&lt;/code&gt;.&lt;br /&gt;
On the Set Permissions screen select &lt;code class=&quot;highlighter-rouge&quot;&gt;Attach existing policies directly&lt;/code&gt;.&lt;br /&gt;
Click the &lt;code class=&quot;highlighter-rouge&quot;&gt;Create policy&lt;/code&gt; button.&lt;br /&gt;
A new window opens. Click &lt;code class=&quot;highlighter-rouge&quot;&gt;JSON&lt;/code&gt; tab.&lt;/p&gt;

&lt;p&gt;Copy over the plugin’s &lt;a href=&quot;https://www.elastic.co/guide/en/elasticsearch/plugins/7.4/repository-s3-repository.html&quot;&gt;recommended policy&lt;/a&gt; and be sure to change the bucket name (&lt;code class=&quot;highlighter-rouge&quot;&gt;arn:aws:s3:::filebeat-backup&lt;/code&gt;) twice.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{
  &quot;Version&quot;: &quot;2012-10-17&quot;,
  &quot;Statement&quot;: [
    {
      &quot;Action&quot;: [
        &quot;s3:ListBucket&quot;,
        &quot;s3:GetBucketLocation&quot;,
        &quot;s3:ListBucketMultipartUploads&quot;,
        &quot;s3:ListBucketVersions&quot;
      ],
      &quot;Effect&quot;: &quot;Allow&quot;,
      &quot;Resource&quot;: [
        &quot;arn:aws:s3:::filebeat-backup&quot;
      ]
    },
    {
      &quot;Action&quot;: [
        &quot;s3:GetObject&quot;,
        &quot;s3:PutObject&quot;,
        &quot;s3:DeleteObject&quot;,
        &quot;s3:AbortMultipartUpload&quot;,
        &quot;s3:ListMultipartUploadParts&quot;
      ],
      &quot;Effect&quot;: &quot;Allow&quot;,
      &quot;Resource&quot;: [
        &quot;arn:aws:s3:::filebeat-backup/*&quot;
      ]
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Give the new policy a name.&lt;br /&gt;
Close this window and go back to the window to set permissions. Hit the refresh button and search for your new policy name. Check the box next to it and hit &lt;code class=&quot;highlighter-rouge&quot;&gt;Next&lt;/code&gt;.&lt;br /&gt;
No tags. Create User.&lt;/p&gt;

&lt;p&gt;Be sure to copy the access key and secret key from the next screen and then hit &lt;code class=&quot;highlighter-rouge&quot;&gt;Close&lt;/code&gt;.&lt;/p&gt;

&lt;h4 id=&quot;configure-elasticsearch-nodes&quot;&gt;Configure Elasticsearch Nodes&lt;/h4&gt;

&lt;p&gt;You’ll have to perform the following on each of your Elasticsearch nodes.&lt;/p&gt;

&lt;p&gt;SSH to the first node and execute the following to install the S3 plugin.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo bin/elasticsearch-plugin install repository-s3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You should see the following:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@1375dd8ff618 bin]# elasticsearch-plugin install repository-s3
-&amp;gt; Downloading repository-s3 from elastic
[=================================================] 100%?? 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@     WARNING: plugin requires additional permissions     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.lang.RuntimePermission accessDeclaredMembers
* java.lang.RuntimePermission getClassLoader
* java.lang.reflect.ReflectPermission suppressAccessChecks
* java.net.SocketPermission * connect,resolve
* java.util.PropertyPermission es.allow_insecure_settings read,write
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.

Continue with installation? [y/N]y
-&amp;gt; Installed repository-s3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We now need to add our AWS IAM credentials to the Elasticsearch keystore with the following commands.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bin/elasticsearch-keystore add s3.client.default.access_key  
bin/elasticsearch-keystore add s3.client.default.secret_key  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You should see the following:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@1375dd8ff618 bin]# elasticsearch-keystore add s3.client.default.access_key
Enter value for s3.client.default.access_key: 
[root@1375dd8ff618 bin]# elasticsearch-keystore add s3.client.default.secret_key
Enter value for s3.client.default.secret_key: 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;If you paste in a value you won’t see it appear on the screen, don’t worry it’s there, just hit Enter after you paste it.&lt;/p&gt;

&lt;p&gt;Now reboot this node and make sure the cluster health is back to green before moving on to the next node.&lt;/p&gt;

&lt;p&gt;Once all the nodes have rebooted and the Cluster state is green open Kibana Dev Tools and run:&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;POST _nodes/reload_secure_settings&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;configure-the-repository-and-policy&quot;&gt;Configure the Repository and Policy&lt;/h4&gt;

&lt;p&gt;Note that I just intend to backup my filebeat-* indices with the policy below. If you want to backup all your indices it’s even simpler as that’s the default.&lt;/p&gt;

&lt;p&gt;In Kibana navigate to Management &amp;gt; Snapshot and Restore.&lt;br /&gt;
Select the Repository tab and press &lt;code class=&quot;highlighter-rouge&quot;&gt;Register a Repository&lt;/code&gt;.&lt;br /&gt;
You should see AWS S3 listed next to “Shared file system” and “Read-only URL”.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/snapshot-repo-aws.png&quot; alt=&quot;AWS Repo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Give the repository a name (I chose “filebeat-repo”) and select AWS S3.&lt;br /&gt;
Fill in the AWS Bucket name (For me that’s “filebeat-backup”).&lt;br /&gt;
It will use a client name of default by default which is fine since that’s the key you set in the keystore earlier.&lt;/p&gt;

&lt;p&gt;Save the repo and hit the &lt;code class=&quot;highlighter-rouge&quot;&gt;Verify&lt;/code&gt; button. It should show all of your nodes as Connected.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/snapshot-repo-verify.png&quot; alt=&quot;Verify Repo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now in Kibana go to the &lt;code class=&quot;highlighter-rouge&quot;&gt;Policies&lt;/code&gt; tab under Snapshot and Restore.&lt;br /&gt;
Click &lt;code class=&quot;highlighter-rouge&quot;&gt;Create a Policy&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Name: daily-filebeat
Snapshot name: &amp;lt;daily-filebeat-{now/d}&amp;gt;
Repository: filebeat-repo
Schedule: default (9:30 PM)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;On the snapshot settings page de-select &lt;code class=&quot;highlighter-rouge&quot;&gt;All Indices&lt;/code&gt; and typed in &lt;code class=&quot;highlighter-rouge&quot;&gt;filebeat-*&lt;/code&gt;. You can choose to leave &lt;code class=&quot;highlighter-rouge&quot;&gt;All Indices&lt;/code&gt; selected.&lt;br /&gt;
Be sure you’re selecting Index Patterns and not individual Indices when you do this.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/snapshot-policy.png&quot; alt=&quot;Snapshot Policy&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Create the policy.&lt;/p&gt;

&lt;p&gt;On the &lt;code class=&quot;highlighter-rouge&quot;&gt;Policies&lt;/code&gt; tab click the play button next to your new policy in order to run it now.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/snapshot-in-progress.png&quot; alt=&quot;Snapshot in progress&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once complete, if you go back to the AWS console and check the bucket &lt;code class=&quot;highlighter-rouge&quot;&gt;Overview&lt;/code&gt; tab you should see new files.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/snapshot-s3-bucket-full.png&quot; alt=&quot;AWS Bucket full&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;restoring&quot;&gt;Restoring&lt;/h4&gt;

&lt;p&gt;Let’s test restoring a single Index to a new Index name.&lt;/p&gt;

&lt;p&gt;Go to the &lt;code class=&quot;highlighter-rouge&quot;&gt;Snapshots&lt;/code&gt; tab and to the far right click the down arrow next to the trashcan to start a restore.&lt;/p&gt;

&lt;p&gt;I’m selecting just a single Index and underneath I’m selecting the option to &lt;code class=&quot;highlighter-rouge&quot;&gt;rename indices&lt;/code&gt;. I then supply the original name pattern and my new name. Note that I used &lt;code class=&quot;highlighter-rouge&quot;&gt;restored-filebeat&lt;/code&gt; but should have used &lt;code class=&quot;highlighter-rouge&quot;&gt;restored-filebeat-&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/snapshot-restore-settings.png&quot; alt=&quot;Restore settingsepo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Start the restore and watch the progress.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/snapshot-restore-in-progress.png&quot; alt=&quot;restore in Progress&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You’ll see when the restore is complete.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/snapshot-restore-complete.png&quot; alt=&quot;Restore Complete&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now go check that the new Index name exists.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/snapshot-restored-index.png&quot; alt=&quot;restored Index&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I then created a Kibana Index pattern for &lt;code class=&quot;highlighter-rouge&quot;&gt;restore-*&lt;/code&gt; and after adjusting my timeframe verified that all the logs were present.&lt;/p&gt;</content><author><name>Arnaud Loos</name></author><category term="[&quot;elasticsearch&quot;]" /><summary type="html">The recent 7.4 release of the ELK stack now includes the ability to snapshot (backup) and restore indices from within Kibana as well as manage repositories and policies. In this walkthrough we’ll configure Elasticsearch to snapshot to an Amazon S3 bucket. Note that Azure and Google Cloud are supported as well.</summary></entry><entry><title type="html">Siemplify SOAR to Elastic Common Schema Mapping</title><link href="http://arnaudloos.com/2019/siemplify-ecs-mapping/" rel="alternate" type="text/html" title="Siemplify SOAR to Elastic Common Schema Mapping" /><published>2019-08-26T12:00:00-04:00</published><updated>2019-08-26T12:00:00-04:00</updated><id>http://arnaudloos.com/2019/siemplify-ecs-mapping</id><content type="html" xml:base="http://arnaudloos.com/2019/siemplify-ecs-mapping/">&lt;p&gt;This is a sample mapping of connector, entity, and system fields required by &lt;a href=&quot;https://www.siemplify.co/&quot;&gt;Siemplify&lt;/a&gt; to source events in Elasticsearch mapped to the &lt;a href=&quot;https://www.elastic.co/guide/en/ecs/current/ecs-reference.html&quot;&gt;Elastic Common Schema&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For this to be valid you must be storing your logs in Elasticsearch using ECS as well.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ECS is essentially a field naming convention adopted by Elasticsearch for use within its products. As the engineers at Elastic develop new dashboards (like for the new SIEM App in 7.2), and new machine learning jobs (a SIEM App improvement in 7.3), they will do so using  ECS defined fields. All of the 7.x Beats agents already use ECS to name their fields (and provide a good reference to those just starting with ECS). What this means for the end-user is that if you map your incoming logs to use ECS field names before the document is stored in Elasticsearch, then many of the dashboards and machine learning jobs will work without any further effort on your part. If you decide instead to keep your current field names then you’ll have to re-map all the existing visualizations and ML jobs to your custom fields.&lt;/p&gt;

&lt;p&gt;So now that you’re storing log fields in Elasticsearch using ECS we need to map those fields to the Siemplify schema. What follows is my suggested mapping, subject to change.&lt;/p&gt;

&lt;p&gt;You’ll notice that some Siemplify fields reference the same ECS field, such as DestinationDnsDomain and DestinationNtDomain. In these cases it may be necessary to use the Siemplify transform function EXTRACT_BY_REGEX in order to capture a subset of the ECS field to use.&lt;/p&gt;

&lt;p&gt;I also have a &lt;a href=&quot;/assets/files/Siemplify-ECS-Mapping.ods&quot;&gt;spreadsheet available for download&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update Aug 27:&lt;/strong&gt; Having just discovered that ECS version 1.1 was recently released I’ve made some modifications to the process and file hash field mappings.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Siemplify Connector Setting&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;ECS Field&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Product Field Name&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;event.module&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Event Field Name&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;event.category&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Alert Name Field&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;event.action&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Timestamp Field&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;@timestamp&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Siemplify Entity Mapping&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;ECS Extracted Field&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;ECS Alternative Field&lt;/th&gt;
      &lt;th&gt;ECS Alternative Field&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;SourceUserName&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;user.name&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;SourceHostName&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;source.hostname&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;client.hostname&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;DestinationUserName&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;user.name&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;DestinationHostName&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;destination.hostname&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;server.hostname&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;SourceAddress&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;source.ip&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;client.ip&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;DestinationAddress&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;destination.ip&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;server.ip&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;SourceProcessName&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;process.pid&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;process.name&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;DestinationProcessName&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;process.pid&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;process.name&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;DestinationURL&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;url.full&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;url.original&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;FileName&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;file.name&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;FileHash&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;hash.md5&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;hash.sha1&lt;/td&gt;
      &lt;td&gt;hash.sha256&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;EmailSubject&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;email.subject&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;USB&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Deployment&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;DestinationMacAddress&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;destination.mac&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;server.mac&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;SourceMacAddress&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;source.mac&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;client.mac&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;CreditCard&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;PhoneNumber&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;CVE&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;ThreatActor&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;ThreatCampaign&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;ThreatSignature&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;GenericEntity&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;Siemplify System Field&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;ECS Extracted Field&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;ECS Alternative Field&lt;/th&gt;
      &lt;th&gt;ECS Alternative Field&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;StartTime&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;event.start&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;@timestamp&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;EndTime&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;event.end&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Message&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;message&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;event.original&lt;/td&gt;
      &lt;td&gt;log.original&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Name&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;event.action&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;CategoryOutcome&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;event.outcome&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;DestinationDnsDomain&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;destination.domain&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;server.domain&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;DestinationNtDomain&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;destination.domain&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;server.domain&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;DestinationPort&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;destination.port&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;server.port&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;SourceDnsDomain&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;source.domain&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;client.domain&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;SourceNtDomain&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;source.domain&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;client.domain&lt;/td&gt;
      &lt;td&gt;user.domain&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;</content><author><name>Arnaud Loos</name></author><summary type="html">This is a sample mapping of connector, entity, and system fields required by Siemplify to source events in Elasticsearch mapped to the Elastic Common Schema.</summary></entry><entry><title type="html">Elasticsearch snapshots to Windows share</title><link href="http://arnaudloos.com/2019/elasticsearch-snapshots-windows-share/" rel="alternate" type="text/html" title="Elasticsearch snapshots to Windows share" /><published>2019-07-29T12:00:00-04:00</published><updated>2019-07-29T12:00:00-04:00</updated><id>http://arnaudloos.com/2019/elasticsearch-snapshots-windows-share</id><content type="html" xml:base="http://arnaudloos.com/2019/elasticsearch-snapshots-windows-share/">&lt;p&gt;I recently had a need to &lt;a href=&quot;https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html&quot;&gt;snapshot&lt;/a&gt; the data from an Elasticsearch cluster to a Windows share on the network. I encountered some issues so I’ll post the steps that worked for me below. I’m running Elasticsearch on Ubuntu 18.04.&lt;/p&gt;

&lt;p&gt;The Elasticsearch instructions for a &lt;a href=&quot;https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html#_shared_file_system_repository&quot;&gt;shared file system repository&lt;/a&gt; seem to indicate that you can use a UNC path directly but I didn’t find this to be the case. I ended up mounting the Windows share locally with fstab and then referencing the local mount point. Note that you have to mount the share and modify elasticsearch.yml on each Elasticsearch node in your cluster.&lt;/p&gt;

&lt;p&gt;First we need to make sure the necessary packages are installed.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;apt install cifs-utils&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we need to find the User ID of our Elasticsearch user. You will use this in the fstab entry.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;id -u elasticsearch&lt;/code&gt;. For me this ID is 112.&lt;/p&gt;

&lt;p&gt;Let’s create out local mount point.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo mkdir /mnt/elastic&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Before we modify fstab our Windows share should be accessible. My share name is &lt;code class=&quot;highlighter-rouge&quot;&gt;elastic&lt;/code&gt; and I created a new Windows user named &lt;code class=&quot;highlighter-rouge&quot;&gt;esbackup&lt;/code&gt; that has write permissions to the share and file system.&lt;/p&gt;

&lt;p&gt;Now on the Elasticsearch host we modify fstab.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo nano /etc/fstab&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add the following line.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;//&amp;lt;windows_server_IP/&amp;lt;share_name&amp;gt;  /mnt/elastic  cifs  user=esbackup,password=password,uid=112,vers=3.0  0  0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Replace the &lt;code class=&quot;highlighter-rouge&quot;&gt;112&lt;/code&gt; above with the UID of your elasticsearch user.&lt;/p&gt;

&lt;p&gt;Now mount the share.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo mount -a&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Test the mount by navigating to the share and creating a test file.&lt;/p&gt;

&lt;p&gt;Add path.repo in elasticsearch.yml.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;path.repo: [&quot;/mnt/elastic&quot;]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Restart elasticsearch service (on each node).&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;systemctl restart elasticsearch&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now login to Kibana and navigate to Dev Tools. We’re going to create a snapshot repository at our new mount point.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;PUT /_snapshot/my_backup_repo
{
  &quot;type&quot;: &quot;fs&quot;,
  &quot;settings&quot;: {
    &quot;location&quot;: &quot;/mnt/elastic&quot;,
    &quot;compress&quot;: true
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Hopefully &lt;code class=&quot;highlighter-rouge&quot;&gt;acknowledged: true&lt;/code&gt; is returned.&lt;/p&gt;

&lt;p&gt;Now check to make sure the repository is registered.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;GET /_snapshot/_all&lt;/code&gt;&lt;br /&gt;
You should see essentially the same JSON block that you entered a moment ago returned back to you showing the repository name and location.&lt;/p&gt;

&lt;p&gt;Now write your first snapshot.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;PUT /_snapshot/my_backup_repo/%3Csnapshot-%7Bnow%2Fd%7D%3E?wait_for_completion=true&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you’re following along in the elasticsearch.log you’ll see the following line.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;[INFO ][o.e.s.SnapshotsService   ] [snap1] snapshot [my_backup_repo:snapshot-2019.07.26/Bw8UwYFoRcmGvbrTPs7wvw] started
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can check the status of the snapshot with the following command. Note that the way I’m naming the snapshot causes the date to be appended.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;GET /_snapshot/my_backup_repo/snapshot-2019.07.26&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you check the Windows folder you should see lots of new files.&lt;/p&gt;</content><author><name>Arnaud Loos</name></author><category term="[&quot;elasticsearch&quot;]" /><summary type="html">I recently had a need to snapshot the data from an Elasticsearch cluster to a Windows share on the network. I encountered some issues so I’ll post the steps that worked for me below. I’m running Elasticsearch on Ubuntu 18.04.</summary></entry><entry><title type="html">Siemplify SOAR Overview</title><link href="http://arnaudloos.com/2019/siemplify-soar-overview/" rel="alternate" type="text/html" title="Siemplify SOAR Overview" /><published>2019-07-23T12:00:00-04:00</published><updated>2019-07-23T12:00:00-04:00</updated><id>http://arnaudloos.com/2019/siemplify-soar-overview</id><content type="html" xml:base="http://arnaudloos.com/2019/siemplify-soar-overview/">&lt;p&gt;I’ve been fortunate to have spent the last few months working with &lt;a href=&quot;https://www.siemplify.co/&quot;&gt;Siemplify&lt;/a&gt; and watching it evolve from version 4 to the recently released version 5. Siemplify is a SOAR solution which stands for Security Orchestration, Automation, and Response. It enables case management and the running of Playbooks on incoming alerts, with the goal of reducing the amount of time an analyst must spend on repetitive tasks which can be easily automated. After an enrichment phase the analyst can better make quick, informed decisions as to how to proceed, and can be assured that actions performed are as expected without the possibility of forgetting or missing a step.&lt;/p&gt;

&lt;p&gt;Below I’ll do a high-level introduction of Siemplify’s main tabs, and in later posts I’ll dive deeper into playbook creation and case management.&lt;/p&gt;

&lt;p&gt;We’ll start with the Analyst Homepage. On this screen each analyst can track their assigned tasks and cases, as well as setup shortcuts to their frequently accessed files and links. A scrolling announcements side-bar allows the SOC Manager to keep the whole team up-to-date with current events.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/siemplify-homepage.png&quot; alt=&quot;Siemplify homepage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Siemplify requires a connector to an event source in order to ingest alerts. Numerous connectors are available to various SIEM platforms, as well as Email mailboxes, ServiceNow, and for many of the products listed in their Marketplace.&lt;/p&gt;

&lt;p&gt;Below I’m connecting to Elasticsearch 7.2. Along with server and user connection details we also do some preliminary field mapping of product, event, and alert name fields. These can be pulled from the testing tab after a test connection has been established.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/siemplify-es-connector.png&quot; alt=&quot;Siemplify homepage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once a connector has been established to an alert source, some additional field mappings must take place. Siemplify has its own internal schema and requires that the fields from the alert be mapped to its entity fields. Example entity fields would be SourceUserName, DestinationHostName, DestinationDomain, FileHash, URL, etc. Along with this field mapping you must select a Visual Model which best represents the relationship of the entities. This Visual Model determines how the various entities are connected together. For example, in most Visual Models SourceHostName and SourceAddress would be linked because the machine’s IP address is linked to its name.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/siemplify-model-families.png&quot; alt=&quot;Siemplify homepage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now that we’re properly parsing our alerts it’s time to start working with them. In order to do so we must first visit the Siemplify Marketplace (from within the application) and install all the Integrations we want to use. Some will require very little configuration while most will require an API key and credentials.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/siemplify-marketplace.png&quot; alt=&quot;Siemplify homepage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Navigating to the Cases tab will show us all the cases that are open within Siemplify, regardless of the analyst assigned. From here we can take ownership of a case and begin to work it.&lt;/p&gt;

&lt;p&gt;The Overview tab will show us one or more alerts grouped within the case. These alerts correspond to events listed on the Events tab. We can see a timeline display of the events as well as any Insights that have been called-out from running a playbook. The Playbook pane on the bottom shows us the playbooks attached to the alert as well as their status.&lt;/p&gt;

&lt;p&gt;Entities mapped earlier are shown in the right-hand column along with additional case details. Clicking on an entity will take you to it’s details page where you can see statistics about where this entity has been seen before.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/siemplify-cases.png&quot; alt=&quot;Siemplify homepage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The playbooks that run against alerts are designed on the Playbooks tab. Each playbook must contain one trigger and at least one action. Actions are scoped to entities. So you may start with the Active Directory action to “Enrich Entities” and scope that to just “Internal User” entities. Siemplify is able to make this determination because during setup you told it about all the Domain names you own. So when it sees &lt;code class=&quot;highlighter-rouge&quot;&gt;sallie@corp.local&lt;/code&gt; and you have &lt;code class=&quot;highlighter-rouge&quot;&gt;corp.local&lt;/code&gt; defined as an internal Domain, it knows Sallie is internal. The same method can be used for nework actions such as Palo Alto’s “Add IP to Block Group” action. We scope this to “External IPs” and Siemplify will make that determination based on the network ranges you have defined.&lt;/p&gt;

&lt;p&gt;When a playbook action runs, such as Active Directory’s “Enrich Entity”, it results in Siemplify gaining additional data about an entity (enrichment). With this method we gain additional data points such as LastLogonTime. Enriching through your AV solution may allow you to associate a machine name to the IP from the alert, as well as list the last scan results. Based on the result of the last scan we can add a branching conditional to our playbook to execute one sequence of actions if the scan reports clean, and a different set of actions if there’s an infection. If the machine is infected we may want to contain it until the analyst can review the case. This is how you build out a playbook. Ideally your procedure for handling each alert is already defined and Siemplify is merely automating the execution of actions you’ve previously been doing manually.&lt;/p&gt;

&lt;p&gt;You can automate as much or as little as you want on an alert. Many environments will want to run an enrichment playbook to ensure as much data as possible is attached to the case when the analyst begins their investigation. Some alert categories may need some automated decisions to occur to filter down their numbers before an analyst sees them, and others can be fully automated away.&lt;/p&gt;

&lt;p&gt;As you can see below, building the playbook means dragging the desired action from the left-hand column and placing it in the proper step in the sequence. Then it’s just a matter of ensuring you have the right information coming from the action outputs to feed into the next action inputs.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/siemplify-playbooks.png&quot; alt=&quot;Siemplify homepage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Version 5 of Siemplify includes a new expression builder component. With the expression builder you can look at the JSON results of a previous action in the playbook and target its fields directly.&lt;/p&gt;

&lt;p&gt;The image below is the example output from the McAfeeNSM “Get Alert Data” action. This allows me to select any placeholder field from the list when designing my playbook, allowing me to see what the data in that field will look like for a real alert. This is very useful if for example I want to select a specific field from the previous action’s output as input to my current action.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/siemplify-json-expression-builder.png&quot; alt=&quot;Siemplify homepage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The final components to note are the Dashboards page and the new War Room.&lt;/p&gt;

&lt;p&gt;Dashboards and Reports allow you to keep track of your SOC metrics and guage your analyst’s closure rate. Siemplify includes both of these capabilities but I won’t explore this much other than to show the example dashboard below. With the next release all the dashboarding and reporting will be changing for the better so stay tuned.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/siemplify-dashboard.png&quot; alt=&quot;Siemplify homepage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The War Room is a new feature allowing the SOC to “Raise an Incident” and coordinate activities with outside parties. The key here is the ability to invite anyone, anywhere into the War Room where they can stay apprised of what’s happening as well as contribute their updates. The people you invite don’t need to have Siemplify accounts or licenses, but are still able to share their updates with the group. The War Room administrator can set check-in deadlines for status report updates and update all departments through one interface. It’s completely up to you under what circumstances you choose to start a new incident.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/siemplify-war-room.png&quot; alt=&quot;Siemplify homepage&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I hope you enjoyed this overview. In future posts I’ll dive deeper into specific playbooks to really see how automation can allow analysts to focus on the most important cases. We’ll also explore ways of gracefully handling those less-critical alerts that would otherwise go unhandled.&lt;/p&gt;</content><author><name>Arnaud Loos</name></author><category term="[&quot;security&quot;]" /><summary type="html">I’ve been fortunate to have spent the last few months working with Siemplify and watching it evolve from version 4 to the recently released version 5. Siemplify is a SOAR solution which stands for Security Orchestration, Automation, and Response. It enables case management and the running of Playbooks on incoming alerts, with the goal of reducing the amount of time an analyst must spend on repetitive tasks which can be easily automated. After an enrichment phase the analyst can better make quick, informed decisions as to how to proceed, and can be assured that actions performed are as expected without the possibility of forgetting or missing a step.</summary></entry><entry><title type="html">High-level PCAP Analysis</title><link href="http://arnaudloos.com/2019/high-level-pcap-analysis/" rel="alternate" type="text/html" title="High-level PCAP Analysis" /><published>2019-06-30T12:00:00-04:00</published><updated>2019-06-30T12:00:00-04:00</updated><id>http://arnaudloos.com/2019/high-level-pcap-analysis</id><content type="html" xml:base="http://arnaudloos.com/2019/high-level-pcap-analysis/">&lt;p&gt;PCAP files play a critical role in network troubleshooting and security. When an issue arrises and Developers are pointing at the SysAdmin who are pointing at the Network Admins, a PCAP capture will give you the unbiased answer. Depending on the amount of traffic and length of the capture however, these files can be extremely daunting to look at when first opened. Where do you start in a capture with 200,000 entries?&lt;/p&gt;

&lt;p&gt;Often you don’t need to dig into individual packets to get the answer you’re looking for. Even if you do end up there, you still need a place to start. In this post I’ll be looking at three different ways to get a high-level overview of the traffic in your PCAP. The goal is to give you a sense of who the high traffic endpoints are, where they reside, and who they’re communicating with.&lt;/p&gt;

&lt;h4 id=&quot;grassmarlin&quot;&gt;GrassMarlin&lt;/h4&gt;

&lt;p&gt;The first tool we’ll be looking at is &lt;a href=&quot;https://github.com/nsacyber/GRASSMARLIN&quot;&gt;GrassMarlin&lt;/a&gt;, an open source tool released by the NSA. It’s primary purpose is to help passively map Industrial Control Systems and SCADA networks, and that’s what it’s fingerprint database is centered around, but it works just fine for our purpose as well.&lt;/p&gt;

&lt;p&gt;It’s a Java application and can be installed on Windows or Linux. I won’t go over the installation as I just selected all the defaults. The full documentation is &lt;a href=&quot;https://github.com/nsacyber/GRASSMARLIN/blob/master/GRASSMARLIN%20User%20Guide.pdf&quot;&gt;available here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I’m going to assume you have a PCAP file you want to analyze. I just &lt;a href=&quot;https://www.netresec.com/?page=PcapFiles&quot;&gt;downloaded a random one off the Internet&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once the application is running, click the “Import Files” button in the toolbar or from the file menu. Click “Add Files” to add it to Pending Imports. Highlight it and select “Import Selected”.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/grassmarlin1.png&quot; alt=&quot;Application View&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The first view you will see is the Logical Graph. Here each node that communicated in the PCAP is represented. The red circles are groupings. By default the Nodes are grouped by network, but this can be changed.&lt;/p&gt;

&lt;p&gt;I like to modify the view a little.&lt;br /&gt;
Right-click the Logical Graph and select “Weight Edges by Byte Count”. The darker the line, the more traffic was transmitted.  &lt;br /&gt;
Right-click the Logical Graph and select “Use Curved Edges”&lt;/p&gt;

&lt;p&gt;Other than the Logical Graph, you also have tabs for Physical Graph and Sniffles. Physical Graph requires some additional configuration. Basically you export your running-config from your Cisco devices and import them into GrassMarlin. Then, under this tab, it’s able to show connections grouped by Switch and Router.&lt;br /&gt;
The Sniffles tab is extracted from 802.15.4 data contained in the PCAP. This is meant to group devices on a Mesh network. The necessary metadata may not be present in a default PCAP.&lt;/p&gt;

&lt;p&gt;Other than the Graph windows you also have a “Message Log” that will display updates and errors at the bottom left, and above this is a tree view that mirrors what you see in the graph.&lt;/p&gt;

&lt;p&gt;After having analyzed this view, right-click anywhere in the Logical Graph and change “Group By” to Host Name. This will essentially remove the red coloring of groups on the map. Now right-click the graph again and select “Run Layout Now”. Unless you change the grouping first the second command does nothing.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/grassmarlin2.png&quot; alt=&quot;Layout View&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is the view that best allows me to visually interpret the full contents of the PCAP. I can clearly see a node on the bottom left communicating with lots of peers, as well as a dark line almost through the center showing a high amount of traffic passing between two nodes. Then there’s also the two outliers off to the right. All of these data points can allow me to hone in on the important traffic more easily. Maybe this is traffic that needs to be analyzed further, or maybe these are sources of noise preventing me from finding the interesting data, in which case excluding them from further analysis will probably trim the number of remaining packets by more than 50%.&lt;/p&gt;

&lt;h4 id=&quot;networkminer&quot;&gt;NetworkMiner&lt;/h4&gt;

&lt;p&gt;The next tool we’ll look at, &lt;a href=&quot;https://www.netresec.com/?page=NetworkMiner&quot;&gt;NetworkMiner&lt;/a&gt;, can only be installed on Windows. I’m also using the free version as opposed to the more full-featured commercial version. An installation isn’t even required, simply unzip and run the executable.&lt;/p&gt;

&lt;p&gt;We’ll be using NetworkMiner for it’s sorting and categorization capabilities. By default when you first open your PCAP you’re presented with the hosts sorted by IP address.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/networkminer1.png&quot; alt=&quot;NetworkMiner&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Just under the tabs you’ll see “Sort Hosts On:”. Select “Sent Packets (descending)” to see your chattiest endpoints. There’s obviously many other sorting options under here as well.&lt;/p&gt;

&lt;p&gt;You’ll also notice other tabs across the top. Here NetworkMiner has followed and categorized conversations between endpoints and attempted to extract and reconstruct the contents. These tabs allow you to see what was transferred and what category or tab those communications fall under. Most likely some of these tabs are empty, but quickly glancing at the numbers next to the tab headers allows you to see what the bulk of the traffic spent time transferring.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/networkminer2.png&quot; alt=&quot;Files Tab&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Extracting credentials is a nice feature also.&lt;/p&gt;

&lt;h4 id=&quot;wireshark&quot;&gt;Wireshark&lt;/h4&gt;

&lt;p&gt;Last but certainly not least is our favorite PCAP analysis tool of all, &lt;a href=&quot;https://www.wireshark.org/&quot;&gt;Wireshark&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For high-level analysis we’ll focus on the Statistics menu at the top.&lt;/p&gt;

&lt;p&gt;Statistics &amp;gt; Summary&lt;br /&gt;
Look here under “Time” to see the duration of the capture.&lt;/p&gt;

&lt;p&gt;Statistics &amp;gt; Protocol Hierarchy&lt;br /&gt;
This will show what type of network traffic you’re dealing with. Most likely this will be IPv4 TCP traffic but it doesn’t hurt to check.&lt;/p&gt;

&lt;p&gt;Statistics &amp;gt; Endpoints &amp;gt; TCP&lt;br /&gt;
Here you can sort by port and packet count. Useful for honing in on the ports and services doing most of the talking.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/wireshark-endpoints.png&quot; alt=&quot;Wireshark Endpoints&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Statistics &amp;gt; IO Graph&lt;br /&gt;
This will show you the distribution of packets over time. Is the distribution consistent or are there bursts of traffic you may want to focus on?&lt;/p&gt;

&lt;p&gt;Statistics &amp;gt; IP Statistics &amp;gt; Source and Dest IP Addresses &amp;gt; Create Stat&lt;br /&gt;
Another way of sorting the endpoints by packet count. Who sent the most traffic and who received the most.&lt;/p&gt;

&lt;p&gt;Remember that the goal of this exercise is to enable you to focus on the traffic that matters most to you. By taking the noisiest sources and either including or excluding them from your filter you’ll be best able to find the IPs and conversations that matter. Once you’re done filtering and have a list of IPs of interest, I like to go back and undo my existing filters and now filter by IP. I may have excluded a noisy endpoint early on and wouldn’t see if my suspect IP ever communicated with those excluded endpoints.&lt;/p&gt;

&lt;p&gt;On first pass filter often and find those suspect IPs. On the second pass focus on those suspect IPs and everyone they communicated with.&lt;/p&gt;</content><author><name>Arnaud Loos</name></author><category term="[&quot;networking&quot;]" /><summary type="html">PCAP files play a critical role in network troubleshooting and security. When an issue arrises and Developers are pointing at the SysAdmin who are pointing at the Network Admins, a PCAP capture will give you the unbiased answer. Depending on the amount of traffic and length of the capture however, these files can be extremely daunting to look at when first opened. Where do you start in a capture with 200,000 entries?</summary></entry><entry><title type="html">Open Source SIRP with Elasticsearch and TheHive - Part 6 - Case Management</title><link href="http://arnaudloos.com/2019/open-source-sirp-part-6-case-management/" rel="alternate" type="text/html" title="Open Source SIRP with Elasticsearch and TheHive - Part 6 - Case Management" /><published>2019-05-24T12:00:00-04:00</published><updated>2019-05-24T12:00:00-04:00</updated><id>http://arnaudloos.com/2019/open-source-sirp-part-6-case-management</id><content type="html" xml:base="http://arnaudloos.com/2019/open-source-sirp-part-6-case-management/">&lt;p&gt;We now have a working pipeline starting with an alert being triggered at our endpoint, through escalating that alert into TheHive. Once we have an alert we can begin the process of case creation, task assignment, IoC enrichment, and ultimately case closure. Let’s walk through this process in more detail.&lt;/p&gt;

&lt;h4 id=&quot;creating-cases-from-alerts&quot;&gt;Creating Cases from Alerts&lt;/h4&gt;

&lt;p&gt;You should begin by navigating to &lt;code class=&quot;highlighter-rouge&quot;&gt;Users&lt;/code&gt; in the &lt;code class=&quot;highlighter-rouge&quot;&gt;Admin&lt;/code&gt; menu to create unique accounts for all Analysts.&lt;/p&gt;

&lt;p&gt;Click on the &lt;code class=&quot;highlighter-rouge&quot;&gt;Alerts&lt;/code&gt; button at the top of the page. Here you’ll see a list of unassigned alerts waiting to be picked up by any available Analyst. Select an alert by clicking the &lt;code class=&quot;highlighter-rouge&quot;&gt;Preview and Import&lt;/code&gt; icon off to the right. Here you’ll be able to see the alert details, along with the list of extracted observables. A &lt;code class=&quot;highlighter-rouge&quot;&gt;Similar Cases&lt;/code&gt; section will appear at the bottom if any observable in this case has been seen before. If the two alerts share a link then you can opt to add this alert to an existing case instead of generating a new one.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/thehive-similar_cases.png&quot; alt=&quot;Similar cases&quot; /&gt;&lt;/p&gt;

&lt;p&gt;There is an &lt;code class=&quot;highlighter-rouge&quot;&gt;Import alert as&lt;/code&gt; drop down in the bottom right, next to the &lt;code class=&quot;highlighter-rouge&quot;&gt;Import&lt;/code&gt; button. This allows you to assign a case template that will be used for case creation. Templates contain lists of predetermined tasks that should be preformed on the alert, more on that below. For now we can create an empty case.&lt;/p&gt;

&lt;p&gt;Finally, choose &lt;code class=&quot;highlighter-rouge&quot;&gt;Yes, Import&lt;/code&gt; to turn the alert into a case that will be assigned to you.&lt;/p&gt;

&lt;h4 id=&quot;case-management&quot;&gt;Case Management&lt;/h4&gt;

&lt;p&gt;TheHive allows Analysts to work together to complete tasks and close cases. Tasks and cases both support assignment to clearly differentiate who is responsible for what, while allowing everyone to follow along through the live stream.&lt;/p&gt;

&lt;p&gt;Access your cases by clicking on TheHive logo in the top left corner.&lt;/p&gt;

&lt;p&gt;Cases have 3 tabs in the main window (Details, Tasks, and Observables) as well as a live stream on the right-hand side showing task and status updates from all analysts.&lt;/p&gt;

&lt;p&gt;The Details page shows metadata related to the case such as tags, date, severity, related cases, a description, and TLP and PAP designations.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/thehive-case_example.png&quot; alt=&quot;Observable tags&quot; /&gt;&lt;/p&gt;

&lt;p&gt;TLP is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Traffic_Light_Protocol&quot;&gt;Traffic Light Protocol&lt;/a&gt; which uses 4 color codes to indicate boundaries of how far outside the original group or recipient the information may be shared.&lt;/p&gt;

&lt;p&gt;An example provided by TheHive website is: “For example, a file added as observable can be submitted to VirusTotal if the associated TLP is WHITE or GREEN. If it’s AMBER, its hash is computed and submitted to VT but not the file. If it’s RED, no VT lookup is done.”&lt;/p&gt;

&lt;p&gt;PAP is the &lt;a href=&quot;https://misp-project.org/taxonomies.html#_pap&quot;&gt;Permissible Actions Protocol&lt;/a&gt; which mimics the TLP but indicates to the analyst how they may use the IoC in investigating the alert. It dictates actions that may be taken with each IoC, such as active vs passive response.&lt;/p&gt;

&lt;p&gt;The Tasks tab shows analyst defined tasks or those defined in an attached case template. 
Tasks should be used to track the actions taken to answer investigative questions.
Tasks that you accept or which are auto-assigned to you show up in &lt;code class=&quot;highlighter-rouge&quot;&gt;My Tasks&lt;/code&gt; at the top of the page. Tasks which have not yet been assigned are under &lt;code class=&quot;highlighter-rouge&quot;&gt;Waiting Tasks&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The Observables tab shows all extracted observables and their type. The observable will have few if any tags until enrichment occurs. Click the observable value under &lt;code class=&quot;highlighter-rouge&quot;&gt;Value/Filename&lt;/code&gt; (i.e. click on the IP or HTTP link) to open its details page. Here you’ll get additional metadata as well as links to other cases where the IoC is also present, and an Analysis section to run your Analyzers for enrichment.&lt;/p&gt;

&lt;p&gt;After running the Analyzers return to the Observables tab. Your IoC should now include tags summarizing the results.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/thehive-malware_tags.png&quot; alt=&quot;Observable tags&quot; /&gt;&lt;/p&gt;

&lt;p&gt;For more detailed results return to the IoC details page where the Analyzers are listed that you ran. Under &lt;code class=&quot;highlighter-rouge&quot;&gt;Last Analysis&lt;/code&gt; click the date to view a more detailed report of the scan results.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/thehive-report_long.png&quot; alt=&quot;Full Report&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;case-templates&quot;&gt;Case Templates&lt;/h4&gt;

&lt;p&gt;Under the &lt;code class=&quot;highlighter-rouge&quot;&gt;Admin&lt;/code&gt; menu at the top select &lt;code class=&quot;highlighter-rouge&quot;&gt;Case Templates&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here you’re able to give initial designations (Severity, TLP, PAP) for the IoCs in this alert category. You also provide a description and a task list to outline the investigative steps for this alert. This provides a consistent approach to handling events since the Task List becomes you’re investigative playbook. These should also reflect the actions defined in your SOPs.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/thehive-case_template.png&quot; alt=&quot;Case Template&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You’ll also see sections for Metrics and Custom fields. Items you select here must first be defined in the respective &lt;code class=&quot;highlighter-rouge&quot;&gt;Case Metrics&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;Case Custom Fields&lt;/code&gt; sections under the &lt;code class=&quot;highlighter-rouge&quot;&gt;Admin&lt;/code&gt; menu.&lt;/p&gt;

&lt;p&gt;A case metric is merely a variable you define to increment. Metrics can also be displayed in graphs on the Dashboard.&lt;/p&gt;

&lt;p&gt;A case custom field allows you to add additional fields for an Analyst to fill-in with the response as either a string drop-down, number, boolean, or date.&lt;/p&gt;

&lt;h4 id=&quot;responders&quot;&gt;Responders&lt;/h4&gt;

&lt;p&gt;Responders are part of Cortex and are installed along with the Cortex-Analyzers.&lt;/p&gt;

&lt;p&gt;Responders allow you to automate initiating an action. The default Responder provided as an example is the Mailer Responder which allows you to e-mail the case information and IoCs.&lt;/p&gt;

&lt;p&gt;Enable the Mailer responder by adding the Responder section to the end of  &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/cortex/application.conf&lt;/code&gt;. This requires you to have downloaded the Cortex-Analyzers repository.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;responder {
  path = [&quot;/etc/cortex/Cortex-Analyzers/responders&quot;]
  # Sane defaults. Do not change unless you know what you are doing.
  fork-join-executor {
    # Min number of threads available for analysis.
    parallelism-min = 2
    # Parallelism (threads) ... ceil(available processors * factor).
    parallelism-factor = 2.0
    # Max number of threads available for analysis.
    parallelism-max = 4
  }
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now login as the orgAdmin and configure and enable the Mailer responder.&lt;/p&gt;

&lt;p&gt;The default repository for Responders is &lt;a href=&quot;https://github.com/TheHive-Project/Cortex-Analyzers/tree/master/responders&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Two additional Responders are also provided.&lt;br /&gt;
&lt;strong&gt;Cisco Umbrella Blacklister&lt;/strong&gt;&lt;br /&gt;
Add domain from observables in cases to Umbrella blacklist.&lt;br /&gt;
https://umbrella.cisco.com/&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Crowdstrike Falcon&lt;/strong&gt;&lt;br /&gt;
Submit observables from alerts and cases to the Crowdstrike Falcon Custom IOC Service.&lt;br /&gt;
https://www.crowdstrike.com/endpoint-security-products/&lt;/p&gt;

&lt;p&gt;If you find yourself with an abundance of free time you can always &lt;a href=&quot;https://github.com/TheHive-Project/CortexDocs/blob/master/api/how-to-create-a-responder.md&quot;&gt;write your own Responder&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For instance if someone wanted to write a Responder to interface with &lt;a href=&quot;https://stackstorm.com/&quot;&gt;StackStorm&lt;/a&gt; that would open a world of possibilities.&lt;/p&gt;

&lt;h4 id=&quot;case-closure&quot;&gt;Case Closure&lt;/h4&gt;

&lt;p&gt;When you’re ready to close out a case click the &lt;code class=&quot;highlighter-rouge&quot;&gt;Close&lt;/code&gt; button in the title bar of the case.&lt;/p&gt;

&lt;p&gt;This will bring up the case resolution screen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/thehive-case_closure.png&quot; alt=&quot;Case closure&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;dashboards--search&quot;&gt;Dashboards &amp;amp; Search&lt;/h4&gt;

&lt;p&gt;Built-in dashboards for Case statistics, Observable statistics, Job statistics, and Alert statistics.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/thehive-dashboard.png&quot; alt=&quot;Dashboards&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You can also build your own custom dashboards through a drag-and-drop interface.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/thehive-dashboard_builder.png&quot; alt=&quot;Dashboard Builder&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Search across Cases, Tasks, Task logs, Observables, Alerts, Jobs, and Audit logs.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/thehive-search.png&quot; alt=&quot;Search feature&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;synapse-api--thehive4py&quot;&gt;Synapse, API, &amp;amp; TheHive4py&lt;/h4&gt;

&lt;p&gt;TheHive Project needs the help of the community to build additional Responders, integrations, and improvements, but makes it easy to do so with the following:&lt;/p&gt;

&lt;p&gt;Most actions in TheHive are accessible over the &lt;a href=&quot;https://github.com/TheHive-Project/TheHiveDocs/blob/master/api/README.md&quot;&gt;REST API&lt;/a&gt; if you’re looking to connect or send from an external application.&lt;/p&gt;

&lt;p&gt;If programming for TheHive or an application in the ecosystem, &lt;a href=&quot;https://github.com/TheHive-Project/TheHive4py&quot;&gt;TheHive4py&lt;/a&gt; is the Python API client you’ll want to use.&lt;/p&gt;

&lt;p&gt;Another project from TheHive creators is &lt;a href=&quot;https://blog.thehive-project.org/2018/07/18/unveiling-synapse/&quot;&gt;Synapse&lt;/a&gt;. Synapse is a “meta alert feeder for creating alerts in TheHive”. It’s a framework that can be expanded upon to ingest alerts from various sources. Currently it supports Microsoft Exchange, O365, and IBM QRadar. There are others in TheHive community building “connectors” to other SIEM products.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;It’s been enjoyable working through TheHive stack and seeing firsthand how this could successfully be used within an organization to implement an SOC with as few as one or two Analysts. I look forward to building on this project even more by now attempting to integrate &lt;a href=&quot;https://stackstorm.com/&quot;&gt;StackStorm&lt;/a&gt; to develop a full-fledged SOAR solution.&lt;/p&gt;</content><author><name>Arnaud Loos</name></author><category term="[&quot;security&quot;]" /><summary type="html">We now have a working pipeline starting with an alert being triggered at our endpoint, through escalating that alert into TheHive. Once we have an alert we can begin the process of case creation, task assignment, IoC enrichment, and ultimately case closure. Let’s walk through this process in more detail.</summary></entry><entry><title type="html">Phishing Email Pipeline with imap2thehive</title><link href="http://arnaudloos.com/2019/phishing-email-pipeline/" rel="alternate" type="text/html" title="Phishing Email Pipeline with imap2thehive" /><published>2019-05-13T12:00:00-04:00</published><updated>2019-05-13T12:00:00-04:00</updated><id>http://arnaudloos.com/2019/phishing-email-pipeline</id><content type="html" xml:base="http://arnaudloos.com/2019/phishing-email-pipeline/">&lt;p&gt;Today I’ll show you how to use &lt;a href=&quot;https://github.com/xme/dockers/tree/master/imap2thehive&quot;&gt;imap2thehive&lt;/a&gt; to pull emails from a mailbox, extract as many unique observables as possible, and generate a case in TheHive. It won’t be a long post as the author of imap2thehive has done an excellent job with his script and some small configuration changes are all that are required.&lt;/p&gt;

&lt;p&gt;I’m assuming you already have a running instance of TheHive. If not, start with my post on &lt;a href=&quot;https://arnaudloos.com/2019/open-source-sirp-part-4-thehive/&quot;&gt;TheHive installation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Create a folder named imap2thehive and grab the files we need.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir imap2thehive
cd imap2thehive/
wget https://github.com/xme/dockers/blob/master/imap2thehive/requirements.txt
wget https://github.com/xme/dockers/blob/master/imap2thehive/imap2thehive.whitelists
wget https://github.com/xme/dockers/blob/master/imap2thehive/imap2thehive.py
wget https://github.com/xme/dockers/blob/master/imap2thehive/imap2thehive.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Install the requirements.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;pip install -r requirements.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now go to your instance of TheHive and create a new user for these alerts. Generate an API key for the user. Note that this is the user that will be listed as the case &lt;code class=&quot;highlighter-rouge&quot;&gt;Assignee&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Modify imap2thehive configuration settings.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;nano imap2thehive.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Modify the connection settings for your mailbox. I’m connecting to GMail.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[imap]
host: imap.gmail.com
port: 993
user: &amp;lt;username&amp;gt;@gmail.com
password: &amp;lt;Password goes here&amp;gt;
folder: inbox
expunge: false
spam: (X-Spam-Flag: YES)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note the renamed &lt;code class=&quot;highlighter-rouge&quot;&gt;folder:&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Modify the connection settings to find TheHive.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[thehive]
url: http://x.x.x.x:9000
apikey: &amp;lt;Paste API key here&amp;gt;
observables: true
whitelists: imap2thehive.whitelists
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Under &lt;code class=&quot;highlighter-rouge&quot;&gt;[alert]&lt;/code&gt; change the &lt;code class=&quot;highlighter-rouge&quot;&gt;tlp:&lt;/code&gt; from 3 to 2. Having such a high alert prevents some analyzers from running in Cortex. Do the same under &lt;code class=&quot;highlighter-rouge&quot;&gt;[case]&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Create a new case template in TheHive for these emails or use an existing template. Replace &lt;code class=&quot;highlighter-rouge&quot;&gt;template: thehive_template&lt;/code&gt; with the name of your template.&lt;/p&gt;

&lt;p&gt;Also under &lt;code class=&quot;highlighter-rouge&quot;&gt;[case]&lt;/code&gt; you’ll want to list all the mime types you want to ingest as observables for further analysis. GMail is perhaps different than other mail systems in this regard. I’m using &lt;code class=&quot;highlighter-rouge&quot;&gt;files: application/octet-stream&lt;/code&gt; since trial-and-error told me that’s what I wanted.&lt;/p&gt;

&lt;p&gt;To discover this I modified imap2thehive.py. After line 238 I added a line with &lt;code class=&quot;highlighter-rouge&quot;&gt;print(filename)&lt;/code&gt;, and after the &lt;code class=&quot;highlighter-rouge&quot;&gt;mimetype =&lt;/code&gt; line I added a new line with &lt;code class=&quot;highlighter-rouge&quot;&gt;print(mimetype)&lt;/code&gt;. this will show you the mime type info in the console as the program runs.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;# Extract MIME parts
&lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;filename&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;part&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;mimetype&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;part&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_content_type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mimetype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;filename&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mimetype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now you’re ready to run the script. I’d have just a single unread email with some IPs and URLs in the message body waiting in the mailbox you’re testing against.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;python3 imap2thehive.py --config imap2thehive.conf&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[WARNING]: Both case template and tasks are defined. Template (email_template) will be used.
[INFO]: Processing &amp;lt;username&amp;gt;@gmail.com@imap.gmail.com:993/inbox
[INFO]: Connected to IMAP server.
[INFO]: 1 unread messages to process
[INFO]: From: Arnaud &amp;lt;xxxxxx@arnaudloos.com&amp;gt; Subject: Test Email
None
multipart/mixed
None
multipart/alternative
Evilpdf.pdf
application/octet-stream
[INFO]: Found attachment: Evilpdf.pdf (application/octet-stream)
Maliciousdoc.docx
application/octet-stream
[INFO]: Found attachment: Maliciousdoc.docx (application/octet-stream)
MaliciousExcel.xls
application/octet-stream
[INFO]: Found attachment: MaliciousExcel.xls (application/octet-stream)
[DEBUG]: Found observable url: https://maliciousurl.com/files/content/page.hta
[DEBUG]: Found observable ip: 103.14.229.253
[DEBUG]: Found observable ip: 103.25.58.34
[DEBUG]: Found observable ip: 1.186.77.13
[DEBUG]: Found observable ip: 73.164.105.200
[DEBUG]: Found observable domain: arnaudloos.com
[INFO]: Ignoring duplicate observable: arnaudloos.com
[DEBUG]: Found observable domain: maliciousurl.com
[DEBUG]: Found observable mail: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: https://maliciousurl.com/files/content/page.hta
[INFO]: Ignoring duplicate observable: 103.14.229.253
[INFO]: Ignoring duplicate observable: 103.25.58.34
[INFO]: Ignoring duplicate observable: 1.186.77.13
[INFO]: Ignoring duplicate observable: 73.164.105.200
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: maliciousurl.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: https://maliciousurl.com/files/content/page.hta
[INFO]: Ignoring duplicate observable: https://maliciousurl.com/files/content/page.hta
[INFO]: Ignoring duplicate observable: 103.14.229.253
[INFO]: Ignoring duplicate observable: 103.25.58.34
[INFO]: Ignoring duplicate observable: 1.186.77.13
[INFO]: Ignoring duplicate observable: 73.164.105.200
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: maliciousurl.com
[INFO]: Ignoring duplicate observable: maliciousurl.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: https://maliciousurl.com/files/content/page.hta
[INFO]: Ignoring duplicate observable: 103.14.229.253
[INFO]: Ignoring duplicate observable: 103.25.58.34
[INFO]: Ignoring duplicate observable: 1.186.77.13
[INFO]: Ignoring duplicate observable: 73.164.105.200
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: maliciousurl.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: https://maliciousurl.com/files/content/page.hta
[INFO]: Ignoring duplicate observable: 103.14.229.253
[INFO]: Ignoring duplicate observable: 103.25.58.34
[INFO]: Ignoring duplicate observable: 1.186.77.13
[INFO]: Ignoring duplicate observable: 73.164.105.200
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: maliciousurl.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: https://maliciousurl.com/files/content/page.hta
[INFO]: Ignoring duplicate observable: https://maliciousurl.com/files/content/page.hta
[INFO]: Ignoring duplicate observable: 103.14.229.253
[INFO]: Ignoring duplicate observable: 103.25.58.34
[INFO]: Ignoring duplicate observable: 1.186.77.13
[INFO]: Ignoring duplicate observable: 73.164.105.200
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: arnaudloos.com
[INFO]: Ignoring duplicate observable: maliciousurl.com
[INFO]: Ignoring duplicate observable: maliciousurl.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Ignoring duplicate observable: xxxxxx@arnaudloos.com
[INFO]: Removed duplicate observables: 72 -&amp;gt; 8
[DEBUG]: Searching for \S*(ALERT|VTMIS)\S* in 'Fwd: test 18'
[INFO]: Created case 29
[INFO]: Added observable /tmp/Evilpdf.pdf to case ID AWoEXp2TI5SmE1Wz2WvB
[INFO]: Added observable /tmp/Maliciousdoc.docx to case ID AWoEXp2TI5SmE1Wz2WvB
[INFO]: Added observable /tmp/MaliciousExcel.xls to case ID AWoEXp2TI5SmE1Wz2WvB
[INFO]: Added observable url: https://maliciousurl.com/files/content/page.hta to case ID AWoEXp2TI5SmE1Wz2WvB
[INFO]: Added observable ip: 103.14.229.253 to case ID AWoEXp2TI5SmE1Wz2WvB
[INFO]: Added observable ip: 103.25.58.34 to case ID AWoEXp2TI5SmE1Wz2WvB
[INFO]: Added observable ip: 1.186.77.13 to case ID AWoEXp2TI5SmE1Wz2WvB
[INFO]: Added observable ip: 73.164.105.200 to case ID AWoEXp2TI5SmE1Wz2WvB
[INFO]: Added observable domain: arnaudloos.com to case ID AWoEXp2TI5SmE1Wz2WvB
[INFO]: Added observable domain: maliciousurl.com to case ID AWoEXp2TI5SmE1Wz2WvB
[INFO]: Added observable mail: xxxxxx@arnaudloos.com to case ID AWoEXp2TI5SmE1Wz2WvB
[INFO]: Message 33 successfully processed and flagged as read

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Notice how the script elegently trims the number of observables down to just the unique entries.&lt;/p&gt;

&lt;p&gt;You should now see a newly created Case in TheHive dashboard.&lt;/p&gt;</content><author><name>Arnaud Loos</name></author><category term="[&quot;security&quot;]" /><summary type="html">Today I’ll show you how to use imap2thehive to pull emails from a mailbox, extract as many unique observables as possible, and generate a case in TheHive. It won’t be a long post as the author of imap2thehive has done an excellent job with his script and some small configuration changes are all that are required.</summary></entry><entry><title type="html">WSUS Troubleshooting Steps</title><link href="http://arnaudloos.com/2019/wsus-troubleshooting/" rel="alternate" type="text/html" title="WSUS Troubleshooting Steps" /><published>2019-05-06T12:00:00-04:00</published><updated>2019-05-06T12:00:00-04:00</updated><id>http://arnaudloos.com/2019/wsus-troubleshooting</id><content type="html" xml:base="http://arnaudloos.com/2019/wsus-troubleshooting/">&lt;p&gt;Below is the guide I use when troubleshooting a broken WSUS installation. This can manifest as a server console error, the ever popular “it’s just not reporting in”, or through the event log. I’ll walk you through the components of WSUS and how to check and make sure each one is functioning properly.&lt;/p&gt;

&lt;p&gt;First a note on what’s available on your platform.&lt;br /&gt;
If you’re on &lt;strong&gt;Windows 7/8/Server 2008R2/2012R2&lt;/strong&gt; then &lt;code class=&quot;highlighter-rouge&quot;&gt;wuauclt&lt;/code&gt; works for you.&lt;br /&gt;
The only real command you need to know is &lt;code class=&quot;highlighter-rouge&quot;&gt;wuauclt /resetauthorization /detectnow&lt;/code&gt;.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;wauauclt /reportnow&lt;/code&gt; doesn’t do what you think and isn’t very useful.&lt;/p&gt;

&lt;p&gt;If you’re on &lt;strong&gt;Windows 10/Server 2016&lt;/strong&gt; then wuauclt has been depricated and you have &lt;code class=&quot;highlighter-rouge&quot;&gt;UsoClient&lt;/code&gt;.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;usoclient.exe startscan&lt;/code&gt; to detect missing patches&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;usoclient.exe refreshsettings&lt;/code&gt; to refresh settings if any changes were made&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;usoclient.exe startdownload&lt;/code&gt; to download patches&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;usoclient.exe startinstall&lt;/code&gt; to install patches&lt;/p&gt;

&lt;p&gt;You also have the option of using Powershell to initiate a scan request.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Speaking of Powershell, Microsoft makes a number of &lt;a href=&quot;https://docs.microsoft.com/en-us/powershell/module/wsus/?view=win10-ps&quot;&gt;cmdlets available for managing WSUS Server&lt;/a&gt;.
To see if these are available to you run&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Get-Command -Module UpdateServices
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;These cmdlets are primarily geared towards deployment and management of the server, patches, and computers, not troubleshooting.&lt;/p&gt;

&lt;p&gt;On the client there is a WindowsUpdate module but its only function is &lt;a href=&quot;https://support.microsoft.com/en-us/help/4035760/understanding-the-windowsupdate-log-file-for-advanced-users&quot;&gt;Get-WindowsUpdateLog&lt;/a&gt; which is used for generating a readable WindowsUpdate.log file in Windows 10.&lt;/p&gt;

&lt;p&gt;There exists a &lt;a href=&quot;https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc&quot;&gt;third-party PS module&lt;/a&gt; for managing Windows Update on the client.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Install-Module PSWindowsUpdate  
Import-Module PSWindowsUpdate  
Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d  
Get-Command -Module PSWindowsUpdate  
Get-WUList –MicrosoftUpdate  
Get-WUInstall –MicrosoftUpdate –AcceptAll –AutoReboot           
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;database&quot;&gt;Database&lt;/h4&gt;

&lt;p&gt;WSUS has the option of utilizing an internal WID (Windows Internal DB) or SQL database. I’m going to assume it’s installed with WID at the default path of &lt;code class=&quot;highlighter-rouge&quot;&gt;C:\Windows\WID\&lt;/code&gt;.&lt;br /&gt;
Database related errors (other than fragmentation) usually occur at the time of installation, often during the post-installation task sequence. &lt;br /&gt;
While it is possible to connect to the WID and drop the SUSDB, errors at this stage are usually best fixed through a complete uninstall and reinstall. &lt;br /&gt;
For reference purposes I will state that you can use either SQLCMD or SQL Mgmt Studio to connect to the DB.&lt;br /&gt;
The connection string is &lt;code class=&quot;highlighter-rouge&quot;&gt;np:\\.\pipe\MICROSOFT##WID\tsql\query&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sysdatabases&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;drop&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;susdb&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sysdatabases&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;uninstallation&quot;&gt;Uninstallation&lt;/h4&gt;

&lt;p&gt;Uninstall using Server Manager.&lt;br /&gt;
Make sure the WSUS content folder is gone as well as the IIS WSUS Administration site.   &lt;br /&gt;
Uninstalling WSUS doesn’t always remove the WID. Remove it in Powershell with &lt;code class=&quot;highlighter-rouge&quot;&gt;Uninstall-WindowsFeature -Name windows-internal-database&lt;/code&gt;&lt;br /&gt;
Reboot and delete &lt;code class=&quot;highlighter-rouge&quot;&gt;c:\windows\WID\SUSDB.mdf&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;SUSDB_log.ldf&lt;/code&gt; files.&lt;/p&gt;

&lt;h4 id=&quot;installation&quot;&gt;Installation&lt;/h4&gt;

&lt;p&gt;Along with selecting the WSUS Role, Windows installs ASP.NET 4.6, RSAT Tools, IIS, and the Windows Process activation service.&lt;/p&gt;

&lt;p&gt;Install from an administrative Powershell prompt&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Install-WindowsFeature -Name Updateservices,UpdateServices-WidDB,UpdateServices-services -IncludeManagementTools
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Afterwards, before launching the GUI, run:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;C:\Program Files\Update Services\Tools\WsusUtil.exe PostInstall CONTENT_DIR=&amp;lt;Directory_Path_Here, i.e. D:\WSUS&amp;gt;&lt;/code&gt;&lt;br /&gt;
Change the &lt;code class=&quot;highlighter-rouge&quot;&gt;CONTENT_DIR&lt;/code&gt; to the correct path.&lt;/p&gt;

&lt;h4 id=&quot;check-the-client&quot;&gt;Check the client&lt;/h4&gt;

&lt;p&gt;There’s quite a few potential causes to a client not receiving updates. I’ll go through a range of troubleshooting steps and at the end give two scripts to “reset” the client if nothing else works.&lt;/p&gt;

&lt;p&gt;Check free hard drive space.&lt;/p&gt;

&lt;p&gt;Check the Windowsupdate log.&lt;br /&gt;
On Windows 10 open an administrative powershell prompt and run &lt;code class=&quot;highlighter-rouge&quot;&gt;Get-Windowsupdatelog&lt;/code&gt;. The log will be on the desktop. Wait for the command to finish running.&lt;br /&gt;
On Windows 7 check &lt;code class=&quot;highlighter-rouge&quot;&gt;C:\Windows\WindowsUpdate.log&lt;/code&gt; &lt;br /&gt;
This should indicate whether the issue is client based or a problem communicating to a remote endpoint.&lt;/p&gt;

&lt;p&gt;The simplest first step in troubleshooting the client is to run the Windows Update Troubleshooter. &lt;br /&gt;
On Windows 10 go to the &lt;a href=&quot;https://support.microsoft.com/en-gb/help/10164/fix-windows-update-errors&quot;&gt;Microsoft iFixIt for WSUS&lt;/a&gt; site.&lt;br /&gt;
This will prompt you to download the Windows Update Troubleshooter (in cab file format). Save this and run. &lt;br /&gt;
Choosing Windows 7 on this page prompts you to right-click Network (in your system tray) and “Troubleshoot problems”. You can probably skip this step.&lt;/p&gt;

&lt;p&gt;On Windows 10 try an online update check.&lt;br /&gt;
&lt;a href=&quot;https://support.microsoft.com/en-us/help/4027667/windows-update-windows-10&quot;&gt;https://support.microsoft.com/en-us/help/4027667/windows-update-windows-10&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check to make sure the service is running.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;Get-Service -Name wuauserv&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next check and make sure client is receiving WSUS settings from Group Policy.&lt;br /&gt;
Run &lt;code class=&quot;highlighter-rouge&quot;&gt;gpresult /scope computer&lt;/code&gt; to see if your WSUS settings policy is being applied to the machine. &lt;br /&gt;
Query client registry for WSUS settings with  &lt;code class=&quot;highlighter-rouge&quot;&gt;Get-ItemProperty HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;del&gt;Telnet can be used to check port connectivity issues. If you attempt a telnet connection to an open and accessible port telnet will open a new blank command window. If the port is inaccessible the command will simply fail. Try and establish a connection to the WSUS server and port. If the connection fails check firewall settings.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;telnet wsus.server.com 8530&lt;/code&gt;&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;Let’s use Powershell to test the connectivity.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;Test-NetConnection -ComputerName &amp;lt;WSUS_Server&amp;gt; -Port 8530 -InformationLevel Detailed&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Don’t forget the obvious step of checking the Event log.&lt;br /&gt;
Application Event log as well as App and Service Logs &amp;gt; Microsoft &amp;gt; Windows &amp;gt; WindowsUpdateClient&lt;/p&gt;

&lt;p&gt;Sometimes anti-virus or other endpoint security agents can interfere with network communications. Consider disabling or uninstalling these for testing.&lt;/p&gt;

&lt;p&gt;Run &lt;code class=&quot;highlighter-rouge&quot;&gt;sfc /scannow&lt;/code&gt; from an administrative command prompt to check for file corruption that can affect the client.&lt;/p&gt;

&lt;p&gt;If you have both working and non-working clients in WSUS check &lt;code class=&quot;highlighter-rouge&quot;&gt;c:\program files\update services\WebServices\ClientWebServices&lt;/code&gt; for a &lt;code class=&quot;highlighter-rouge&quot;&gt;web.config&lt;/code&gt; file and compare a working file to a non-working file for differences.&lt;/p&gt;

&lt;p&gt;If this client comes from an OS image and Sysprep wasn’t run then the issue may be that multiple clients are using the same SUSClientID key.&lt;br /&gt;
Check &lt;code class=&quot;highlighter-rouge&quot;&gt;HKLM\Software\Microsoft\Windows\CurrentVersion\WIndowsUpdate&lt;/code&gt; and delete the current &lt;code class=&quot;highlighter-rouge&quot;&gt;SUSClientID&lt;/code&gt;.&lt;br /&gt;
Run &lt;code class=&quot;highlighter-rouge&quot;&gt;wuauclt /resetauthorization /detectnow&lt;/code&gt; from an elevated command prompt.&lt;/p&gt;

&lt;h5 id=&quot;the-sequence-below-will-clear-out-the-local-cache-of-the-windows-update-client&quot;&gt;The sequence below will clear out the local cache of the Windows Update client&lt;/h5&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;attrib -h -r -s %windir%\system32\catroot2
attrib -h -r -s %windir%\system32\catroot2\*.*
net stop wuauserv
net stop CryptSvc
net stop BITS
ren %windir%\system32\catroot2 catroot2.old
ren %windir%\SoftwareDistribution SoftwareDistribution.old
ren &quot;%ALLUSERSPROFILE%\application data\Microsoft\Network\downloader&quot; downloader.old
net start BITS
net start CryptSvc
net start wuauserv
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;the-sequence-below-will-re-register-a-machine-with-the-wsus-server&quot;&gt;The sequence below will re-register a machine with the WSUS Server:&lt;/h5&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;net stop wuauserv  
net stop bits  
reg delete &quot;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate&quot; /v AccountDomainSid /f  
reg delete &quot;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate&quot; /v PingID /f  
reg delete &quot;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate&quot; /v SusClientId /f
reg delete &quot;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate&quot; /v SusClientIDValidation /f
rd /s /q &quot;C:\WINDOWS\SoftwareDistribution&quot;
net start bits
net start wuauserv
wuauclt /resetauthorization /detectnow (or usoclient.exe RefreshSettings)
PowerShell.exe (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;check-the-server&quot;&gt;Check the Server&lt;/h4&gt;

&lt;p&gt;Check free hard drive space, for the boot volume and repository volume.&lt;/p&gt;

&lt;p&gt;Check the Windows Update service&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;Get-Service -name WsusService&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Check the IIS service&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;Get-Service -name W3SVC&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Is server listening? Check open ports.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;netstat -an | findstr 853*&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Can you browse to &lt;code class=&quot;highlighter-rouge&quot;&gt;http://server:8530/ClientWebServices/client.asmx&lt;/code&gt;?&lt;br /&gt;
You should see a blue and tan Client Service info page.&lt;br /&gt;
If not, we can try resetting the port. Open an elevated command prompt and run &lt;code class=&quot;highlighter-rouge&quot;&gt;wsusutil usecustomwebsite false&lt;/code&gt;. This will change the port WSUS uses from 8530 to 80, so make sure nothing is running on port 80.  &lt;br /&gt;
Now run &lt;code class=&quot;highlighter-rouge&quot;&gt;wsusutil usecustomwebsite true&lt;/code&gt; followed then by &lt;code class=&quot;highlighter-rouge&quot;&gt;iisreset /restart&lt;/code&gt;. This changes the port back to 8530 and “resets” the configuration.&lt;/p&gt;

&lt;p&gt;Check firewall rules.&lt;br /&gt;
Check server side logging: &lt;code class=&quot;highlighter-rouge&quot;&gt;c:\program files\updateservices\logfiles\SoftwareDistribution&lt;/code&gt; &lt;br /&gt;
Run &lt;code class=&quot;highlighter-rouge&quot;&gt;sfc /scannow&lt;/code&gt; to check for file corruption.&lt;/p&gt;

&lt;h5 id=&quot;wsusutilexe&quot;&gt;&lt;a href=&quot;https://docs.microsoft.com/fr-fr/security-updates/WindowsUpdateServices/18127044&quot;&gt;WSUSUtil.exe&lt;/a&gt;&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;wsusutil.exe reset&lt;/code&gt;
    &lt;ul&gt;
      &lt;li&gt;Checks that every update metadata row in the database has corresponding update files stored in the file system. If update files are missing or have been corrupted, WSUS downloads the update files again.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;wsusutil.exe checkhealth&lt;/code&gt;
    &lt;ul&gt;
      &lt;li&gt;Check Application eventlog for entries with source “Windows Server Update Services”&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;wsusutil.exe usecustomwebsite&lt;/code&gt;
    &lt;ul&gt;
      &lt;li&gt;Changes the port WSUS uses. Also “resets” the port during the change.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;iis&quot;&gt;IIS&lt;/h4&gt;

&lt;p&gt;If you go to &lt;code class=&quot;highlighter-rouge&quot;&gt;http://WSUS_SERVER:8503&lt;/code&gt; you don’t see anything. This is normal.&lt;br /&gt;
To test IIS go to &lt;code class=&quot;highlighter-rouge&quot;&gt;http://WSUS_SERVER:8503/selfupdate/iuident.cab&lt;/code&gt; and you should be prompted to save the file.&lt;/p&gt;

&lt;p&gt;Check for http connection errors in &lt;code class=&quot;highlighter-rouge&quot;&gt;c:\windows\system32\logfiles\httperr\&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Check IP bindings.&lt;br /&gt;
Check to make sure the Application Pool is running.&lt;/p&gt;

&lt;p&gt;Check IIS logs for connection errors &lt;code class=&quot;highlighter-rouge&quot;&gt;c:\inetpub\logs\logfiles&lt;/code&gt;&lt;br /&gt;
The default IIS installation by the WSUS installer doesn’t install logging component however.&lt;br /&gt;
You need to enable this under &lt;code class=&quot;highlighter-rouge&quot;&gt;Manage Computer &amp;gt; Roles &amp;gt; Web Server &amp;gt; Web Server &amp;gt; Health &amp;amp; Diag &amp;gt; HTTP Logging&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And there you have it. If following this guide didn’t fix the issue hopefully you at least came across the malfunctioning component and have a better idea where to focus your Google searches.&lt;/p&gt;</content><author><name>Arnaud Loos</name></author><category term="[&quot;troubleshooting&quot;]" /><summary type="html">Below is the guide I use when troubleshooting a broken WSUS installation. This can manifest as a server console error, the ever popular “it’s just not reporting in”, or through the event log. I’ll walk you through the components of WSUS and how to check and make sure each one is functioning properly.</summary></entry><entry><title type="html">Enable X-Pack Security for Elasticsearch</title><link href="http://arnaudloos.com/2019/enable-x-pack-security/" rel="alternate" type="text/html" title="Enable X-Pack Security for Elasticsearch" /><published>2019-04-29T12:00:00-04:00</published><updated>2019-04-29T12:00:00-04:00</updated><id>http://arnaudloos.com/2019/enable-x-pack-security</id><content type="html" xml:base="http://arnaudloos.com/2019/enable-x-pack-security/">&lt;p&gt;At some point, after probably dozens of test Elasticsearch instances, you’ll want to actually deploy a cluster into production. If you’re now responsible for a production cluster you’ll need to protect against credential harvesting and random &lt;code class=&quot;highlighter-rouge&quot;&gt;curl DELETE&lt;/code&gt; queries that can cause all your indexes to disappear. Thus the motivation for purchasing X-Pack.&lt;/p&gt;

&lt;p&gt;Throughout this post we’ll generate certificates for elasticsearch (using a root CA and certificates for each node signed with this root CA), as well as enable authentication, change the built-in account passwords, secure ES node-to-node communication (port 9300 traffic), force HTTPS queries to ES (port 9200 traffic), modify Kibana and Logstash to talk to ES, and then secure the Kibana front-end.&lt;/p&gt;

&lt;p&gt;I’m making a few assumptions before we start. X-Pack should already be installed by default. You should have also applied your license or enabled the 30 day trial license. You might as well go ahead and enable monitoring as well. I’m also assuming you have no Machine Learning jobs running.&lt;/p&gt;

&lt;p&gt;Also note that there are many sources you can use for Authentication. I’ll be using the “Native Realm” which just means Elasticsearch will store accounts and password inside a local index, it’s also the default.&lt;/p&gt;

&lt;p&gt;In this scenario I have 3 cluster members. One is just a master node and two are master and data nodes.&lt;/p&gt;

&lt;h4 id=&quot;generating-certificates&quot;&gt;Generating certificates&lt;/h4&gt;

&lt;p&gt;SSH into one of your Elasticsearch hosts. Create a file to be used as a template and enter the information for each Elasticsearch host in your cluster. In my elasticsearch.yml I specify my hosts by IP address. If you use a host name I believe you want the FQDN listed in the &lt;code class=&quot;highlighter-rouge&quot;&gt;dns:&lt;/code&gt; section as an additional entry: &lt;code class=&quot;highlighter-rouge&quot;&gt;- &quot;elastic1.mydomain.com&quot;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo nano ~/cert-gen.yml&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;instances:
  - name: &quot;elastic1&quot; 
    dns:
      - &quot;elastic1&quot;
    ip:
      - &quot;192.168.1.11&quot;
  - name: &quot;elastic2&quot;
    dns:
      - &quot;elastic2&quot;
    ip:
      - &quot;192.168.1.12&quot;
  - name: &quot;elastic3&quot;
    dns:
      - &quot;elastic3&quot;
    ip:
      - &quot;192.168.1.13&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now generate both the CA certificate as well as the node certificates.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;/usr/share/elasticsearch/bin/elasticsearch-certutil cert --in cert-gen.yml --keep-ca-key&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I opted not to use a password for the certificates, you may wish to.&lt;/p&gt;

&lt;p&gt;If you want to use a commercial or organization-specific CA, you can use the &lt;code class=&quot;highlighter-rouge&quot;&gt;elasticsearch-certutil csr&lt;/code&gt; command to generate certificate signing requests (CSR) for the nodes in your cluster. Find more info &lt;a href=&quot;https://www.elastic.co/guide/en/elasticsearch/reference/current/certutil.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You should now have a certificate-bundle.zip file.&lt;/p&gt;

&lt;h4 id=&quot;configuring-node-to-node-encryption&quot;&gt;Configuring Node-to-Node Encryption&lt;/h4&gt;

&lt;p&gt;Let’s unzip the certificate bundle.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;apt install unzip&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;unzip certificate-bundle.zip&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You should have a &lt;code class=&quot;highlighter-rouge&quot;&gt;ca&lt;/code&gt; folder, as well as a folder for each host.&lt;/p&gt;

&lt;p&gt;First thing we’ll do is go into the &lt;code class=&quot;highlighter-rouge&quot;&gt;ca&lt;/code&gt; folder and convert out p12 certificate to PEM format. This will be necessary for the Kibana and Logstash servers.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd /ca
openssl pkcs12 -in ca.p12 -clcerts -nokeys -chain -out ca.pem
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Copy the relevant node certificates to each Elasticsearch node, and copy the ca.pem certificate to your Kibana and Logstash servers.&lt;br /&gt;
I’ll scp the files to my user’s home directory (where that user has permission to write files) and then on each host I’ll create a &lt;code class=&quot;highlighter-rouge&quot;&gt;certs&lt;/code&gt; directory in &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/elasticsearch/&lt;/code&gt; and copy the cert there. For each Elasticsearch host you only need the single host p12 file, not the CA file.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;scp elastic2.p12 user@elastic2:/home/user&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;On each host, SSH in, create &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/elasticsearch/certs&lt;/code&gt;, and copy over the certificate.&lt;/p&gt;

&lt;p&gt;Stop Logstash so no more data is being sent to Elasticsearch.&lt;/p&gt;

&lt;p&gt;Login to Kibana, go to Dev Tools and perform a flush sync.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;POST _flush/synced
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Keep running this command until there are no more failures.&lt;/p&gt;

&lt;p&gt;We’re now going to shutdown the entire cluster. Elasticsearch will not start re-allocating shards until after the &lt;code class=&quot;highlighter-rouge&quot;&gt;index.unassigned.node_left.delayed_timeout&lt;/code&gt; value has expired which is one minute by default. Hopefully you’re able to shutdown all your hosts in under a minute. If not, &lt;a href=&quot;https://www.elastic.co/guide/en/elasticsearch/reference/current/restart-upgrade.html&quot;&gt;look here&lt;/a&gt; for instructions on disabling allocation of replicas.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo systemctl stop elasticsearch.service&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;On each host edit elasticsearch.yml and add the following lines, being sure that the certificate path and name are correct.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.keystore.path: /etc/elasticsearch/certs/elastic1.p12 
xpack.security.transport.ssl.truststore.path: /etc/elasticsearch/certs/elastic1.p12
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Once you’ve modified all the nodes we can start bringing them back up. I’ll start with my master-only node since it has no data. Since I have my minimum master nodes set to 2 in elasticsearch.yml it should start up and wait since the minimum threshold has not been met.&lt;/p&gt;

&lt;p&gt;Start the first host.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo systemctl start elasticsearch.service&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;View the logs.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;tail -f /var/log/elasticsearch/cluster-name.log&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You should see a message saying the host is waiting on the minimum master nodes.&lt;/p&gt;

&lt;p&gt;Bring up the second node. If you’re watching the log file on the first node you should see the second node come up and a master elected. Now bring up the third node.&lt;/p&gt;

&lt;p&gt;On the master host the log file should show the cluster going from red to yellow, and eventually yellow to green.&lt;/p&gt;

&lt;p&gt;Before we can login to Kibana and look around we’ll need to reset the internal account passwords.&lt;/p&gt;

&lt;h4 id=&quot;set-built-in-account-passwords&quot;&gt;Set Built-in Account Passwords&lt;/h4&gt;

&lt;p&gt;On one of your Elasticsearch hosts run:&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;/usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Your cluster needs to be running and healthy or the command will throw an error.&lt;/p&gt;

&lt;p&gt;You’ll be prompted to change the passwords for the following users: elastic, kibana, logstash_system, beats_system, apm_system, and remote_monitoring_user. You should probably have these written down beforehand.&lt;/p&gt;

&lt;p&gt;Once complete this information is stored in a .security index in Elasticsearch.&lt;/p&gt;

&lt;p&gt;You cannot run the &lt;code class=&quot;highlighter-rouge&quot;&gt;elasticsearch-setup-passwords&lt;/code&gt; command a second time. Instead, you can update passwords from the Management &amp;gt; Users UI in Kibana, use the security user API, or delete the entire .security index.&lt;/p&gt;

&lt;p&gt;Now point your web browser to &lt;code class=&quot;highlighter-rouge&quot;&gt;http://&amp;lt;ES_Host&amp;gt;:9200&lt;/code&gt;. You should be prompted to log in to Elasticsearch. To log in, you can use the built-in &lt;code class=&quot;highlighter-rouge&quot;&gt;elastic&lt;/code&gt; user and the password you just specified. You should see returned a status OK JSON message.&lt;/p&gt;

&lt;p&gt;Now go into your kibana.yml file and uncomment the following lines:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;elasticsearch.user: kibana
elasticsearch.password: &amp;lt;your password here&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Instead of writing the user password in kibana.yml you can add it to a kibana-keystore also. See the Elastic website for details.&lt;/p&gt;

&lt;p&gt;Now log into Kibana by visiting the website. You should be prompted to enter credentials. Use &lt;code class=&quot;highlighter-rouge&quot;&gt;elastic&lt;/code&gt; for the user and supply the password.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/kibana-login.png&quot; alt=&quot;Kibana login&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Under Management in the left-hand menu you’ll now see a new Security section with Users and Roles.&lt;/p&gt;

&lt;p&gt;Take a minute to create an account for yourself and assign it the &lt;code class=&quot;highlighter-rouge&quot;&gt;superadmin&lt;/code&gt; role. Remember that the principle of least privilege applies here as well. While it’s important to have a superadmin account you should also create another account for yourself with fewer privileges for daily use.&lt;/p&gt;

&lt;p&gt;I’ll also create a role for my Logstash writers named &lt;code class=&quot;highlighter-rouge&quot;&gt;logstash_hostname&lt;/code&gt; by selecting “New Role”.&lt;br /&gt;
For cluster privileges, add manage_index_templates and monitor.&lt;br /&gt;
For Indices privileges, add write, delete, and create_index.&lt;br /&gt;
Now create a user with the same name and assign it this new role. This is what we will use in our logstash output {} to connecto to Elasticsearch.&lt;/p&gt;

&lt;p&gt;We’ve now enabled authentication and transport layer encryption for internal node communications.&lt;/p&gt;

&lt;h4 id=&quot;configuring-http-security&quot;&gt;Configuring HTTP Security&lt;/h4&gt;

&lt;p&gt;We’ll continue on by enabling HTTPS as well for every client that wants to make requests to the cluster. Note that I could have enabled the following at the same time that I enabled transport layer security but doing this in 2 steps aids in troubleshooting should something go wrong and allows you to run the cluster for a few days with only transport security enabled if you wish to do so.&lt;/p&gt;

&lt;p&gt;This procedure mimics a &lt;a href=&quot;https://www.elastic.co/guide/en/elasticsearch/reference/current/restart-upgrade.html&quot;&gt;rolling upgrade&lt;/a&gt;. We’ll only be shutting down a single host at a time so the cluster stays up. Any clients (Logstash, Kibana, etc.) will break until we configure them with the new settings. You should stop their services now.&lt;/p&gt;

&lt;p&gt;This won’t have any effect on inter-node communication since we already secured that. That means after each host goes down and comes back up we’ll wait until the cluster status is green again before proceeding to the next host.&lt;/p&gt;

&lt;p&gt;SSH to the first host and stop the Elasticsearch service. Keep in mind that Kibana is connecting to a specific host. It’ll be beneficial to save this host for last.&lt;/p&gt;

&lt;p&gt;Edit the config file and add the following lines.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.keystore.path: /etc/elasticsearch/certs/elastic1.p12
xpack.security.http.ssl.truststore.path: /etc/elasticsearch/certs/elastic1.p12 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Start the Elasticsearch service. Run &lt;code class=&quot;highlighter-rouge&quot;&gt;tail -f /var/log/elasticsearch/cluster-name.log&lt;/code&gt; to check for any issues. Login to Kibana, go to Monitoring, and check the cluster status. Wait until it’s green before proceeding to the next host.&lt;/p&gt;

&lt;p&gt;Kibana will continue to work until you change the settings on the host it connects to. If you save this host for last you can check the cluster status at each step until the last.&lt;/p&gt;

&lt;h4 id=&quot;kibana&quot;&gt;Kibana&lt;/h4&gt;

&lt;p&gt;Now we’ll configure Kibana to both connect to Elasticsearch securely as well as require HTTPS for the front-end.&lt;/p&gt;

&lt;p&gt;For the front-end certificate I needed it to be trusted by my browsers so I used my Enterprise certificate authority to generate a new certificate. This will allow all the clients in my Domain to trust it automatically. You can either do this or purchase just this single certificate from a trusted third-party. I have a few &lt;a href=&quot;https://arnaudloos.com/software-recomendations/#ssl&quot;&gt;recommendations in my software list&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Hopefully earlier you copied over the ca.pem file that we generated and moved that to &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/kibana/certs/&lt;/code&gt;. If not, scroll up and do that now.&lt;/p&gt;

&lt;p&gt;We’re now going to change the ownership and permissions on the certs directory and it’s files.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd /etc/kibana/
sudo chown -R root:kibana certs/
sudo chmod -R 750 certs/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Kibana and Logstash both require execute permissions on their certs directories.&lt;/p&gt;

&lt;p&gt;Modify Kibana to connect to ES via HTTPS.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;elasticsearch.hosts: [&quot;https://&amp;lt;your_elasticsearch_host&amp;gt;:9200&quot;]
elasticsearch.ssl.certificateAuthorities: /etc/kibana/certs/ca.pem
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;If you have issues you can disable certificate validation in the configuration, but since all the node certificates were signed by this ca.pem everything should validate cleanly.&lt;/p&gt;

&lt;p&gt;I copied over a .key and .crt file from my Enterprise CA to use for the front-end and set the following.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;server.ssl.enabled: true
server.ssl.key: /etc/kibana/certs/server.key
server.ssl.certificate: /etc/kibana/certs/server.crt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Re-start the service and connect to your Kibana front-end over HTTPS.&lt;/p&gt;

&lt;h4 id=&quot;logstash&quot;&gt;Logstash&lt;/h4&gt;

&lt;p&gt;This process will closely mimic the Kibana setup.&lt;/p&gt;

&lt;p&gt;Start by changing the certs directory ownership and permissions&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd /etc/logstash
sudo chown -R root:logstash certs/
sudo chmod -R 750 certs/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now with our certificate in place we can modify the logstash output section of our logstash configuration.&lt;/p&gt;

&lt;p&gt;I created a new &lt;code class=&quot;highlighter-rouge&quot;&gt;logstash_hostname&lt;/code&gt; user from the Kibana UI to assign to Logstash. Follow the directions &lt;a href=&quot;https://www.elastic.co/guide/en/logstash/6.6/ls-security.html#ls-http-auth-basic&quot;&gt;here&lt;/a&gt; to do the same or use the &lt;code class=&quot;highlighter-rouge&quot;&gt;logstash_writer&lt;/code&gt; built-in account.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;output {
  elasticsearch {
    host =&amp;gt; https://&amp;lt;elasticsearch_host&amp;gt;:9200
    user =&amp;gt; logstash_hostname
    password =&amp;gt; &amp;lt;password-here&amp;gt;
    ssl =&amp;gt; true
    cacert =&amp;gt; /etc/logstash/certs/ca.pem
  }
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now restart logstash
&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo systemctl restart logstash&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Check the logs to make sure logstash is able to connect to Elasticsearch.
&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo tail -f /var/log/logstash/logstash-plain.log&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And that’s it, everyone’s communicating over encrypted channels. Well, almost everyone. Monitoring traffic, if enabled, is still unencrypted. The recommendation here is to send monitoring metrics to a separate cluster, which means generating a CA cert for that cluster and configuring all of our servers to send data to a different IP. We’ll save that for another post.&lt;/p&gt;</content><author><name>Arnaud Loos</name></author><category term="[&quot;elasticsearch&quot;]" /><summary type="html">At some point, after probably dozens of test Elasticsearch instances, you’ll want to actually deploy a cluster into production. If you’re now responsible for a production cluster you’ll need to protect against credential harvesting and random curl DELETE queries that can cause all your indexes to disappear. Thus the motivation for purchasing X-Pack.</summary></entry><entry><title type="html">Cuckoo Sandbox Installation</title><link href="http://arnaudloos.com/2019/cuckoo-sandbox-installation/" rel="alternate" type="text/html" title="Cuckoo Sandbox Installation" /><published>2019-04-11T12:00:00-04:00</published><updated>2019-04-11T12:00:00-04:00</updated><id>http://arnaudloos.com/2019/cuckoo-sandbox-installation</id><content type="html" xml:base="http://arnaudloos.com/2019/cuckoo-sandbox-installation/">&lt;p&gt;&lt;a href=&quot;https://cuckoosandbox.org/&quot;&gt;Cuckoo Sandbox&lt;/a&gt; is an open source malware analysis system used to launch files in an isolated environment and observe their behavior. Pass it a URL, executable, office document, pdf, or any file, and it will get launched in an isolated virtual machine where cuckoo can observe it’s process execution, API calls, network access, and all filesystem activity. You’ll then get a report and a threat score based on the observed behavior. Once the analysis is complete the VM restores to a known good snapshot and waits for the next execution.&lt;/p&gt;

&lt;p&gt;Once Cuckoo is running you can pass it samples in three ways. Drag and Drop through the web interface, through the command line with &lt;code class=&quot;highlighter-rouge&quot;&gt;cuckoo --submit&lt;/code&gt;, or through the API.&lt;/p&gt;

&lt;p&gt;I’m going to install Cuckoo 2.0.6 on Ubuntu Desktop 16.04. I need a GUI to run Virtualbox and running this on 18.04 is problematic due to a change in Openssl 1.1.0. I’m sure I could have just as easily gone with a server OS and GUI. I’m running as the user cuckoo.&lt;/p&gt;

&lt;p&gt;The official installation instructions are &lt;a href=&quot;https://cuckoo.sh/docs/installation/index.html&quot;&gt;here&lt;/a&gt; and many of the steps in this tutorial were copied from &lt;a href=&quot;http://ly0n.me/2018/04/25/automating-malware-analysis-cuckoo-api-postfix/&quot;&gt;this excellent guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For my VM I’m using a licensed copy of Windows XP. You’ll need the XP ISO and a license key or a trial version. Cuckoo is supposed to work equally well with Windows 7 but I’ve not tested that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; that this is not an efficient or secure installation. I’m unsure if all the packages being installed are necessary, for instance you’ll be installing sqlite, mongodb, and postgres which is really not recommended. I’ve taken these steps from other guides and haven’t bothered to do a full clean-up. Also note ironically that if you want to enable searching in Cuckoo you need to install yet another database, Elasticsearch.&lt;/p&gt;

&lt;h4 id=&quot;installation&quot;&gt;Installation&lt;/h4&gt;

&lt;p&gt;Start with some pre-requisites&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get install git mongodb libffi-dev build-essential python-django python python-dev python-pip python-pil python-sqlalchemy python-bson python-dpkt python-jinja2 python-magic python-pymongo python-gridfs python-libvirt python-bottle python-pefile python-chardet tcpdump apparmor-utils libjpeg-dev python-virtualenv python3-virtualenv virtualenv swig postgresql libpq-dev libguac-client-rdp0 libguac-client-vnc0 libguac-client-ssh0 guacd autoconf libtool libjansson-dev libmagic-dev libssl-dev -y
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Set TCPDump for non-root user&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo aa-disable /usr/sbin/tcpdump&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo setcap cap_net_raw,cap_net_admin=eip /usr/sbin/tcpdump&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Test by running &lt;code class=&quot;highlighter-rouge&quot;&gt;getcap /usr/sbin/tcpdump&lt;/code&gt; and expect to get back &lt;code class=&quot;highlighter-rouge&quot;&gt;/usr/sbin/tcpdump = cap_net_admin,cap_net_raw+eip&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Install Yara&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget https://github.com/plusvic/yara/archive/v3.4.0.tar.gz -O yara-3.4.0.tar.gz
tar -zxf yara-3.4.0.tar.gz
cd yara-3.4.0
./bootstrap.sh
./configure -with-crypto -enable-cuckoo -enable-magic
make
sudo make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Test and make sure you get back a version number&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;yara -v&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And install yara-python&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd yara-python
python setup.py build
sudo python setup.py install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Install ssdeep&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd ~/
wget http://sourceforge.net/projects/ssdeep/files/ssdeep-2.13/ssdeep-2.13.tar.gz/download -O ssdeep-2.13.tar.gz
tar -zxf ssdeep-2.13.tar.gz
cd ssdeep-2.13
./configure
make
sudo make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Test and make sure you get back a version number&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;ssdeep -V&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Install some python dependencies&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pip install pydeep
pip install openpyxl
pip install ujson
pip install pycrypto
pip install distorm3
pip install pytz
pip install jsonschema
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Install Volatility&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone https://github.com/volatilityfoundation/volatility.git
cd volatility
python setup.py build
python setup.py install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Make sure you’re installing VirtualBox 5.1 or earlier, not 5.2 or later.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;apt-cache policy virtualbox&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Install Virtualbox&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo apt-get install virtualbox&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add my cuckoo user to the vboxusers group&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;sudo usermod -a -G vboxusers cuckoo&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Copy your Windows XP ISO (or Win7) to &lt;code class=&quot;highlighter-rouge&quot;&gt;/home/cuckoo/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As the &lt;code class=&quot;highlighter-rouge&quot;&gt;cuckoo&lt;/code&gt; user create the VM.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vboxmanage createvm --name windowsxp --ostype WindowsXP --register
vboxmanage modifyvm windowsxp --memory 1000 --acpi on --boot1 dvd --nic1 nat
cd ~/VirtualBox/windowsxp
vboxmanage createhd --filename windowsxp.vdi --size 12000
vboxmanage storagectl windowsxp --name 'IDE Controller' --add ide --controller PIIX4
vboxmanage storageattach windowsxp --storagectl 'IDE Controller' --port 0 --device 0 --type hdd --medium windowsxp.vdi
vboxmanage storageattach windowsxp --storagectl 'IDE Controller' --port 0 --device 1 --type dvddrive --medium /home/cuckoo/WXPVOL_EN.iso
vboxmanage hostonlyif create
vboxmanage modifyvm windowsxp --nic1 hostonly
vboxmanage modifyvm windowsxp --hostonlyadapter1 vboxnet0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Locally, from the GUI console of the OS (not an ssh session), open the Terminal application and run &lt;code class=&quot;highlighter-rouge&quot;&gt;vboxmanage startvm windowsxp&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Your VM should start and boot from the ISO allowing you to install the Operating System.&lt;/p&gt;

&lt;p&gt;While the OS is installing we’ll switch gears for a moment and setup the host machine to talk to the guest and forward traffic.&lt;/p&gt;

&lt;p&gt;You’ll want to change &lt;code class=&quot;highlighter-rouge&quot;&gt;enp0s25&lt;/code&gt; in the first rule to match the public interface name of the network card in the host with Internet access. Get this by running &lt;code class=&quot;highlighter-rouge&quot;&gt;ip addr&lt;/code&gt;.&lt;br /&gt;
Run the following commands on the Linux host machine.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo iptables -t nat -A POSTROUTING -o enp0s25 -s 192.168.56.0/24 -j MASQUERADE
sudo iptables -P FORWARD DROP
sudo iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -s 192.168.56.0/24 -j ACCEPT
sudo iptables -A FORWARD -s 192.168.56.0/24 -d 192.168.56.0/24 -j ACCEPT
sudo iptables -A FORWARD -j LOG
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Note that these rules aren’t currently persistent, meaning they’ll be erased on reboot. To make them permanent install the &lt;code class=&quot;highlighter-rouge&quot;&gt;iptables-persistent&lt;/code&gt; package. When you modify the rules in the future use &lt;code class=&quot;highlighter-rouge&quot;&gt;sudo netfilter-persistent save&lt;/code&gt; to make the change permanent.&lt;/p&gt;

&lt;p&gt;Now we’ll enable forwarding in the kernel.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;echo 1 | sudo tee -a /proc/sys/net/ipv4/ip_forward
sudo sysctl -w net.ipv4.ip_forward=1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Complete the guest OS install and continue with the steps below.&lt;/p&gt;

&lt;p&gt;Once completed, don’t install any additional system updates and configure the VM with a static IP.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;IP: 192.168.56.10
Subnet: 255.255.255.0
Gateway: 192.168.56.1
DNS: 8.8.8.8 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Try and ping the host PC &lt;code class=&quot;highlighter-rouge&quot;&gt;ping 192.168.56.1&lt;/code&gt;. You should get a response.&lt;/p&gt;

&lt;p&gt;Install the Virtualbox guest additions in the guest OS and enable host to guest drag and drop from the VM settings.&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;Settings &amp;gt; General &amp;gt; Advanced &amp;gt; Drag'n'Drop: Host to Guest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Download the following packages and drag them into the guest OS to copy them to the Desktop. Now install them.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.python.org/download/releases/2.7/&quot;&gt;The Python 2.7 installer for your guest OS&lt;/a&gt;.&lt;br /&gt;
&lt;a href=&quot;http://effbot.org/downloads/PIL-1.1.7.win32-py2.7.exe&quot;&gt;The Python Imaging Library&lt;/a&gt; to take snapshots of the files executing.&lt;br /&gt;
&lt;a href=&quot;https://github.com/spender-sandbox/cuckoo-modified/blob/master/agent/agent.py&quot;&gt;Cuckoo Agent&lt;/a&gt; and place the file in the startup folder of the guest VM so it executes on startup. A command window should open showing the agent is listening.&lt;/p&gt;

&lt;p&gt;This would also be a good time to install Adobe Acrobat Reader and perhaps a trial version of Microsoft Office.&lt;/p&gt;

&lt;p&gt;The way in which the VM is snapshotted and the state it’s in is very important for cuckoo.&lt;br /&gt;
Do the following exactly as I describe. Visit the &lt;a href=&quot;https://cuckoo.readthedocs.io/en/latest/faq/#check-and-restore-current-snapshot-with-virtualbox&quot;&gt;Cuckoo troubleshooting doc&lt;/a&gt; for more information.&lt;/p&gt;

&lt;p&gt;While the VM is running&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;vboxmanage snapshot windowsxp take snapshot1 --pause
vboxmanage controlvm windowsxp poweroff
vboxmanage snapshot windowsxp restorecurrent
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And now, as the cuckoo user, install Cuckoo.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd ~\
git clone https://github.com/cuckoosandbox/cuckoo
cd cuckoo
python stuff/monitor.py
python setup.py build
sudo python setup.py sdist
sudo python setup.py build install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now run Cuckoo&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;cuckoo -d&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
  eeee e   e eeee e   e  eeeee eeeee
  8  8 8   8 8  8 8   8  8  88 8  88
  8e   8e  8 8e   8eee8e 8   8 8   8
  88   88  8 88   88   8 8   8 8   8
  88e8 88ee8 88e8 88   8 8eee8 8eee8

 Cuckoo Sandbox 2.0.6
 www.cuckoosandbox.org
 Copyright (c) 2010-2018

=======================================================================
    Welcome to Cuckoo Sandbox, this appears to be your first run!
    We will now set you up with our default configuration.
    You will be able to see and modify the Cuckoo configuration,
    Yara rules, Cuckoo Signatures, and much more to your likings
    by exploring the /home/cuckoo/.cuckoo directory.

    Among other configurable items of most interest is the
    new location for your Cuckoo configuration:
              /home/cuckoo/.cuckoo/conf
=======================================================================

Cuckoo has finished setting up the default configuration.
Please modify the default settings where required and
start Cuckoo again (by running `cuckoo` or `cuckoo -d`).

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;modify-the-cuckoo-configuration&quot;&gt;Modify the Cuckoo configuration&lt;/h4&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;nano /home/cuckoo/.cuckoo/conf/cuckoo.conf&lt;/code&gt;&lt;br /&gt;
under &lt;code class=&quot;highlighter-rouge&quot;&gt;[resultserver]&lt;/code&gt; verify that &lt;code class=&quot;highlighter-rouge&quot;&gt;&quot;ip=192.168.56.1&quot;&lt;/code&gt; is set.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;nano /home/cuckoo/.cuckoo/conf/virtualbox.conf&lt;/code&gt;&lt;br /&gt;
Since we’re using Virtualbox as our provider we’ll also modify some VM settings in this file.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[cuckoo1]
label = windowsxp
ip = 192.168.56.10
snapshot = snapshot1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This part is optional: &lt;code class=&quot;highlighter-rouge&quot;&gt;sudo nano reporting.conf&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    [mongodb]
    enabled = yes
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now start it all up again&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;cuckoo -d&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;2019-04-04 12:32:53,616 [cuckoo] WARNING: It appears that you haven't loaded any Cuckoo Signatures. Signatures are highly recommended and improve &amp;amp; enrich the information extracted during an analysis. They also make up for the analysis score that you see in the Web Interface - so, pretty important!
2019-04-04 12:32:53,616 [cuckoo] WARNING: You'll be able to fetch all the latest Cuckoo Signatures, Yara rules, and more goodies by running the following command:
2019-04-04 12:32:53,616 [cuckoo] INFO: $ cuckoo community
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Run &lt;code class=&quot;highlighter-rouge&quot;&gt;cuckoo community&lt;/code&gt;. I know I could have just told you to do that before but I wanted you to be aware that cuckoo has the ability to download and refresh signatures and rules.&lt;/p&gt;

&lt;p&gt;Verify that the cuckoo directory is owned by the cuckoo user. &lt;br /&gt;
If not run &lt;code class=&quot;highlighter-rouge&quot;&gt;sudo chown -R cuckoo:cuckoo ~/.cuckoo&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Remember that your VM was created by the cuckoo user so don’t expect to find it if you run &lt;code class=&quot;highlighter-rouge&quot;&gt;sudo cuckoo -d&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now run &lt;code class=&quot;highlighter-rouge&quot;&gt;cuckoo -d&lt;/code&gt; again.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;2019-04-04 17:05:57,609 [cuckoo.core.resultserver] DEBUG: ResultServer running on 192.168.56.1:2042.
2019-04-04 17:05:57,611 [cuckoo.core.scheduler] INFO: Using &quot;virtualbox&quot; as machine manager
2019-04-04 17:05:58,288 [cuckoo.machinery.virtualbox] DEBUG: Restoring virtual machine windowsxp to snapshot1
2019-04-04 17:05:58,727 [cuckoo.core.scheduler] INFO: Loaded 1 machine/s
2019-04-04 17:05:58,767 [cuckoo.core.scheduler] INFO: Waiting for analysis tasks.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Cuckoo is online and awaiting a file submission. Let’s submit a sample from the command line, you can submit any file on the system.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;cuckoo submit evilfile.exe&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;2019-04-04 17:09:25,364 [cuckoo.core.scheduler] DEBUG: Processing task #6
2019-04-04 17:09:25,385 [cuckoo.core.scheduler] INFO: Starting analysis of FILE &quot;evilfile.exe&quot; (task #6, options &quot;&quot;)
2019-04-04 17:09:25,509 [cuckoo.core.scheduler] INFO: Task #6: acquired machine cuckoo1 (label=windowsxp)
2019-04-04 17:09:25,510 [cuckoo.core.plugins] DEBUG: Started auxiliary module: Replay
2019-04-04 17:09:25,544 [cuckoo.auxiliary.sniffer] INFO: Started sniffer with PID 3537 (interface=vboxnet0, host=192.168.56.10)
2019-04-04 17:09:25,545 [cuckoo.core.plugins] DEBUG: Started auxiliary module: Sniffer
...
2019-04-04 17:09:25,734 [cuckoo.machinery.virtualbox] DEBUG: Starting vm windowsxp
2019-04-04 17:09:26,048 [cuckoo.machinery.virtualbox] DEBUG: Restoring virtual machine windowsxp to snapshot1
2019-04-04 17:09:26,551 [cuckoo.common.abstracts] DEBUG: Waiting 0 cuckooseconds for machine windowsxp to switch to status ('saved',)
2019-04-04 17:09:27,793 [cuckoo.common.abstracts] DEBUG: Waiting 1 cuckooseconds for machine windowsxp to switch to status ('saved',)
...
2019-04-04 17:30:08,011 [cuckoo.core.scheduler] INFO: Task #6: acquired machine cuckoo1 (label=windowsxp)
2019-04-04 17:30:08,012 [cuckoo.core.plugins] DEBUG: Started auxiliary module: Replay
2019-04-04 17:30:08,025 [cuckoo.auxiliary.sniffer] INFO: Started sniffer with PID 7198 (interface=vboxnet0, host=192.168.56.10)
2019-04-04 17:30:08,027 [cuckoo.core.plugins] DEBUG: Started auxiliary module: Sniffer
2019-04-04 17:30:08,211 [cuckoo.machinery.virtualbox] DEBUG: Starting vm windowsxp
2019-04-04 17:30:08,508 [cuckoo.machinery.virtualbox] DEBUG: Restoring virtual machine windowsxp to snapshot1
2019-04-04 17:30:11,536 [cuckoo.core.guest] INFO: Starting analysis on guest (id=cuckoo1, ip=192.168.56.10)
2019-04-04 17:30:12,548 [cuckoo.core.guest] DEBUG: cuckoo1: not ready yet
2019-04-04 17:30:13,553 [cuckoo.core.guest] DEBUG: cuckoo1: not ready yet
2019-04-04 17:30:16,586 [cuckoo.core.guest] DEBUG: cuckoo1: waiting for status 0x0001
2019-04-04 17:30:16,595 [cuckoo.core.guest] DEBUG: cuckoo1: status ready
2019-04-04 17:30:16,699 [cuckoo.core.guest] DEBUG: Uploading analyzer to guest (id=cuckoo1, ip=192.168.56.10, monitor=latest, size=3884139)
2019-04-04 17:30:18,723 [cuckoo.core.guest] DEBUG: cuckoo1: analyzer started with PID 1616
2019-04-04 17:30:18,811 [cuckoo.core.guest] DEBUG: cuckoo1: waiting for completion
2019-04-04 17:30:19,280 [cuckoo.core.resultserver] DEBUG: LogHandler for live analysis.log initialized.
2019-04-04 17:30:19,823 [cuckoo.core.guest] DEBUG: cuckoo1: analysis not completed yet (status=2)
2019-04-04 17:30:20,834 [cuckoo.core.guest] DEBUG: cuckoo1: analysis not completed yet (status=2)
2019-04-04 17:30:23,484 [cuckoo.core.resultserver] DEBUG: New process (pid=1880, ppid=1960, name=PIL-1.1.7.win32-py2.7.exe)
2019-04-04 17:30:23,884 [cuckoo.core.guest] DEBUG: cuckoo1: analysis not completed yet (status=2)
2019-04-04 17:30:24,481 [cuckoo.core.resultserver] DEBUG: File upload request for shots/0001.jpg
2019-04-04 17:30:24,493 [cuckoo.core.resultserver] DEBUG: Uploaded file length: 45281
2019-04-04 17:30:24,894 [cuckoo.core.guest] DEBUG: cuckoo1: analysis not completed yet (status=2)
2019-04-04 17:30:25,599 [cuckoo.core.resultserver] DEBUG: File upload request for shots/0002.jpg
2019-04-04 17:30:25,619 [cuckoo.core.resultserver] DEBUG: Uploaded file length: 62214
2019-04-04 17:30:25,903 [cuckoo.core.guest] DEBUG: cuckoo1: analysis not completed yet (status=2)
2019-04-04 17:30:26,710 [cuckoo.core.resultserver] DEBUG: File upload request for shots/0003.jpg
2019-04-04 17:30:26,727 [cuckoo.core.resultserver] DEBUG: Uploaded file length: 62648
2019-04-04 17:30:26,912 [cuckoo.core.guest] DEBUG: cuckoo1: analysis not completed yet (status=2)
2019-04-04 17:33:19,549 [cuckoo.core.guest] INFO: cuckoo1: end of analysis reached!
2019-04-04 17:33:19,642 [cuckoo.core.plugins] DEBUG: Stopped auxiliary module: Replay
2019-04-04 17:33:19,683 [cuckoo.core.plugins] DEBUG: Stopped auxiliary module: Sniffer
2019-04-04 17:33:19,684 [cuckoo.machinery.virtualbox] DEBUG: Stopping vm windowsxp
2019-04-04 17:33:21,358 [cuckoo.core.scheduler] DEBUG: Released database task #6
2019-04-04 17:33:21,502 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;AnalysisInfo&quot; for task #6
2019-04-04 17:33:21,630 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;BehaviorAnalysis&quot; for task #6
2019-04-04 17:33:21,643 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;Dropped&quot; for task #6
2019-04-04 17:33:21,644 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;DroppedBuffer&quot; for task #6
2019-04-04 17:33:21,645 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;MetaInfo&quot; for task #6
2019-04-04 17:33:21,646 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;ProcessMemory&quot; for task #6
2019-04-04 17:33:21,647 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;Procmon&quot; for task #6
2019-04-04 17:33:21,823 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;Screenshots&quot; for task #6
2019-04-04 17:33:22,714 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;Static&quot; for task #6
2019-04-04 17:33:22,825 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;Strings&quot; for task #6
2019-04-04 17:33:22,899 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;TargetInfo&quot; for task #6
2019-04-04 17:33:22,911 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;NetworkAnalysis&quot; for task #6
2019-04-04 17:33:22,911 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;Extracted&quot; for task #6
2019-04-04 17:33:22,912 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;TLSMasterSecrets&quot; for task #6
2019-04-04 17:33:22,917 [cuckoo.core.plugins] DEBUG: Executed processing module &quot;Debug&quot; for task #6
2019-04-04 17:33:22,921 [cuckoo.core.plugins] DEBUG: Running 540 signatures
2019-04-04 17:33:23,852 [cuckoo.core.plugins] DEBUG: Analysis matched signature: has_pdb
2019-04-04 17:33:23,853 [cuckoo.core.plugins] DEBUG: Analysis matched signature: packer_entropy
2019-04-04 17:33:23,985 [cuckoo.core.plugins] DEBUG: Executed reporting module &quot;JsonDump&quot;
2019-04-04 17:33:24,299 [cuckoo.core.plugins] DEBUG: Executed reporting module &quot;MongoDB&quot;
2019-04-04 17:33:24,299 [cuckoo.core.scheduler] INFO: Task #6: reports generation completed
2019-04-04 17:33:24,319 [cuckoo.core.scheduler] INFO: Task #6: analysis procedure completed

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;launching-cuckoo-the-next-time&quot;&gt;Launching Cuckoo the next time&lt;/h4&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[cuckoo] CRITICAL: CuckooCriticalError: Unable to bind ResultServer on 192.168.56.1:2042 [Errno 99] Cannot assign re
quested address. This usually happens when you start Cuckoo without bringing up the virtual interface associated with the ResultServer IP ad
dress. Please refer to https://cuckoo.sh/docs/faq/#troubles-problem for more information.                  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Run:&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;VBoxManage hostonlyif create&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.56.1 --netmask 255.255.255.0&lt;/code&gt;&lt;br /&gt;
before running &lt;code class=&quot;highlighter-rouge&quot;&gt;cuckoo -d&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;cuckoo-api&quot;&gt;Cuckoo API&lt;/h4&gt;

&lt;p&gt;Start the API listener&lt;br /&gt;
&lt;code class=&quot;highlighter-rouge&quot;&gt;cuckoo api --host 0.0.0.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Runs on port 8090 by default.&lt;/p&gt;

&lt;p&gt;I’m calling Cuckoo Sandbox from Cortex and I’m currently unsure how to pass an API token from there so for now I’m just disabling authentication.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;nano /home/cuckoo/.cuckoo/conf/cuckoo.conf&lt;/code&gt; &lt;br /&gt;
Comment out the &lt;code class=&quot;highlighter-rouge&quot;&gt;api_token&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;launch-cuckoo-web-server&quot;&gt;Launch cuckoo web server&lt;/h4&gt;

&lt;p&gt;Submit files and view results on the cuckoo webpage.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;cuckoo web -H 0.0.0.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Navigate to &lt;code class=&quot;highlighter-rouge&quot;&gt;http://&amp;lt;IP of server&amp;gt;:8000&lt;/code&gt; to view the Dashboard.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/cuckoo-dashboard.png&quot; alt=&quot;cuckoo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;View the results of recently run scans and open the summary page.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/cuckoo-recent.png&quot; alt=&quot;cuckoo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;View an analysis summary.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/cuckoo-summary.png&quot; alt=&quot;cuckoo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;View in-depth system activity.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/cuckoo-behavioral.png&quot; alt=&quot;cuckoo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;View and capture network activity.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/cuckoo-network.png&quot; alt=&quot;cuckoo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;See additional files that are downloaded&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/cuckoo-dropped-files.png&quot; alt=&quot;cuckoo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You now have your very own sandbox in which to detonate any suspicious file you come across. Consider enabling the Cuckoo Analyzer in Cortex and giving it the IP of your new sandbox server.&lt;/p&gt;</content><author><name>Arnaud Loos</name></author><category term="[&quot;security&quot;]" /><summary type="html">Cuckoo Sandbox is an open source malware analysis system used to launch files in an isolated environment and observe their behavior. Pass it a URL, executable, office document, pdf, or any file, and it will get launched in an isolated virtual machine where cuckoo can observe it’s process execution, API calls, network access, and all filesystem activity. You’ll then get a report and a threat score based on the observed behavior. Once the analysis is complete the VM restores to a known good snapshot and waits for the next execution.</summary></entry></feed>