Skip to content

Palo Alto Cortex Xpanse Executor

Category: Attack Surface Management Script: cortex_xpanse.py Integration: REST API Faraday Plugin: Raw JSON Website: https://www.paloaltonetworks.com/cortex/xpanse

Description

Imports the externally exposed assets, services and issues discovered by Palo Alto Cortex Xpanse into Faraday. Each Xpanse asset becomes a host, with its exposed services and its issues as vulnerabilities.

Prerequisites

  • A Cortex Xpanse tenant
  • A Standard API key (API key and API key ID) created in the Xpanse console under Settings > Configurations > API Keys
  • Python requests module available to the agent

Configuration

Environment Variables (Setup)

Variable Required Description
XPANSE_HOST Yes Tenant API host shown in the API key dialog (e.g., api-mytenant.xpanse.paloaltonetworks.com). https:// is added if missing.
XPANSE_API_KEY_ID Yes API key ID
XPANSE_API_KEY Yes API key

These variables are also accepted as execution arguments, so a single run can override them.

Execution Arguments

Parameter Type Mandatory Description
XPANSE_BUSINESS_UNIT string No Only import data of this business unit. Leave blank to import all business units the key can access.
XPANSE_MIN_SEVERITY string No Minimum severity to import: info, low, medium, high or critical. Leave blank to import everything. Unrecognized values are ignored.
XPANSE_PAGES string No Maximum number of pages (100 records each) to read from each list (default: 5, maximum: 50)

YAML Configuration Example

executors:
  cortex_xpanse:
    repo_executor: cortex_xpanse.py
    max_size: 65536
    varenvs:
      XPANSE_HOST: "api-mytenant.xpanse.paloaltonetworks.com"
      XPANSE_API_KEY_ID: "<api_key_id>"
      XPANSE_API_KEY: "<api_key>"
    params:
      XPANSE_BUSINESS_UNIT:
        mandatory: false
        type: string
        base: string
      XPANSE_MIN_SEVERITY:
        mandatory: false
        type: string
        base: string
      XPANSE_PAGES:
        mandatory: false
        type: string
        base: string

How It Works

  1. Sends the API key and key ID (Authorization and x-xdr-auth-id headers) with every request
  2. Reads assets from GET /api/v1/assets, services from GET /api/v1/services and issues from GET /api/v1/issues, using offset pagination and the business unit and severity filters
  3. Creates one host per asset, using its first public IP and its hostnames, and attaches the services and issues that belong to that asset
  4. Reports each exposed service as a vulnerability and as a Faraday service, and each issue as an [EASM] vulnerability with its CVEs
  5. Maps severity and status from Xpanse. new and in_progress issues are open, resolved and closed are closed, and risk_accepted, false_positive and wont_fix are risk-accepted.

Notes

  • Assets without an IP (for example domains) use IP 0.0.0.0. Services and issues that do not match any returned asset are grouped on a host named (unattached).
  • Assets are imported as hosts even when they have no services or issues.
  • A 401 response stops the run. Rate limiting (429) and other errors stop reading that list and the records already read are imported.
  • The shared agent parameters (AGENT_CONFIG_* tags and severity filters) are not applied by this executor. Use XPANSE_MIN_SEVERITY to filter by severity.