
유효 S3 객체 권한의 화이트박스 평가를 통해 공개적으로 액세스 가능한 파일을 식별합니다.
공개적으로 액세스 가능한 객체를 식별하기 위해, 유효 S3 객체 권한에 대한 화이트박스 평가.
공개적으로 액세스 가능한 객체뿐만 아니라 (보조 프로파일을 사용하여) AuthenticatedUsers 그룹에 액세스 가능한 객체도 식별할 수 있습니다.
버킷에 대한 권한을 확인하는 도구는 많이 있지만, IAM 리소스 정책과 ACL 조합의 복잡성 때문에 특정 객체에 대한 유효 권한을 평가하기 어려운 경우가 많습니다.
이 도구는 asyncio와 aiobotocore를 사용하므로 빠르게 실행됩니다.
이 도구는 두 개의 명명된 프로파일을 활용합니다:
WHITEBOX_PROFILE - 이 프로파일은 S3 서비스에 대한 읽기 액세스 권한이 있어야 합니다. 이 프로파일은 버킷과 객체를 나열하는 데 사용되며, 도구는 이후 비인증 요청을 통해 해당 객체에 액세스를 시도합니다. 객체에 액세스하는 데 사용되지 않고, 단지 나열하는 데만 사용됩니다.BLACKBOX_PROFILE - 비인증 요청에 더해, 도구는 이 프로파일을 사용하여 "Authenticated Users 그룹"(AuthenticatedUsers)에 액세스 가능한 객체를 식별합니다. 이 프로파일은 S3 버킷/객체에 대한 액세스 권한이 없어야 합니다. 그렇지 않으면 오탐(false positive)이 발생합니다.가상 환경을 설정하고 종속성을 설치합니다:
$ virtualenv -p python3 venv
$ source venv/bin/activate
$ pip -r requirements.txt
옵션:
$ python s3-objects-check.py -h
usage: s3-objects-check.py [-h] -p WHITEBOX_PROFILE -e BLACKBOX_PROFILE [-d]
Whitebox evaluation of effective S3 object permissions, to identify publicly
accessible files.
optional arguments:
-h, --help show this help message and exit
-p WHITEBOX_PROFILE, --profile WHITEBOX_PROFILE
The profile with access to the desired AWS account and
buckets
-e BLACKBOX_PROFILE, --profile-external BLACKBOX_PROFILE
An "external" profile to test for 'AuthenticatedUsers'
permissions. This principal should not have
permissions to read bucket objects.
-d, --debug Verbose output. Will also create a log file
도구 실행:
$ python s3-objects-check.py -p whitebox-profile -e blackbox-profile
2020-11-24 11:19:56 host object-check[371] INFO Starting
2020-11-24 11:20:08 host object-check[371] WARNING Found https://<bucket>.s3.us-east-1.amazonaws.com/<object> allowing "AllUsers"
2020-11-24 11:20:09 host object-check[371] WARNING Found https://<bucket>.s3.eu-west-2.amazonaws.com/<object> allowing "AuthenticatedUsers"
2020-11-24 11:21:34 host object-check[371] INFO Done