Amazon Inspector v2 Executor¶
Category: Cloud Security
Script: amazon_inspector.py
Integration: Python SDK (boto3)
Faraday Plugin: Raw JSON
Website: https://aws.amazon.com/inspector/
Description¶
Imports security findings from Amazon Inspector v2 into Faraday. The executor reads the findings for EC2 instances, ECR container images and Lambda functions in one AWS region and creates one host per affected resource, with one vulnerability per finding.
Prerequisites¶
- An AWS account with Amazon Inspector v2 enabled in the region you want to import
- An IAM principal (access key) with the
inspector2:ListFindingspermission. Use a session token if you use temporary credentials. boto3available in the agent's Python environment- Network access to the regional Inspector endpoint
Configuration¶
Environment Variables (Setup)¶
| Variable | Required | Description |
|---|---|---|
AWS_ACCESS_KEY_ID |
Yes | Access key ID of the AWS IAM principal |
AWS_SECRET_ACCESS_KEY |
Yes | Secret access key of the AWS IAM principal |
AWS_SESSION_TOKEN |
No | Session token, only for temporary (STS) credentials |
These variables are also accepted as execution arguments, so a single run can override them.
Execution Arguments¶
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
AWS_REGION |
string | Yes | AWS region to query (e.g., us-east-1, eu-west-1). Inspector v2 is regional. If you do not set it here, the AWS_REGION or AWS_DEFAULT_REGION environment variable of the agent is used. |
INSPECTOR_RESOURCE_TYPE |
string | No | Import only one resource type: AWS_EC2_INSTANCE, AWS_ECR_CONTAINER_IMAGE or AWS_LAMBDA_FUNCTION. The short aliases ec2, ecr and lambda also work. Default: all types. |
INSPECTOR_SEVERITIES |
string | No | Comma-separated severities to import: INFORMATIONAL, LOW, MEDIUM, HIGH, CRITICAL. The lowercase names info, low, medium, high and critical also work. Default: all severities. |
YAML Configuration Example¶
executors:
amazon_inspector:
repo_executor: amazon_inspector.py
max_size: 65536
varenvs:
AWS_ACCESS_KEY_ID: "<aws_access_key_id>"
AWS_SECRET_ACCESS_KEY: "<aws_secret_access_key>"
AWS_SESSION_TOKEN: "<aws_session_token>"
params:
AWS_REGION:
mandatory: true
type: string
base: string
INSPECTOR_RESOURCE_TYPE:
mandatory: false
type: string
base: string
INSPECTOR_SEVERITIES:
mandatory: false
type: string
base: string
How It Works¶
- Creates a boto3
inspector2client for the configured region with the given AWS credentials - Calls
ListFindings(100 findings per page, up to 200 pages), filtered by resource type and severity when set - Groups the findings by affected AWS resource and creates one host per resource
- Maps each finding to a Faraday vulnerability:
- Name:
[CNAPP], the CVE or finding title and the affected resource - Severity: Inspector's severity mapped to Faraday's scale, or the CVSS score when Inspector gives no usable severity
- Status:
ACTIVEbecomes open,CLOSEDbecomes closed,SUPPRESSEDbecomes risk-accepted - Resolution: Inspector's remediation recommendation, or an "Upgrade package to version" hint built from the fixed package versions
- References: CVEs, CWEs, advisory URLs and the remediation URL
- Name:
Notes¶
- Each AWS resource (EC2 instance, ECR image or Lambda function) becomes one host. EC2 instances use their first IPv4 address. All other resources use the synthetic IP
0.0.0.0, and the resource is identified by its hostname (<resource label>@<resource id>). - Resources without findings are not imported.
- The IAM principal needs the
inspector2:ListFindingspermission. - Unrecognized values in
INSPECTOR_RESOURCE_TYPEorINSPECTOR_SEVERITIESare ignored (no filter for that value) and written to the agent log. - The shared agent parameters (
AGENT_CONFIG_*tags and severity filters) are not applied by this executor. UseINSPECTOR_SEVERITIESto filter by severity.