> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/p/paloalto-cortex-xdr.md).

# PaloAlto Cortex XDR

Cortex XDR is Palo Alto Networks' endpoint detection and response platform. OctoXLabs reads endpoints and risk data, optionally users, and can enrich endpoints with vulnerabilities and installed software.

## Use cases

* List Cortex XDR endpoints that OctoXLabs has collected.

```
Adapters = paloalto-cortex-xdr
```

* Find endpoints that Cortex XDR has not seen for 30 days.

```
Adapters = paloalto-cortex-xdr AND NOT LastSeen last now-30d/d
```

## Before you begin

### Network

| Source              | Destination                                                           | Port | Protocol                         |
| ------------------- | --------------------------------------------------------------------- | ---- | -------------------------------- |
| OctoXLabs connector | `api-<fqdn>` of your tenant, for example `api-prod1.xdr.paloalto.com` | 443  | HTTPS (HTTP if Is Secure is off) |

### Required permissions

| Scope or role                          | Permission                         | Needed for                                                       |
| -------------------------------------- | ---------------------------------- | ---------------------------------------------------------------- |
| API key access level (Advanced key)    | Read endpoints, risky hosts, users | Devices, risk data, Users                                        |
| Instance Administrator role            | Run XQL queries                    | Only when **Vulnerability Source** is `xql`                      |
| Cortex Cloud Posture Management add-on | Vulnerability findings API         | Only when **Vulnerability Source** is `vulnerability_management` |

## Create credentials in PaloAlto Cortex XDR

{% stepper %}
{% step %}

### Open API keys

In Cortex XDR go to **Settings > Configurations > Integrations > API Keys** and click **+ New Key**.
{% endstep %}

{% step %}

### Choose the key type

Set **API Key Type** to **Advanced**. Optionally enable **Enable Expiration Date** and set it.
{% endstep %}

{% step %}

### Select the access level

Select the access level for the key. For the `xql` vulnerability source use the **Instance Administrator** role.
{% endstep %}

{% step %}

### Generate and copy

Click **Generate**, copy the API key and click **Done**. It cannot be viewed again.
{% endstep %}

{% step %}

### Note the key ID

In the API Keys table, note the number in the **ID** column. This is the API Key ID.
{% endstep %}

{% step %}

### Find the FQDN

Right-click the key and select **View Examples**. The `api-{fqdn}` part of the cURL URL is your Domain.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter             | Required | Type    | Default                   | Description                                                                                                                                                                                                                                     |
| --------------------- | -------- | ------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Domain                | Yes      | String  |                           | Tenant FQDN in the form `api-{fqdn}`, for example `api-prod1.xdr.paloalto.com`.                                                                                                                                                                 |
| API Key ID            | Yes      | String  |                           | ID of the key (`x-xdr-auth-id`).                                                                                                                                                                                                                |
| API Key               | Yes      | String  |                           | The API key. The connector sends a SHA-256 hash of key, nonce and timestamp as `Authorization`.                                                                                                                                                 |
| Is Secure             | No       | Boolean | True                      | Use HTTPS.                                                                                                                                                                                                                                      |
| Fetch Users           | No       | Boolean | True                      | Collect users.                                                                                                                                                                                                                                  |
| Fetch Vulnerabilities | No       | Boolean | False                     | Enrich endpoints with vulnerabilities and installed software.                                                                                                                                                                                   |
| Vulnerability Source  | No       | Choice  | vulnerability\_management | `vulnerability_management` uses the findings API and only lists software affected by a finding. `xql` uses datasets `va_cves`, `va_endpoints` and `host_inventory` and returns the full software list. It runs three XQL queries per discovery. |
| Timeout               | No       | Integer | 30                        | Seconds to wait for API responses.                                                                                                                                                                                                              |
| Verbose Logging       | No       | Boolean | False                     | Per-page logging of the endpoint scroll. Use it temporarily for debugging.                                                                                                                                                                      |

## Troubleshooting

| Error message                    | Cause                          | Fix                                                                                |
| -------------------------------- | ------------------------------ | ---------------------------------------------------------------------------------- |
| Max retries exceeded for         | Cortex XDR kept answering 429. | Wait and run discovery again.                                                      |
| XQL query finished with status : | An XQL query failed.           | Check that the key has the Instance Administrator role and that XQL quota is left. |

## Change history
