AWS - EMR Privesc
Last updated
Last updated
Leer & oefen AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Leer & oefen GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Meer inligting oor EMR in:
AWS - EMR Enumiam:PassRole
, elasticmapreduce:RunJobFlow
'n Aanvaller met hierdie toestemmings kan 'n nuwe EMR-kluster laat loop wat EC2-rolle aanheg en probeer om sy kredensiale te steel.
Let daarop dat jy om dit te doen, 'n ssh priv sleutel wat in die rekening ingevoer is, moet ken of een moet invoer, en in staat moet wees om poort 22 in die meesterknoop te open (jy mag in staat wees om dit te doen met die eienskappe EmrManagedMasterSecurityGroup
en/of ServiceAccessSecurityGroup
binne --ec2-attributes
).
Note how an EMR rol is specified in --service-role
and a ec2 rol is specified in --ec2-attributes
inside InstanceProfile
. However, this technique only allows to steal the EC2 rol credentials (as you will connect via ssh) but no the EMR IAM Rol.
Potential Impact: Privesc to the EC2 service rol specified.
elasticmapreduce:CreateEditor
, iam:ListRoles
, elasticmapreduce:ListClusters
, iam:PassRole
, elasticmapreduce:DescribeEditor
, elasticmapreduce:OpenEditorInConsole
With these permissions an attacker can go to the AWS console, create a Notebook and access it to steal the IAM Rol.
Even if you attach an IAM rol to the notebook instance in my tests I noticed that I was able to steal AWS managed credentials and not creds related to the IAM rol related.
Potential Impact: Privesc to AWS managed rol arn:aws:iam::420254708011:instance-profile/prod-EditorInstanceProfile
elasticmapreduce:OpenEditorInConsole
Just with this permission an attacker will be able to access the Jupyter Notebook and steal the IAM rol associated to it.
The URL of the notebook is https://<notebook-id>.emrnotebooks-prod.eu-west-1.amazonaws.com/<notebook-id>/lab/
Even if you attach an IAM rol to the notebook instance in my tests I noticed that I was able to steal AWS managed credentials and not creds related to the IAM rol related`.
Potential Impact: Privesc to AWS managed rol arn:aws:iam::420254708011:instance-profile/prod-EditorInstanceProfile
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)