Detection: SSM Document Shared Publicly
Overview
Detect when an AWS Systems Manager (SSM) document was shared publicly. Publicly accessible SSM documents can expose sensitive configurations, scripts, or automation tasks to unauthorized users. Ensuring documents are private or shared only with trusted entities helps protect sensitive information and maintain secure access controls.
References:
Usage
Run the detection in your terminal:
powerpipe detection run aws_cloudtrail_log_detections.detection.ssm_document_shared_publicly
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe detection run aws_cloudtrail_log_detections.detection.ssm_document_shared_publicly --share
SQL
This detection uses a named query:
select tp_timestamp as timestamp,string_split(event_source, '.')[1] || ':' || event_name as operation,request_parameters ->> 'name' as resource,user_identity.arn as actor,tp_source_ip as source_ip,tp_index as account_id,aws_region as region,tp_id as source_id,*
from aws_cloudtrail_logwhere event_source = 'ssm.amazonaws.com' and event_name = 'ModifyDocumentPermission' and json_contains( (request_parameters -> 'accountIdsToAdd'), '"all"' ) and error_code is null
order by event_time desc;