> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/tutorials/cortex-xsoar-tutorials/readme/set-up-a-phishing-incident-in-cortex-xsoar.md).

# Set up a Phishing Incident in Cortex XSOAR

Phishing is the fraudulent attempt to obtain sensitive information, such as user names, passwords and credit card details by disguising an entity as trustworthy in an electronic communication. It is usually carried out by email spoofing or instant messaging, and often directs users to enter personal information at a fake website which matches the look and feel of a legitimate site.

Malware can also play a role in phishing attempts. For example, users can be duped into downloading and running a file on their machine, which in turn infects their machine and possibly other machines.

This tutorial takes you through the process of setting up a phishing incident in Cortex XSOAR. Use this template as a base resource to design and implement your own automated response to a phishing incident.

For this tutorial, you will need a dedicated phishing inbox using EWS, a VirusTotal API key, Active Directory, and Palo Alto Networks Wildfire. You can also configure alternative integrations, following the basic principles of this tutorial. For example, instead of EWS, you could use Gmail. If you have another sandbox integration available, you can substitute that for Palo Alto Networks Wildfire. For threat intelligence, you might use Recorded Future v2 instead of VirusTotal.

{% hint style="info" %}

### Note

Cortex XSOAR v6.9 and later includes the Cortex XSOAR Deployment Wizard for Phishing. After installing the Phishing content pack, the Deployment Wizard provides assistance with configuring integrations and playbook parameters. This tutorial provides step by step guidance for planning and implementing your response to phishing incidents, and can be used either as a supplement to the Deployment Wizard or on its own. If you use this tutorial with the Deployment Wizard, certain steps, such as navigating to specific pages to modify settings, are automated.
{% endhint %}

{% hint style="info" %}

### Note

You can also manage phishing alert incidents generated from email security gateways using the [PhishingAlerts content pack](https://xsoar.pan.dev/marketplace/details/PhishingAlerts).
{% endhint %}

To get up and running with a phishing incident in Cortex XSOAR, follow these stages.

| Stage | Section                                                                                                                         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ----- | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1.    | [Planning](#UUID-02a5ff04-e924-a61e-2792-101ffed4f43e_UUID-80c1a9a8-43e6-15ac-c33d-66c0443284a3)                                | Before installing Cortex XSOAR, plan how you are going to ingest incidents into Cortex XSOAR, what analysts need to investigate, how to deal with the response, what integrations you need, etc.                                                                                                                                                                                                                                                                |
| 2.    | [Install and Configure Content Packs](#UUID-02a5ff04-e924-a61e-2792-101ffed4f43e_UUID-9bc03032-ef73-8d86-c2fd-e79464c8c732)     | To begin, install the relevant content packs from the Cortex XSOAR Marketplace and add the required instances. In this example, we are going to add the Phishing content pack, the Microsoft Exchange Online content pack, which includes the EWS O365 integration to ingest incidents, the VirusTotal content pack for the VirusTotal integration for data enrichment, etc. In addition, we will install the Phishing Campaign and Phishing URL content packs. |
| 3     | [Customize the Phishing Layout](#UUID-02a5ff04-e924-a61e-2792-101ffed4f43e_UUID-d0bc85e6-02ef-7256-3476-a55485be4ff7)           | Review the phishing incident layout, create new custom fields, and edit the phishing incident layout.                                                                                                                                                                                                                                                                                                                                                           |
| 4.    | [Classify and Map Fields](#UUID-02a5ff04-e924-a61e-2792-101ffed4f43e_UUID-29082c08-eb0b-bbfc-e909-4c7ad5789e27)                 | Classification enables you to have a better control of the type and structure of incoming incidents. Map the fields so you can see these fields in the incident layout.                                                                                                                                                                                                                                                                                         |
| 5.    | [Add Pre-Process Rule](#UUID-02a5ff04-e924-a61e-2792-101ffed4f43e_UUID-eae5ef9a-3fde-8546-8412-045a1b5a6ff0)                    | Add pre-process rules to perform certain actions on incidents as they are ingested into Cortex XSOAR. For example, drop identical incidents and link to existing incidents.                                                                                                                                                                                                                                                                                     |
| 6.    | [Review and Customize Phishing Playbooks](#UUID-02a5ff04-e924-a61e-2792-101ffed4f43e_UUID-a267d239-872a-d9fa-7ecc-21f7f118a790) | Playbooks are triggered either when an incident is created or when you run them manually as part of an investigation. In this example, we use the **Phishing - Generic v3** playbook.                                                                                                                                                                                                                                                                           |
| 7.    | [Create Post-Process Rules](#UUID-02a5ff04-e924-a61e-2792-101ffed4f43e_UUID-ef28126e-9552-e3dd-1ad1-d2df18e3a8dc)               | Once the incident is complete and you are ready to close it, you can run various post-processing actions on the incident.                                                                                                                                                                                                                                                                                                                                       |
| 8.    | [Summary](#UUID-02a5ff04-e924-a61e-2792-101ffed4f43e_UUID-f9e52e2b-6d36-31c2-7f6e-6835db3f3150)                                 | Once everything is set up, analysts can start investigating incidents.                                                                                                                                                                                                                                                                                                                                                                                          |

### Plan Your Phishing Incident

Before you begin, consider the following requirements:

<details>

<summary>Where do your phishing incidents originate?</summary>

Sometimes, phishing incidents originate from another phishing tool, like PhishLabs, or from an inbox in Gmail, Microsoft O365, EWS, etc. You should consider whether you want to use impersonation rights if you need to retrieve the phishing email from the user’s email. If you do not have the original email, investigation is more problematic.

In this example, all emails are either forwarded or attached as a file to an email, which is sent to an organization's designated phishing email inbox. We want to fetch all phishing emails, whether they are forwarded or attached into Cortex XSOAR, using EWS O365. We want to use impersonation rights to get the original email from a user’s inbox. Although not essential, we also want to use Active Directory to obtain users’ details.

</details>

<details>

<summary>What information do you want to see in an incident as part of an investigation?</summary>

You likely want to see the source email, destination email, email headers, body, email HTML, email text, attachment hash/extension, etc.

The phishing incident layout comes out of the box with the fields that are necessary to investigate a phishing incident. These sections and fields are fully customizable.

</details>

<details>

<summary>What is your current incident response process?</summary>

You may want to check IP addresses for location, act according to the country to increase severity, block IPs, manually investigate further, and close incidents. You may also want to search and delete malicious emails, check for clicked URLs, and block a domain or an email address.

You can use and customize out-of-the-box playbooks, or create your own playbook for a phishing investigation and response.

</details>

<details>

<summary>Which enrichment feeds do you use?</summary>

Usually, you want to extract email headers from the original email, subject, body, and extract relevant IOCs, etc. In this example, we enrich all extracted IOCs via VirusTotal.

</details>

<details>

<summary>Which detonation systems do you use?</summary>

Based on the verdict of the IOC, you should use static/dynamic file analysis tools or sandbox integrations to determine the maliciousness of file attachments. You can run this automatically in the playbook or manually. In this example, we detonate malicious files using Palo Alto Networks Wildfire.

</details>

<details>

<summary>Are there any manual steps that need to be taken?</summary>

Consider which manual steps need to be taken. These steps can be added to a playbook.

For example, consider the following:

* At what stage do you want an analyst to investigate?
* Do you want to confirm before deleting an email from another user’s account?
* Will you notify an analyst to investigate if there is an unexpected error?

In this example, we want the analyst to investigate to see if the incident was malicious after indicators were extracted from the email and a file attachment was detonated.

</details>

<details>

<summary>Are there end-user interactive steps?</summary>

Do you need to ask the end user questions via email, Slack or any other communication channels? Do you need management approval by email? Do you need to get another analyst? These steps can be added to a playbook such as error checking, escalation, etc.

</details>

<details>

<summary>Are there any steps to be taken after closing an incident?</summary>

After closing an incident, do you need to send a notification to a third-party service such as Jira or *ServiceNow*, or verify that all tasks are done?

In this example, when closing an incident we want to update automatically the owner of the incident, so if it is reopened this user receives notification.

</details>

<details>

<summary>Do you need to restrict incident investigations?</summary>

Do you want to restrict incident actions and investigations according to roles? Do you want to give read-only access to certain roles at certain times? For example, when an incident is in triage, you may want all Tier-2 analysts to have read-only access.

In this example, we want an option for read-only access for certain roles.

</details>

<details>

<summary>Do you want to find and manage Phishing Campaign incidents?</summary>

A phishing campaign is a collection of phishing incidents that originate from the same attacker, or as part of the same organized attack launched against multiple users. In a phishing campaign many emails are sent which contain similar text. You may want to find active incidents with a similar subject line and sender, close duplicate incidents, etc. The **Detect & Manage Phishing Campaigns** playbook in the **Phishing Campaign** content pack finds duplicate incidents and creates an incident to investigate the phishing campaign.

</details>

After you have finished the planning stage, you can proceed to install the necessary content packs to manage phishing incidents in Cortex XSOAR.

### Install and Configure Content Packs

To begin, we need to install and configure the relevant content packs.

| Content Pack                   | Content                                                                                          | Description                                                                                                |
| ------------------------------ | ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| Phishing                       | Automations, Playbooks, Incident Fields, Incident Layouts, Incident Types, Playbooks             | Phishing content pack                                                                                      |
| Microsoft Exchange Online      | [EWS O365](https://xsoar.pan.dev/docs/reference/integrations/ews-v2)                             | Mail listener/sender                                                                                       |
| VirusTotal                     | [VirusTotal - (API v3)](https://xsoar.pan.dev/docs/reference/integrations/virus-total-api-v3)    | Data enrichment and threat intelligence                                                                    |
| WildFire by Palo Alto Networks | [Palo Alto Networks WildFire V2](https://xsoar.pan.dev/docs/reference/integrations/wild-fire-v2) | Forensic and Malware analysis                                                                              |
| Phishing Campaign              | Automations, Incident Fields, Incident Type, Layout, Playbook                                    | Detect whether a phishing incident is part of a phishing campaign                                          |
| Phishing URL                   | DBotPredictURLPhishing and DBotUpdateLogoURLPhishing automations                                 | Predict phishing URLs using a pre-trained model. Add, remove, or modify logos from the URL Phishing model. |

We will also use the [Rasterize](https://xsoar.pan.dev/docs/reference/integrations/rasterize#configure-rasterize-on-cortex-xsoar) and [Active Directory](https://xsoar.pan.dev/docs/reference/integrations/active-directory-query-v2) integrations, which are pre-installed.

**Install the Phishing Content Pack and Configure the EWS Email Gateway**

1. Go to Marketplace, search for **`Phishing`** and install the **Phishing** content pack.
2. During installation, select **Microsoft Exchange Online** as the email gateway. The **Microsoft Exchange Online** content pack will install at the same time as the **Phishing** content pack.
3. After the content packs are installed, go to **Settings** → **INTEGRATIONS** → **Instances** and search for **`EWS O365`**.
4. Add the **EWS O365** integration instance, which fetches events, attachments, and original emails from an inbox, and searches and deletes emails.

   1. Click **Add instance**.
   2. Choose **Fetches incidents**.
   3. Verify the classifier is set to **EWS - Classifier**, which classifies incoming incidents as Phishing. If you were configuring an integration instance that did not have a classifier available, you would select **Phishing** for the **Incident type (if classifier doesn’t exist)** option.
   4. Follow the instructions to authorize the Demisto app and enter the ID, Token, and Key that you receive.
   5. Add the email address of the designated phishing inbox from which to fetch incidents.
   6. If you want to designate a specific folder from which to fetch emails as phishing incidents, enter that folder name. Otherwise, leave the default as **Inbox**.
   7. Add any other options as required.
   8. After you click **Test**, Cortex XSOAR attempts to connect to EWS. If you receive an error message that auto discovery failed, you need to add details manually (the Exchange server hostname, the domain username, the Exchange server version, and the Advanced Mode Override Authentication type).

      ![phishing-ews.png](/files/vjcIOppdmz535dYVHkbj)
   9. **Save & exit**

   The system starts ingesting incidents from EWS. Every email creates an incident in Cortex XSOAR.

**Configure the VirusTotal (API v3), Palo Alto Networks Wildfire, and Active Directory Query Instances**

* **`VirusTotal`** investigates suspicious files, domains, URLs, IP addresses, etc.
* **`Palo Alto Networks WildFire v2`** Submits files, returns the report, and looks up the file reputation.
* **`Active Directory Query 2`** Accesses and manages Active Directory objects (users, contacts, and computers) and runs AD queries.

VirusTotal (API v3)

1. Go to Settings → **INTEGRATIONS** → **Instances** and search for **`VirusTotal (API v3) (Partner Contribution)`**.
2. Click **Add instance**.
3. Add the VirusTotal API key.

   For testing purposes, if you do not have a VirusTotal subscription, you can use the VirusTotal public API, which is limited to 500 requests per day, at a rate of 4 requests per minute, and cannot be used in commercial products or services. The VirusTotal premium API does not have these limitations.
4. Click **Test** and then **Save & Exit**.

Palo Alto Networks WildFire v2

1. Go to Settings → **INTEGRATIONS** → **Instances** and search for **`Palo Alto Networks WildFire v2`**.
2. Click **Add instance**.
3. Add the API key.
4. Click **Test** and then **Save & Exit**.

Active Directory Query v2

1. Go to Settings → **INTEGRATIONS** → **Instances** and search for **`Active Directory Query v2`**.
2. Click **Add instance**.
3. Add the Server IP address, Port, Credentials, Password, and Base DN.
4. Click **Test** and then **Save & Exit**.

**Install the Phishing Campaign Content Pack**

We want to detect whether a phishing incident is part of a phishing campaign. Go to the **Marketplace** page and Install the [Phishing Campaign](https://xsoar.pan.dev/docs/reference/packs/phishing-campaign) content pack to find, create, and manage phishing campaigns. The Phishing Campaign content pack provides useful information such as an aggregation of all the indicators from all emails, the number of senders and recipients, the analysts investigating the different incidents, etc. When phishing incidents are similar to each other, Cortex XSOAR detects and creates the links between them, and adds them to a **Phishing Campaign** incident. This enables you to view and take action on the campaign as a whole (such as informing the recipients about the campaign, or linking, unlinking, closing and reopening the related incidents), rather than spend time investigating each incident separately.

![phishing-campaign.png](/files/3jphG2byuaSRu1g6e3s7)

**Install the Phishing URL Content Pack**

The Phishing URL content pack contains the **DBotPredictURLPhishing** automation used in the **Phishing - Machine Learning Analysis** sub-playbook. The automation loads a pre-trained model to detect URL phishing attacks.

#### Review the Phishing Incident Type

Cortex XSOAR supports multiple incident types. When incidents are ingested into Cortex XSOAR, they are classified by type. The Microsoft Exchange Online content pack, which we installed with the Phishing content pack, includes a classifier which assigns phishing email messages to the phishing type. For the phishing incident type, you can customize layouts, assign a default playbook, and define rules to extract indicators from incident fields and enrich them using commands and scripts.

To edit an incident type, the incident type must be detached or you must duplicate the incident type and edit the copy. When an incident type is detached, it no longer receives updates to the incident type from the related content pack. If you want to receive updates, duplicate the incident type instead of detaching it. The original incident type continues to receive updates, in this case, but the duplicate does not. For this tutorial, we will detach the incident type.

1. Go to Settings → OBJECTS SETUP → Incidents → Types.
2. Select the **Phishing** type and click **Detach**
3. Select the **`Phishing`** incident type and click **Edit**.
4. From the **Settings** tab, review the following:
   * In the **Default playbook** field, confirm the **Phishing - Generic v3** playbook is selected.
   * In the **Layout** field, keep the default **Phishing Incident v3** layout. We will later customize this layout.

     We will create a post process rule later, but for now we will leave this blank.

     ![phishing-incidentype2.png](/files/LyE6KhgfVhEnJnmfWFZj)
5. In the Indicators Extraction Rules tab, review the fields that are being extracted.

   ![phishing-extract.png](/files/weRGfd6YVa3oCTobcwVl)

   You can see there are hundreds of incident fields, but only relevant fields are being extracted for phishing (Email Body, Email Reply To, Email Body HTML, Email Subject, etc. ). These extraction rules are specific to the Phishing incident type, and we want to keep these out-of-the-box settings for now. We can make changes to indicator extraction rules later, if we see that unnecessary indicators are being extracted or if we are missing extraction for specific fields.
6. If you have made any changes, click **Save**.

### Customize the Phishing Layout

Each incident type has a layout. When building or customizing an incident layout, you want to display the most relevant data for analysts at all stages of the incident life cycle, from ingestion to remediation. For example, in the **Investigation** tab of the phishing layout, you can see information about the email (ID, subject, sender, etc.), the email text, attachments, the email image (using Rasterize), indicators, etc. In this section, we will review the phishing layout as it comes out of the box, create additional custom fields, and add fields to the phishing layout.

**Review the Phishing Layout**

![phishing-incidentype.png](/files/CLsZM3xLh80I18BQoY6u)

You can familiarize yourself with the phishing layout before you make any changes. The phishing content pack includes fields specific to phishing investigations, including attachment type, size, email body, email headers, reporter email address, etc., which are included in the phishing incident layout. You can create new sections, add buttons, add custom fields, etc. To view the layout, select Settings → OBJECTS SETUP → Incidents → Layouts → **Phishing Incident v3**.

You can see the following tabs:

* **Incident Summary**

  In the **Incident Summary** tab, there are seven out-of-the-box tabs. We will concentrate on the following tabs (as these are customizable):

  **Case info**

  This **Case info** tab contains a summary of the relevant information an analyst may require about the phishing incident (such as type, severity, playbook, etc.), timeline information (when the incident occurred, created, updated, etc.), Work Plan information (tasks that require manual intervention, such as manual tasks or tasks with an error status), team members, a link to a Phishing Campaign incident (if relevant), etc.

  ![phishing-case.png](/files/WOqNNB5UP1TtiR2Tyt3t)

  **Investigation**

  The investigation tab provides more in-depth information, including email headers and analysis, machine learning checks, macro code (if present in an attachment), the email text, HTML image, attachments, indicators, and information such as the email sender, subject, and ID.

  If the phishing incident is part of a phishing campaign, the incident is linked to the **Phishing Campaign** incident type (you can also see a link in the **Linked Incidents** section in the **Case Info** tab).
* **New/Edit Form**

  Contains information relevant to creating or editing a phishing incident.

  In addition to ingesting phishing incidents from an email inbox, you can also manually create a phishing incident in Cortex XSOAR. The new incident layout for phishing incidents enables you to populate a phishing incident by uploading the email as an EML or MSG file.
* **Close Form**

  Contains information relevant to closing a phishing incident.
* **Incident Quick View**

  Contains summary information relating to the phishing incident.

**Create Custom Fields for the Phishing Layout**

You are now familiar with the out-of-the-box phishing layout, but you can also create custom fields to add to the phishing layout. You can view and edit all existing out-of-the-box fields in the fields table.

In this example, we create the following fields:

| Field Name                           | Field Type         | Comments/Values                                                                                                                                                                                                                                        |
| ------------------------------------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Was an anonymous email service used? | Boolean (checkbox) | Actors using anonymous emails. We will add this to the **Case info** tab and when creating or editing an incident.                                                                                                                                     |
| Was a link clicked?                  | Boolean (checkbox) | We will add this to the **Case info** tab and when creating or editing an incident.                                                                                                                                                                    |
| Was there a High Value Target?       | Boolean (checkbox) | We will add this to the **Case info** tab and when creating or editing an incident.                                                                                                                                                                    |
| Sensitivity                          | Short text         | <p>We will add this to the <strong>Case info</strong> tab and when creating or editing an incident.</p><p>Sensitivity refers to the classification level of the email, set by the user sending the email, if the email contains sensitive content.</p> |

1. Go to Settings → OBJECTS SETUP → Incidents → **Incident Fields**.
2. Create the Boolean fields, such as **Was there a High Value Target?**
   1. Click **New Field**.
   2. In the **Field Type** field, select **Boolean (checkbox)**.
   3. In the **Field Name** field, type the name you want to use, such as **`High Value Target`**.

      By default, this field is available for all incident types. To choose specific incident types, deselect the checkbox for **Add to all Incident types** and select the desired incident type(s) from the dropdown menu.
   4. Click **Save**.
   5. Repeat for the other Boolean fields.
3. Create the short text field.
   1. Click **New Field**.
   2. In the **Field Type** field, select **Short text**.
   3. For the **Field Name** field, type **`Sensitivity`**.
   4. Click **Save**.

{% hint style="info" %}

### Note

You can also add existing incident fields, either out-of-the-box fields or fields from other content packs, to your Phishing incident layout. For example, if you wanted to include the **User** field from the Malware content pack in your Phishing incident layout, you would edit the **User** field and add **`Phishing`** from the **Add to Incident types** dropdown. The field would then be available to add to your Phishing incident layout.
{% endhint %}

**Add Fields to the Phishing Incident Layout**

We are going to add both custom fields and existing out-of-the-box fields to the phishing layout.

To edit an incident layout, the layout must be detached or you must duplicate the incident type and edit the copy. When an incident type is detached, it no longer receives updates to the incident type from the related content pack. If you want to receive updates, duplicate the incident type instead of detaching it. The original incident type continues to receive updates, in this case, but the duplicate does not.

1. Go to Settings → OBJECTS SETUP → Incidents → **Layouts**.
2. Select the **Phishing Incident v3** layout checkbox.
3. Click **Detach**.
4. Select the **Phishing Incident v3** layout and click **Edit**.
5. In the **Case info** tab, add the custom fields.

   We can add these custom fields to any section. In this example, we want to create a new section.

   1. From the **Library** section, in the **Sections** tab, drag and drop the **New Section** onto the **Case info** tab.
   2. Rename the section to **Additional Email Information** by clicking the pencil icon and selecting **Edit section settings**.
   3. In the **Fields and Buttons** tab, drag and drop the custom buttons we have created.
6. Add existing system fields.
   1. Drag and drop the **XSOAR Read Only Roles** field to the existing **Case Basic Details** section,

      In the planning stage, we identified the need to add a read only button for a phishing incident. This allows analysts to restrict access to the incident to read-only.

      ![phishing-fields-6x.png](/files/rkdrJyeZmMCIpSnMXXge)
7. Click the **“New”/”Edit” Form** tab, add the custom fields, as required. You can see below we have added the fields to the **Incident Metadata** section.

   ![incident-metadata-6x.png](/files/Hm0g8C7qnVyrV1gcMo6o)
8. Click **Save Version**.

   This enables you to restore any changes made. You have the option to include a note about your changes.

### Classify and Map EWS Fields

Classification determines the type of incident that is created for events ingested from a specific integration (EWS O365). Mapping matches the fields from your third-party integration to the fields that you associate with the phishing incident (often displayed in the layout as well).

EWS comes out of the box with the following:

* **EWS - Classifier**
* **EWS - Incoming Mapper**

As we are ingesting incidents from a phishing mailbox, we do not need to change the classifier, as everything that is ingested into Cortex XSOAR from the EWS mailbox is classified as phishing. If there were other third-party integrations that you fetched incidents from such as QRadar you may need to update the classifier.

**Map Incident fields**

Although incidents are ingested into Cortex XSOAR as phishing, we need to ensure the correct attributes are mapped to the phishing incident fields in the layout.

Most of the mapping is done out of the box. Nevertheless, it's important to review the data, check that it's mapped correctly and add fields where necessary.

1. Select Settings → OBJECTS SETUP → Incidents → Classification & Mapping → **EWS - Incoming Mapper** checkbox.
2. Click **Duplicate**.
3. Click **EWS - Incoming Mapper\_copy**.
4. In the **Incident Type** dropdown, change from the default **`Common Mapping`** to **Phishing**.
5. In the **Select Instance** field, select your EWS configured instance.

   On the left side of the screen you see all of the fields that are available for the phishing incident type. We can see that some fields are already mapped, such as Attachment Count, Attachment ID, Email Body, Email CC, etc.
6. Add one of the custom fields we created.
   1. For the **Sensitivity** field, click **Choose data path**.
   2. In the **root** section (right-hand side of the window), click **sensitivity**.
   3. Repeat these steps if you have any unmapped custom fields.
   4. Save the changes to the mapper.
7. Click **Auto Map** to automatically map the remaining fields based on naming convention. In this example, **`SHA256`** maps to **`attachmentsSHA256.`**

   ![phishing-map.png](/files/LAMQGYCGCoHZ7e4kBGRw)
8. By default, the instance is set to use the **EWS - Incoming Mapper** and now needs to be changed to the duplicate mapper we have created and edited. Go to **Settings** → **INTEGRATIONS** → **Instances** and click the gear icon to edit the settings for the **EWS O365** instance. Change the mapper to **EWS - Incoming Mapper\_copy**, **Save & exit**.

### Add Pre-Process Rule

Pre-process rules enable you to perform certain actions on events as soon as they are ingested into Cortex XSOAR. We can use pre-process rules to drop incidents, close duplicate incidents, link incidents together, run a script, etc. In this example, our organization has been running a phishing awareness campaign to check if internal users properly report phishing emails. We don't want to investigate these incidents, as we know they are not truly malicious emails.

1. Select Settings → Integrations → Pre-Process Rules → **New Rule**.

   From Cortex XSOAR v6.11 and later, go to **Settings** → **OBJECTS SETUP** → **Incidents** → **Pre-Process Rules** → **New Rule**.
2. In the **Rule Name** field, type, **`Phishing Awareness Campaign`**.
3. In the **Conditions for Incoming incident** section, add the following filter:

   ![best-employee-award.PNG](/files/dMTZBu9D47eKpT3x7spQ)
4. In the **Action** field, select **Drop**.
5. Click **Save**.

   All future incidents that include this subject are dropped. If the awareness campaign concludes or a new email subject is used, you may want to remove or edit this pre-process rule.

### Review and Customize Phishing Playbooks

For any phishing threat or attack, a SOC team needs to go through the following processes sequentially:

* Detection
* Identification
* Analysis
* Remediation

Each of the high-level processes might contain several sub-processes that require step-by-step actions to be performed. You can use playbooks to detect, identify, analyze and remediate an event.

The Phishing content pack comes out of the box with several playbooks, such as the **`Phishing - Generic v3`**, **`Process Email - Generic v2`**, **Calculate Severity By Email Authenticity**, etc. You can customize these out-of-the-box playbooks, or create your own playbook.

#### Customize the Phishing - Generic v3 Playbook

In this example, select the **Phishing - Generic v3**, as this is a comprehensive playbook and uses numerous playbooks which are all interlinked to create a complete cycle from detection to remediation.

1. Go to **Playbooks** and Search for **Phishing - Generic v3**.
2. To edit the playbook (add/delete tasks, sub-playbooks, or the flow, etc.) choose **Detach Playbook** from the three-button menu.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><h3>Note</h3><p>If you want to receive content updates for the playbook, duplicate rather than detach the playbook. If you duplicate the playbook, change the default playbook for the Phishing incident type from <strong>Phishing - Generic v3</strong> to your new playbook name.</p></div>
3. Review and change the playbook inputs by clicking **Playbook Triggered**.
   1. **Role**: By default, the least busy user is assigned to the incident. If you set a role, the incident will only be assigned to users with that role.
   2. **SearchAndDelete**: Turn on or off the Search and Delete Process in EWS O365. Part of the [remediation process](#UUID-02a5ff04-e924-a61e-2792-101ffed4f43e_id943ec258-fd37-4632-aa01-632508b38709). If set to true, in case of a malicious email, the **Search and Delete** sub-playbook looks for other instances of the email and deletes them pending analyst approval. We will leave the default option, **`False`**.
   3. **BlockIndicators**: Also part of the [remediation process](#UUID-02a5ff04-e924-a61e-2792-101ffed4f43e_id943ec258-fd37-4632-aa01-632508b38709). Automatically blocks malicious indicators in relevant integrations. For our example, we keep this as **`False`**.
   4. **AuthenticationEmail**: Whether to authenticate the email. Leave as the default, **`true`**. See **Authenticate the email** under the [investigation stage](#UUID-02a5ff04-e924-a61e-2792-101ffed4f43e_id1798192a-e281-4bb8-906c-22c86f63f4b8).
   5. **OnCall**: Whether to assign a user that is currently on shift. To define shifts, see Shift Management. Change this to **`True`**.
   6. **SearchAndDeleteIntegration**: This setting is only relevant if **SearchAndDelete** is set to **`true`**. If you later decide to use the **SearchAndDelete** option, change the integration here from **`EWS`** to **`O365`**.

      If you use enable **SearchAndDelete** and set the **SearchAndDeleteIntegration** to O365, continue with the O365 inputs such as **O365DeleteType**.
   7. **CheckMicrosoftHeaders**: If using EWS O365, the Bulk Confidence Level (BCL), Spam Confidence Level (SCL) and the Phishing Confidence Level (PCL) values on the Microsoft headers are considered as part of severity and email classification (whether the email is spam). These values help security teams determine whether the email is coming from a spam, phishing or bulk sender. Leave as the default, **`True`**.
   8. **InternalDomains**: When the **Email Address Enrichment Generic v2.1** sub-playbook runs, it uses the internal domain entered here to determine if the email was reported from an internal or external email address.
   9. **GetOriginalEmail**: Used to retrieve the original email, when the phishing email is forwarded and not attached. Change this to **`True`** only if you have permissions in EWS O365 to execute global search (eDiscovery). This input is used to determine if the **Get Original Email - Generic v2** sub-playbook should run.
   10. Click **Save**.

       After the playbook starts, the detection timer begins, which detects how long it takes to detect the incident. You can change which timer to start but we will use the default.
4. Review the **Engage with User** stage of the playbook.

   The playbook does 2 tasks simultaneously:

   * Engages with the user
   * Triage

   The **Engage with User** stage stores the name of the user. The **Email Address Enrichment - Generic v2.1** sub-playbook here receives the email address of the user reporting the phishing email. If there is an email address from an internal domain, the sub-playbook uses Active Directory to find the name of the user reporting the phishing email. When we engage with the user, we can then address them by name.

   An email is sent to the reporting user acknowledging that the incident was received. You can update the message (body) by clicking the **Acknowledge incident was received** task.

   ![phishing-pb-task.png](/files/EfjBr4JBViIKCNVKQelT)
5. **Triage** section of the playbook.

   The triage section extracts relevant information such as indicators from a file, detonates the file, and uses machine learning to predict the phishing type and update the incident with predictions. Triage includes the following tasks:

   * **Process Email - Generic v2**

     Triage starts with the **Process Email - Generic v2** playbook, which processes the email and extracts relevant information from files including attachments. This playbook branches according to whether the email is attached. To view the playbook, hover over the task and then click the eye icon below the task.

     * **Extract email artifacts and attachments** task

       Email artifacts and attachments are extracted by this task, which uses the **`ParseEmailFilesV2`** script. This task takes the email file and extracts all email addresses, subject, file attachments, etc. The task does not finish until everything has been extracted (inline). The results are then entered into the incident layout.
     * **Get Original Email - Generic v2** sub-playbook

       While best practice is to attach a file containing the email when reporting spam or phishing, in some cases, users will forward the email instead.

       If the original email is necessary for the investigation and not attached and the **GetOriginalEmail** input in the main playbook is set to **`True`**, the **Get Original - Generic v2** sub-playbook obtains the original email and then adds details to the incident, such as sender, text body, size, body, etc.
     * **Headers** section

       ![phishing-headers-6x.PNG](/files/mn31DdwRa5B3glrIYllS)

       If email headers were extracted, the headers are displayed (you can later use them for authentication). At the same time attachment information is added, such as size, MD5 hashes, number of attachments, etc.
     * **Email Screenshot** section

       ![phishing-screenshot-6x.PNG](/files/T2MdboXuzyQM8J6QeExe)

       If the email is HTML-formatted (not in all cases), it creates an image out of that HTML data to show how the email was seen by the user using Rasterize.
   * After extracting the relevant information, we return to the **Phishing - Generic v3** main playbook. The following tasks are undertaken at the same time:
     * **Detonate File - Generic** sub-playbook

       Files are executed in an isolated sandbox environment, and their behavior is analyzed. Any sandbox integrations that you have enabled run and provide details about the file reputation, whether the email is forwarded or attached as a file. If, for example, the email is forwarded (not attached as a file), if the email contains a PDF file, then that PDF file will go through detonation/indicator extraction. In this example, we use **Palo Alto Networks WildFire** to detonate files. The payload is triggered so files can be isolated and analyzed.

       <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><h3>Note</h3><p>Detonation is different from file enrichment. For example, VirusTotal file enrichment provides reputation information about the file, based on the file hash. If VirusTotal does not recognize the file hash, no enrichment information is returned, unless the actual file is submitted for analysis. A sandbox integration, by contrast, runs the file in an isolated environment and provides exact information about the file execution.</p></div>

       If your sandbox integration is not here, you can add it.
     * **Detonate URL** sub-playbook

       This sub-playbook uses integrations to safely detonate URLs in a sandbox environment and analyze the website behavior.
     * **Extract Indicators from File - Generic v2** sub-playbook

       If a file is attached, you can extract more indicators from the file. Indicators may exist in the file and not the email. You can extract text based files, Word, PDF, or other supported files, like PPT files (sometimes these contain executable macros). For PDFs, we utilize the image OCR, which extracts text from images inside PDF files.

       ![phishing-pb-ind.png](/files/9KthZhNGZ482t09Z814W)
     * **Phishing - Machine Learning Analysis** sub-playbook

       The Phishing - Machine Learning Analysis sub-playbook performs two functions.

       * Predict Phishing Type - The playbook uses your custom-trained phishing model to predict the phishing type. If you do not have a custom-trained phishing model, it uses a pre-trained out-of-the-box phishing model instead. If the model is able to predict the phishing type, the incident is updated with the prediction.
       * Predict Phishing URLs - If the Rasterize integration is enabled, the DBotPredictURLPhishing script predicts phishing URLs.
6. **Indicator Enrichment**

   After extracting indicators from an email and a detonated file (if there is a file attachment) we need to enrich the indicators. This gives us additional information about the indicators that have been extracted. The **Entity Enrichment - Phishing v2** playbook contains the following sub-playbooks:

   * **File Enrichment - Generic v2**: Enriches the file using the File Enrichment - VirusTotal (API v3) playbook. If there is a SHA256 hash and Cylance Protect v2 is enabled, it enriches the file using Cylance Protect v2.
   * **IP Enrichment - External - Generic v2**: Checks whether there are internal and external IP addresses and enriches external IP addresses using the !IP command, VirusTotal automation (if enabled) and Threat Crowd (if enabled).
   * **Email Address Enrichment - Generic v2.1**: Checks whether email addresses are internal or external. For internal email addresses, additional information is retrieved using Active Directory. For external email addresses, this sub-playbook checks for a domain list input and for domain squatting (such as using a similar domain).
   * **URL Enrichment - Generic v2**: Checks for URLs, verifies SSL & captures screenshots using the Rasterize integration.
   * **Domain Enrichment - Generic v2**: Enriches domain using Cisco Umbrella (if enabled), and VirusTotal (if enabled).

   As we are using VirusTotal, there is no need to customize these sub-playbooks. If you use different enrichment integrations, these need to be added. These playbooks add to the DBot score (reputation of the indicator).
7. **Investigation**

   * Microsoft's Headers Check

     At the beginning of the playbook (**Playbook Triggered**), in the **Inputs** section, we left **CheckMicrosoftHeaders** as the default, **`True`**.

     The [Process Microsoft’s Anti-Spam Headers](https://xsoar.pan.dev/docs/reference/playbooks/process-microsofts-anti-spam-headers) playbook finds the SCL, BCL and PCL values (if they exist) in the Microsoft headers, calculates the severity based on those scores and classifies whether the email is spam or phishing. You can change the minimum severity of each score.
   * Email Campaign Search

     The [Detect & Manage Phishing Campaigns](https://xsoar.pan.dev/docs/reference/playbooks/detect--manage-phishing-campaigns) sub-playbook uses the **`FindEmailCampaign`** automation, which utilizes machine learning to identify existing incidents in Cortex XSOAR that are part of the same campaign of the currently investigated incident. You can customize the inputs as required.

     If the sub-playbook finds that the incident is part of a campaign, it generates campaign-related data which you can observe in the linked **Phishing Campaign** incident, and take actions related to the campaign.
   * Email Authenticity Check

     At the beginning of the playbook (**Playbook Triggered**), in the **Inputs** section, we left **AuthenticateEmail** as the default, **`True`**.

     Using DKIM, DMARC and SPF we check to see if the email is coming from its alleged source, or whether the email has been tampered with.

     The result of the authenticity check is added to the incident field using the **`setIncident`** script.
   * Domain-squatting

     If domain-squatting occurred, the result is saved to the incident field.
   * Email Indicators Hunting

     At the beginning of the playbook (**Playbook Triggered**), in the **Inputs** section, we left **HuntEmailIndicators** as the default, **`True`**.

     The **Phishing - Indicators Hunting** sub-playbook runs to hunt malicious indicators found in other emails and optionally, automatically create new incidents for each found email if **EmailHuntingCreateNewIncidents** is set to **`True`**.

   The results of the previous tasks are used by the **Calculate Severity - Generic v2** sub-playbook, which calculates and assigns the incident severity based on the highest returned severity level from the following:

   * Authenticity of the email (whether it passed the authenticity check).
   * Severity of the critical assets according to the **Calculate Severity - Critical Assets v2** sub-playbook. This playbook checks critical users, critical user groups, critical groups, critical endpoint groups or critical endpoints. You can define the critical users in your organization by editing the inputs. If one critical entity is involved in the incident, it will raise the severity to critical.
   * The current incident severity - (if it already has a severity level).
   * The DBot Score from tasks that run in the parent playbook or sub-playbooks, (such as process email, extract indicators from file, detonation playbooks, machine learning, etc.)
   * The Microsoft Headers Severity (if a value is returned).

   The incident severity is determined by the highest returned score.

   The incident is now assigned to an analyst. Incidents can be assigned according to a role such as Analyst, by the least busy user (less-busy-user), randomly, by user online, etc. For this task, by default, the incident is assigned to the least busy user.

   ![phishing-assign.png](/files/p0gccQTRYPDobgArrnhC)

   The final task in the investigation section determines **Is the email malicious?**.

   The incident severity determines if the email is malicious. If the severity is equal or greater than 2 (medium is 2, high is 3, critical is 4), it is considered malicious. We can change this criteria if necessary.
8. Undetermined/Email is Malicious

   This stage of the process depends on whether the email is undetermined or malicious.

   * **Undetermined**

     This is a manual task. If the severity is low or unknown it is regarded as undetermined. The analyst manually reviews the incident and decides whether it is malicious. If not, the analyst updates the user (who sent the email) that the email is safe and then closes the investigation.
   * **Malicious email**

     If malicious, we update the user that the email is malicious and then start the remediation process. If the incident was part of a phishing campaign we also update the user that the email is part of a malicious campaign.
9. Remediation

   The last part of the process is remediation.

   A timer starts at this point to track remediation time.

   * The **Search and Delete Emails Generic v2** sub-playbook searches and deletes the email from all users across the organization. This sub-playbook runs if the original email was retrieved and **SearchAndDelete** is set to **`True`** in the playbook inputs. During setup, we kept the default setting, **`False`**. If you decide to use this playbook with O365, change the **SearchAndDelete** setting to **`True`**, change **SearchAndDeleteIntegration** from **`EWS`** to **`O365`**, and configure the **O365 - Security And Compliance - Content Search v2** integration.
   * The **Block Indicators - Generic v2** sub-playbook contains sub-playbooks to blocks IPs, files, emails, and domains. For example, the **Block IP - Generic v2** sub-playbook blocks IP addresses using one or more of the following integrations (depending on which integrations you have configured) **PAN-OS**, **MineMeld**, **Zscaler**, **CheckPoint FW**, and **Fortinet**. You can also customize the playbook to add additional integrations.
   * Manually remediate the incident.

   To choose the remediation method(s), go to the **Playbook Triggered** task (at the beginning of this playbook), and set the **BlockIndicators** and the **SearchAndDelete** fields. If one or both are set to true, the playbook follows those branches. If the email is found to be malicious, the analyst assigned to the incident is prompted to manually remediate the incident, regardless of whether the search and delete emails and/or block indicators branches are executed.

   After we have finished the remediation section, the timer stops and the investigation is closed.

### Create Post-Process Rules

After you remedy an incident, you may want to perform additional actions on the incident, such as closing a ticket in a ticketing system such as Service Now or sending out an email, verifying all tasks are completed, etc. You can create a post-processing script to cover as many scenarios as you need.

In this example, when closing an incident, we want to update the owner of the incident automatically to the user who closes it. This user is responsible for any post-closure issues.

1. Create a script in the **Automation** page.
   1. Click **Upload Automation**.
   2. Upload the following script.

      ```screen
      commonfields:
        id: Close Incident by User ID
        version: 1
      contentitemexportablefields:
        contentitemfields:
          packID: ""
          itemVersion: ""
          fromServerVersion: ""
          toServerVersion: ""
          propagationLabels:
          - all
      vcShouldKeepItemLegacyProdMachine: false
      name: CloseIncidentbyUserID
      script: |-
        result = (demisto.args())
        demisto.executeCommand("setIncident", {'owner': result['closingUserId']})
      type: python
      tags:
      - post-processing
      enabled: true
      scripttarget: 0
      subtype: python2
      pswd: ""
      runonce: false
      runas: DBotWeakRole
      ```

      Ensure that the **`post-processing`** tag is selected.

      ![phishing-process.png](/files/Dw8H1TMs6qUYMTX7jT4O)
   3. Click **Save Version**.
2. Add the automation to the **Phishing** incident type.

   1. Select Settings → OBJECTS SETUP → Incidents → Types → Phishing → **Edit**.
   2. In the **Post-process using** field, select **CloseIncidentbyUserID**.
   3. Click **Save**.

   When a user closes an incident, the user who closed the incident now becomes the owner. When an incident is re-opened. the user who closed the incident will be able to keep track of reopened incidents.

### Summary

Once you have customized the phishing incident type, layout, and fields, and the relevant integrations and playbooks, as described in this tutorial, your analysts are assigned phishing incidents as they come in to Cortex XSOAR. For our example, we only used manual remediation, but after reviewing a number of incoming phishing incidents, you might decide to automatically block indicators or search and delete phishing emails across your organization, for greater automation.

To view phishing incidents, go to the **Incidents** and search for **`type:Phishing`**. Open a phishing incident to view both the out-of-the-box sections and the sections we customized in this tutorial. Analysts who have been assigned phishing incidents will also see those incidents listed under **Incidents I own** in the left menu.

![phishing-invest.png](/files/l3RuBHLdoJ3z8eRdEAUu)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/tutorials/cortex-xsoar-tutorials/readme/set-up-a-phishing-incident-in-cortex-xsoar.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
