Git Product home page Git Product logo

clemea-devwks-2240's Introduction

DEVWKS-2240
Using SecureX orchestration for Automating Public Cloud Incident Response and Remediation

Right-click and open in a new INCOGNITO MODE/PRIVATE WINDOW

image

IaaS API Documentation
AWS: https://docs.aws.amazon.com
GCP: https://cloud.google.com/compute/docs/reference/rest/v1
Azure: https://docs.microsoft.com/en-us/rest/api/azure

Creating Your First AWS Activity

SHARED ENVIRONMENT ALERT
Make sure you uniquely name your workflow when creating!

API Reference: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html

Create a new activity that will provide the details of an EC2 instance, following the example presented.

  1. Create a New Workflow

newworkflow

  1. From the activities tab, drag the AWS Service --> Generic AWS API Request actiivity to the canvas.

awsactivity

  1. Name the activity Query EC2 Instance in the activity Display Name and Override the workflow target with: AWS_Target in the activity properties.

image

  1. Specify the URL near the bottom of the activity properties with:
https://ec2.us-east-1.amazonaws.com/?Action=DescribeInstances&Filter.1.Name=private-ip-address&Filter.1.Value=YOUR_POD_IP&Version=2016-11-15

Replacing "YOUR_POD_IP" with the IP address associated with your pod in the table below and set the API Method to GET.

Pod 1: 172.31.22.192 Pod 11: 172.31.4.177
Pod 2: 172.31.19.34 Pod 12: 172.31.9.192
Pod 3: 172.31.28.79 Pod 13: 172.31.2.170
Pod 4: 172.31.7.175 Pod 14: 172.31.6.32
Pod 5: 172.31.11.48 Pod 15: 172.31.11.139
Pod 6: 172.31.14.141 Pod 16: 172.31.5.13
Pod 7: 172.31.9.110 Pod 17: 172.31.2.231
Pod 8: 172.31.5.98 Pod 18: 172.31.4.105
Pod 9: 172.31.6.146 Pod 19: 172.31.0.150
Pod 10: 172.31.13.208 Pod 20: 172.31.7.250

image

  1. Click on the "Start" element in the workflow and customize the workflow "Display Name" to Pod # - AWS Workflow

workflow name

  1. Validate and Run this workflow near the top of the canvas.

validate 1

After running this activity, you should see the details of the instance that you queried in the output body.

first run

Click Modify to return to the Workflow Editor

modify

Next we will extract some data from the returned XML Response using an XPATH Activity.

  1. From the Core activites list grab and drag the XPATH Query and drag it to the canvas.

xpath

  1. Rename the activity Extract EC2 Details

name xpath

  1. Scroll down on the properties window and find where you will specify Source XML to Query. Click the puzzle piece in the upper-right corner to select a source.

xml query

  1. Choose Activities --> Query EC2 Instance --> Body and choose Save

image

  1. Click the "+" next to XPATH Query. Fill in the following details:

    Property Name: Instance ID
    XPath Query: //reservationSet/item/instancesSet/item/instanceId
    Property Type: String

    Click the "+" again to add another variable.

    Property Name: Security Group
    XPath Query: //reservationSet/item/instancesSet/item/groupSet/item/groupName
    Property Type: String

The properties should look like the graphic below.

xml query 3

Next we'll add a simple conditional block to check if one of our variables matches a specific value.

  1. Click on the Logic tab of the navigation, expand Logic and drag the Condition Block to the canvas.

1

  1. Click on each of larger block and rename it Is Instance Isolated? and the smaller block on the left and name it Yes.

2

  1. Click on the Activities tab of the navigation, locate the Generic AWS API Request from the AWS Service section and drag it to the canvas into the Yes block.

3

  1. Change the activity name to Tag EC2 Instance.

4

  1. In the properties of the Tag EC2 Instance, scroll down and supply the following details:

Override Workflow Target to AWS_Target.

Set the AWS API Request URL to the one below and the API Method to GET

https://ec2.amazonaws.com/?Action=CreateTags&ResourceId.1=INSTANCE_ID&Tag.1.Key=Isolated&Tag.1.Value=&Version=2016-11-15

5

  1. Highlight the INSTANCE_ID in the URL string and click the puzzle piece in the upper-right of that field.

tag1

Choose Activities --> Extract EC2 Details --> XPath Queries --> Instance ID

instanceid

The resulting URL should show the variable name set as one of the parameters.

awsapi1

  1. Since we only have one condition, you can delete the other conditional branch. By clicking on it, choosing the three dots, and choosing Delete.

delete

  1. Click into the Yes conditional branch to set the test condition. Click on the puzzle piece in the Left Operand field.

Condition

Choose Activities --> Extract EC2 Details --> XPath Queries --> Security Group

rightoperand

Then specify Isolate_SG as the Right Operand. When completed, it should look like the graphic below.

conditional 2

  1. Click Validate again at the top of the window and run the workflow again.

validate 2

When the workflow runs this time you'll be able to see the output of the second activity that parses the XML response from the first activity and extracts the name of the Instance and assigend Security Group for your EC2 instance. You'll notice that the conditional block doesn't trigger since the condition we specified doesn't match.

second run

We will revisit this created workflow later after we initiate our completed incident response workflow.

Importing a workflow from Github

SHARED ENVIRONMENT ALERT
Make sure you uniquely name your workflow after importing!

  1. Click back to Workflows and choose the Import button.

image

  1. Choose, Import from Git --> DEVWKS-2240 for Git Repository, sxo-aws-ir for File Name, Updated Keys for Git Version, and finally Import as a New Workflow and click Import.

image

  1. After importing, it will show up as Copy(1)-AWS Incident Response. Open this newly created workflow.

image

  1. Name your workflow Pod X - AWS Incident Response replacing the pod number with yours.

image

  1. Replace the variable for 'observable_value' with the IP address for your pod from the table below.

observable

Pod 1: 172.31.22.192 Pod 11: 172.31.4.177
Pod 2: 172.31.19.34 Pod 12: 172.31.9.192
Pod 3: 172.31.28.79 Pod 13: 172.31.2.170
Pod 4: 172.31.7.175 Pod 14: 172.31.6.32
Pod 5: 172.31.11.48 Pod 15: 172.31.11.139
Pod 6: 172.31.14.141 Pod 16: 172.31.5.13
Pod 7: 172.31.9.110 Pod 17: 172.31.2.231
Pod 8: 172.31.5.98 Pod 18: 172.31.4.105
Pod 9: 172.31.6.146 Pod 19: 172.31.0.150
Pod 10: 172.31.13.208 Pod 20: 172.31.7.250

Replace the value for your pod and click save.

observable2

Note the activites in this workflow that automate many of the steps outlined in the AWS EC2 Incident Response Guide.

  • Enables Termination Protection on the instance
  • Sets a restricted Security Group limiting access
  • Removes it from any Auto Scaling Groups
  • Removes it from any Elastic Load Balancers
  • Snapshots connected Elastic Block Storage devices
  • Tags the instance with IR details
  1. Run your imported workflow.

image

  1. Return to your previously created workflow Pod X - AWS Workflow that pulls instance details and run the workflow again.

  2. Click on the Extract EC2 Details activty and note that after running the incident response workflow, the Security Group has been changed to move the impacted host to an isolated security group (Isolate_SG) and our condition now matches and the additional tagging activity has been run to identify the host as isolated.

third run

Integration with SecureX threat response

  1. Click Dashboard at the top of the SecureX Window to exit out of the Orchestration tool.

  2. Expand the Ribbon by clicking the SecureX icon at the bottom-right of the screen to see created casebooks and incidents for this environment.

securex1

  1. Click on the casebooks icon on the top of the window and find the DEVWKS-2240 Casebook Casebook created "By Others" by searching for 'DEVWKS' in the casebook pane.

casebook1

  1. Click Investigate in Threat Response located on the right-hand side of the Casebook drawer or on the upper-right of the ribbon.

casebook2

This will open up a new browser window that contains the results of our investigation into one domain and the AWS internal IP addresses from our lab.

Once the enrichment of the observables is complete, you should see your IP address denoted as a 'target' in the resulting graph.

image

  1. Use the drop-down to show the SecureX orchestration response actions that can be ran against this host, including the one you imported and uniquely named.

image

THANK YOU for attending this DevNet Workshop and learning about SecureX orchestration. I'll be putting some links and code into the Webex space associated with this session following this session! Enjoy your time at Cisco Live!

clemea-devwks-2240's People

Contributors

briansak avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.