亚马逊 AppStream 2.0 跨服务混乱的副手预防 - 亚马逊 AppStream 2.0

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

亚马逊 AppStream 2.0 跨服务混乱的副手预防

混淆代理问题是一个安全性问题,即没有执行权限的实体可能会迫使具有更高权限的实体执行该操作。在中AWS,跨服务模拟可能会导致导致导致使混淆代理问题。一个服务(呼叫服务) 调用另一项服务(所谓的服务) 时,即服务模拟可能会导致发生服务的模拟。调用服务可以操纵调用服务来使用调用服务权限对客户的资源进行操作。为防止这种情况,AWS提供可帮助您保护所有服务数据的工具。

我们建议在资源策略中使用aws:SourceArnaws:SourceAccount全局条件上下文密钥来限制访问这些资源时的权限。以下指南详细说明了使用这些密钥保护资源时的建议和要求:

  • aws:SourceArn如果您只希望将一个资源与跨服务访问相关联,请使用。

  • aws:SourceAccount如果您希望允许指定服务使用相关联,请使用。

  • 如果aws:SourceArn密钥不包含账户 ID,您必须使用两个全局条件上下文键。aws:SourceArnaws: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 Elastic 舰队会话脚本 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 存储桶策略跨服务混乱的副手预防

当您在中,该存储桶可能会导致面临混淆代理问题。这可能使诸如 Elastic 队列、应用程序块、安装脚本、应用程序图标和会话脚本之类的数据容易受到恶意攻击者的攻击。

为防止出现混淆的代理问题,您可以在 Amazon S3 存储桶策略中为指定aws:SourceAccountaws:SourceArn条件或条件ELASTIC-FLEET-EXAMPLE-BUCKET

以下资源政策显示了如何通过以下任一方法来防止副手问题变得混乱:

  • 然后aws:SourceAccount用你的AWS账户 ID

  • 全局条件上下文键aws:SourceArn

AppStream 2.0 目前不支持对应用程序图标进行混淆副手防护。该服务仅支持 VHD 文件和安装脚本。如果您尝试为应用程序图标添加其他条件,则图标将不会显示给最终用户。

在以下示例中,存储桶策略仅允许所有者账户 AppStream 中的 2.0 Elastic 队列资源进行访问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:SourceArnaws: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/*" } ] }