Skip to content

AWS Security Agent Executor

Category: AI-Driven Security Testing Script: aws_security_agent.py Integration: Python SDK (boto3) Faraday Plugin: Raw JSON Website: https://securityagent.global.app.aws/

Description

Imports pentest results from AWS Security Agent into Faraday. The executor walks your agent spaces, pentests and pentest jobs, and creates vulnerabilities from the findings, plus informational records for discovered endpoints and jobs.

Prerequisites

  • An AWS account with AWS Security Agent and at least one completed pentest
  • AWS credentials (access key, or an IAM role available to the agent) with permission to list and read AWS Security Agent data
  • A boto3 version that includes the securityagent client, available in the agent's Python environment

Configuration

Environment Variables (Setup)

Variable Required Description
AWS_ACCESS_KEY_ID No Access key ID of an IAM principal with permission to list and read AWS Security Agent data. If not set, the standard AWS credential chain is used (for example an IAM role). Must be set together with AWS_SECRET_ACCESS_KEY.
AWS_SECRET_ACCESS_KEY No Secret access key paired with AWS_ACCESS_KEY_ID

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

Execution Arguments

Parameter Type Mandatory Description
AWS_SESSION_TOKEN password No Session token for temporary (STS) credentials. Only used when AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set.
AWS_REGION string No AWS region to query (default: us-east-1)
AWS_SECURITY_AGENT_AGENT_SPACE string No ID of a single agent space to import (e.g., as-<uuid>). Default: all agent spaces in the account.
AWS_SECURITY_AGENT_PENTEST_ID string No ID of a single pentest to import (e.g., pt-<uuid>). Default: all pentests in each agent space.
AWS_SECURITY_AGENT_JOB_ID string No ID of a single pentest job to import (e.g., pj-<uuid>). Default: all eligible jobs of each pentest.
AWS_SECURITY_AGENT_MODE string No Comma-separated list of what to import: findings (pentest findings as vulnerabilities), endpoints (discovered endpoints as informational records) and jobs (one informational record per pentest job). Default: findings,endpoints.
AWS_SECURITY_AGENT_MAX_SPACES integer No Maximum number of agent spaces to read (default: 20)
AWS_SECURITY_AGENT_MAX_PENTESTS integer No Maximum number of pentests to read per agent space (default: 20)
AWS_SECURITY_AGENT_MAX_JOBS integer No Maximum number of pentest jobs to read per pentest (default: 20)
AWS_SECURITY_AGENT_MAX_PAGES integer No Maximum number of result pages to read for each list call (default: 20)
AWS_SECURITY_AGENT_PAGE_SIZE integer No Number of records requested per API call (default: 100)
AWS_SECURITY_AGENT_MIN_SEVERITY string No Minimum severity of the findings to import: info, low, medium, high or critical (default: info)
AWS_SECURITY_AGENT_ONLY_COMPLETED string No Set to false to also import jobs that are not COMPLETED (for example in progress or failed). Default: true.

YAML Configuration Example

executors:
  aws_security_agent:
    repo_executor: aws_security_agent.py
    max_size: 65536
    varenvs:
      AWS_ACCESS_KEY_ID: "<aws_access_key_id>"
      AWS_SECRET_ACCESS_KEY: "<aws_secret_access_key>"
    params:
      AWS_SESSION_TOKEN:
        mandatory: false
        type: password
        base: string
      AWS_REGION:
        mandatory: false
        type: string
        base: string
      AWS_SECURITY_AGENT_AGENT_SPACE:
        mandatory: false
        type: string
        base: string
      AWS_SECURITY_AGENT_PENTEST_ID:
        mandatory: false
        type: string
        base: string
      AWS_SECURITY_AGENT_JOB_ID:
        mandatory: false
        type: string
        base: string
      AWS_SECURITY_AGENT_MODE:
        mandatory: false
        type: string
        base: string
      AWS_SECURITY_AGENT_MAX_SPACES:
        mandatory: false
        type: integer
        base: integer
      AWS_SECURITY_AGENT_MAX_PENTESTS:
        mandatory: false
        type: integer
        base: integer
      AWS_SECURITY_AGENT_MAX_JOBS:
        mandatory: false
        type: integer
        base: integer
      AWS_SECURITY_AGENT_MAX_PAGES:
        mandatory: false
        type: integer
        base: integer
      AWS_SECURITY_AGENT_PAGE_SIZE:
        mandatory: false
        type: integer
        base: integer
      AWS_SECURITY_AGENT_MIN_SEVERITY:
        mandatory: false
        type: string
        base: string
      AWS_SECURITY_AGENT_ONLY_COMPLETED:
        mandatory: false
        type: string
        base: string

How It Works

  1. Creates a boto3 securityagent client for the region, using the given access keys or the standard AWS credential chain
  2. Walks the account: agent spaces, then the pentests of each space, then the pentest jobs of each pentest (only COMPLETED jobs by default)
  3. For each job, reads its details and, depending on AWS_SECURITY_AGENT_MODE:
    • findings: reads the findings (in batches of 25) and creates one vulnerability per finding. Severity comes from the finding's risk level (UNKNOWN and INFORMATIONAL become info). The description has the risk type, confidence and attack script. Evidence and impact go in the data field, and remediation in the resolution.
    • endpoints: creates one info record per discovered endpoint
    • jobs: creates one info record with the job's title, status and overview
  4. Places everything under the pentest's target host, taken from the first endpoint URI of the job, and removes duplicates

Notes

  • Each pentest target becomes one host. The host IP field holds the target's host name (taken from the endpoint URI) instead of an IP address, so each target gets its own host. If a job has no endpoint, the host is aws-security-agent.
  • AWS_SECURITY_AGENT_MIN_SEVERITY only filters findings. Endpoint and job records are always info.
  • AWS_SECURITY_AGENT_JOB_ID and AWS_SECURITY_AGENT_PENTEST_ID select a job or pentest directly, so the COMPLETED status check does not apply to a job you select by ID.
  • An invalid value in AWS_SECURITY_AGENT_MODE stops the run.
  • The AWS permissions needed are the securityagent list and batch-get operations (for example securityagent:List* and securityagent:BatchGet*). A failing AWS call stops the run.
  • Findings created on earlier runs are identified by their finding ID, so repeated imports update the same vulnerabilities.
  • The shared agent parameters (AGENT_CONFIG_* tags and severity filters) are not applied by this executor. Use AWS_SECURITY_AGENT_MIN_SEVERITY to filter by severity.