本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
Amazon AppStream 2.0 跨服务混淆代理问题防范
混淆代理问题是一个安全问题,即没有执行操作权限的实体可能会迫使更具权限的实体执行该操作。在 AWS 中,跨服务模拟可能会使账户资源容易受到混淆代理问题的影响。一项服务(调用服务)调用另一项服务(被调用服务)时,可能会发生跨服务模拟。调用服务可以操纵被调用服务使用其权限对客户的资源进行操作,而调用服务本身没有执行这些操作的权限。为了防止这种情况,AWS 提供可帮助您保护所有服务的服务主体数据的工具,这些服务主体有权限访问账户中的资源。
我们建议在资源策略中使用 aws:SourceArn
和 aws:SourceAccount
全局条件上下文键,以限制访问这些资源时的权限。以下指南详细介绍了使用这些键保护资源时的建议和要求:
-
如果您只希望将一个资源与跨服务访问相关联,请使用
aws:SourceArn
。 -
如果您想允许指定账户中的任何资源与跨服务使用相关联,请使用
aws:SourceAccount
。 -
如果
aws:SourceArn
键不包含账户 ID,您必须使用两个全局条件上下文键(aws:SourceArn
和aws:SourceAccount
)来限制权限。 -
如果使用两个全局条件上下文键,并且
aws:SourceArn
值包含账户 ID,则在同一策略语句中使用时,aws:SourceAccount
键必须使用相同的账户 ID。
防止混淆代理问题的有效方法是使用要允许的资源的确切 Amazon 资源名称 (ARN)。如果您不知道资源的完整 ARN,请针对 ARN 未知部分使用带有通配符(如 *)的 aws:SourceArn
全局条件上下文键。如果要指定多个资源,也可以在 ARN 中使用通配符。例如,您可以将 ARN 格式化为 arn:aws:
。servicename
::region-name
::your
AWS 账户 ID
:*
示例:AppStream 2.0 服务角色跨服务混淆代理问题防范
AppStream 2.0 使用各种资源 ARN 代入服务角色,这会导致复杂的条件语句。我们建议使用通配符资源类型来防止 AppStream 2.0 资源出现任何意外故障。
例 aws:SourceAccount
条件:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "aws:SourceAccount": "
your AWS 账户 ID
" } } } ] }
例 aws:SourceArn
条件:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "sts:AssumeRole", "Condition": { "ArnLike": { "aws:SourceArn": "arn:{aws partition}:appstream:{
your region name
}:{your AWS 账户 ID
}:*" } } } ] }
示例:AppStream 2.0 实例集机器角色跨服务混淆代理问题预防
例 aws:SourceAccount
条件:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "aws:SourceAccount": "
your AWS 账户 ID
" } } } ] }
例 aws:SourceArn
条件:
注意
如果要将一个 IAM 角色用于多个实例集,我们建议使用带通配符 (*) 的 aws:SourceArn
全局条件上下文键来匹配多个 AppStream 2.0 实例集资源。
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "sts:AssumeRole", "Condition": { "ArnLike": { "aws:SourceArn": "arn:{aws partition}:appstream:{
your region name
}:{your AWS 账户 ID
}:fleet/{your fleet name
}" } } } ] }
示例:AppStream 2.0 弹性实例集会话脚本 Amazon S3 存储桶策略跨服务混淆代理问题防范
例 aws:SourceAccount
条件:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "s3:GetObject", "Resource": "
your session script S3 path
", "Condition": { "StringEquals": { "aws:SourceAccount": "your AWS 账户 ID
" } } } ] }
例 aws:SourceArn
条件:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "appstream.amazonaws.com" ] }, "Action": "s3:GetObject", "Resource": "
your session script S3 path
", "Condition": { "ArnLike": { "aws:SourceArn": "arn:{aws partition}:appstream:{your region name
}:{your AWS 账户 ID
}:fleet/{your fleet name
}" } } } ] }
示例:AppStream 2.0 应用程序 Amazon S3 存储桶策略跨服务混淆代理问题防范
当您将数据存储在 Amazon S3 存储桶时,该存储桶可能会出现混淆代理问题。这可能会使弹性实例集、应用程序块、设置脚本、应用程序图标和会话脚本等数据容易受到恶意行为者的攻击。
为防止出现混淆代理问题,您可以在 Amazon S3 存储桶策略中为 ELASTIC-FLEET-EXAMPLE-BUCKET
指定 aws:SourceAccount
条件或 aws:SourceArn
条件。
下面的资源策略说明了如何通过以下任一方法防止出现混淆代理问题:
-
具有您的 AWS 账户 ID 的
aws:SourceAccount
-
全局条件上下文键
aws:SourceArn
AppStream 2.0 目前不支持防范应用程序图标出现混淆代理问题。该服务仅支持 VHD 文件和设置脚本。如果您尝试为应用程序图标添加其他条件,则这些图标将不会显示给最终用户。
在以下示例中,存储桶策略仅允许所有者账户中的 AppStream 2.0 弹性实例集资源访问 ELASTIC_FLEET_EXAMPLE_BUCKET
。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "ConfusedDeputyPreventionExamplePolicy", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": [ "arn:aws:s3:::
ELASTIC-FLEET-EXAMPLE-BUCKET
/vhd-folder/*", "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET
/scripts/*" ], "Condition": { "StringEquals": { "aws:SourceAccount": "your AWS 账户 ID
" } } }, { "Sid": "AllowRetrievalPermissionsToS3AppIconsForAppStream", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET
/app-icons/*" } ] }
您也可以使用 aws:SourceArn
条件来限制特定资源的资源访问权限。
注意
如果您不知道资源的完整 ARN,或者您要指定多个资源,请针对 ARN 未知部分使用带有通配符 (*) 的 aws:SourceArn
全局条件上下文键。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "ConfusedDeputyPreventionExamplePolicy", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": [ "arn:aws:s3:::
ELASTIC-FLEET-EXAMPLE-BUCKET
/vhd-folder/*", "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET
/scripts/*" ], "Condition": { "ArnLike": { "aws:SourceArn": "arn:{aws-partition}:appstream:{your region name
}:{your AWS account ID
}:app-block/*" } } }, { "Sid": "AllowRetrievalPermissionsToS3AppIconsForAppStream", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET
/app-icons/*" } ] }
您可以使用 aws:SourceArn
和 aws:SourceAccount
条件来限制特定资源和账户的资源访问权限。
注意
如果您不知道资源的完整 ARN,或者您要指定多个资源,请针对 ARN 未知部分使用带有通配符 (*) 的 aws:SourceArn
全局条件上下文键。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "ConfusedDeputyPreventionExamplePolicy", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": [ "arn:aws:s3:::
ELASTIC-FLEET-EXAMPLE-BUCKET
/vhd-folder/*", "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET
/scripts/*" ], "Condition": { "ArnLike": { "aws:SourceArn": "arn:{aws partition}:appstream:{your region name
}:{your AWS account ID
}:app-block/*" }, "StringEquals": { "aws:SourceAccount": "your AWS account ID
" } } }, { "Sid": "AllowRetrievalPermissionsToS3AppIconsForAppStream", "Effect": "Allow", "Principal": { "Service": "appstream.amazonaws.com" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::ELASTIC-FLEET-EXAMPLE-BUCKET
/app-icons/*" } ] }