Skip to content

PingCastle Executor

Category: Identity and Access Script: pingcastle.py Integration: CLI Faraday Plugin: Raw JSON Website: https://www.pingcastle.com/

Description

Runs a PingCastle Active Directory health check against a domain controller and imports the triggered risk rules into Faraday. The domain controller becomes a Faraday host, and each triggered rule becomes a vulnerability.

Prerequisites

  • PingCastle installed on the agent machine and available as pingcastle in the agent's PATH (checked with pingcastle --help). To use a different binary, set the PINGCASTLE_BIN environment variable on the agent.
  • Network access from the agent to the domain controller
  • Credentials that PingCastle can use. By default it uses the Windows identity of the agent, or you can set PINGCASTLE_USER and PINGCASTLE_PASSWORD.

Configuration

Environment Variables (Setup)

Variable Required Description
PINGCASTLE_USER No User name passed to PingCastle. It is used only when PINGCASTLE_PASSWORD is also set. If empty, PingCastle uses the agent's Windows identity.
PINGCASTLE_PASSWORD No Password for PINGCASTLE_USER
PINGCASTLE_BIN No Path or name of the PingCastle binary (default: pingcastle)

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

Execution Arguments

Parameter Type Mandatory Description
PINGCASTLE_SERVER string Yes Domain controller to check, as FQDN or IP (e.g., dc1.example.local)
PINGCASTLE_HEALTHCHECK_LEVEL string No Depth of the health check: Light, Normal or Full. If empty, PingCastle uses its own default (Normal).

YAML Configuration Example

executors:
  pingcastle:
    repo_executor: pingcastle.py
    max_size: 65536
    varenvs:
      PINGCASTLE_USER: "<pingcastle_user>"
      PINGCASTLE_PASSWORD: "<pingcastle_password>"
    params:
      PINGCASTLE_SERVER:
        mandatory: true
        type: string
        base: string
      PINGCASTLE_HEALTHCHECK_LEVEL:
        mandatory: false
        type: string
        base: string

How It Works

  1. Runs pingcastle --healthcheck --no-enum-limit --server <PINGCASTLE_SERVER> in a temporary directory, adding --healthcheck-level and --user/--password when they are set
  2. Reads the ad_hc_<domain>.xml report that PingCastle writes
  3. Creates one Faraday vulnerability for each triggered risk rule:
    • Name: PingCastle <rule ID>
    • Severity: from the rule's maturity level (1 critical, 2 high, 3 medium, 4 low, 5 info). If the maturity is missing, the rule's points or its category are used.
    • Details: rationale, category, points and up to 25 affected objects
    • References: a link to the rule on pingcastle.com
  4. Groups the vulnerabilities under one host for the domain controller
  5. Deletes the temporary directory

Notes

  • The host uses PINGCASTLE_SERVER as its IP value and as a hostname, together with the domain name from the report, and its operating system is set to Windows. Use an IP address for PINGCASTLE_SERVER if you want a valid IP on the Faraday host.
  • If PingCastle produces no report, the run imports nothing. A PINGCASTLE_HEALTHCHECK_LEVEL other than Light, Normal or Full stops the run.
  • The shared agent parameters (AGENT_CONFIG_* tags and severity filters) are not applied by this executor.