💻
My Personal Hacking Path
  • 👓Wellcome
    • My Personal Hacking Path
      • Whoami
  • 📚Mi Metodología de Pentesting
    • Tipos de evaluaciones
      • El día a día en pentesting
    • Metodología Propia
      • OWASP
      • OSSTMM
      • PTES
      • CEH Hacking Metodology (CHM)
      • Cyber Kill Chain
      • MITRE Att&ck
    • Fase 0 - Pre Evalaución
    • Fase 1 - Reconocimiento
      • Web / Host
      • SubDominios
      • Descubrimiento de correos electrónicos
      • Escaneo de Puertos
      • Credenciales y brechas de seguridad
      • ¿Sin Ideas?
    • Fase 2 - Explotación
      • Shells
        • Diferencia entre una WebShell y Reverse Shell
      • Payload
      • Network Penetration Services
        • 20|21 - FTP
        • 22 - SSH
        • 139|445- SMB
        • 80|443 - HTTP/HTTPS
    • Fase 3 - Post Explotación
      • Enumeración
      • Linux
        • Enumeración
        • Privilege Escalation
      • Windows
        • Revershell
        • Windows Enum
        • Privilege Escalation
    • Fase 4 - Reporting
      • CVSS
        • v4.0
      • Toma de notas
  • 👾Malware
    • Malware DevOps
    • Arquitectura de Windows
      • Windows API
      • Procesos de Windows
      • Estructuras no documentadas
    • PE
      • DLL
    • Almacenamiento del Payload
      • .data & .rdata
      • .text
      • .rsrc
    • Cifrado de Payload
      • XOR
      • RC4
      • AES
    • Ofuscación de Payload
      • IPv4/IPv6Fuscation
      • MACFucscation
      • UUIDFuscation
    • Process Injectión
      • DLL Injection
      • Shellcode Injection
      • APC Injection
  • 🌐Web-Pentesting
    • Metodología para Pentesting Web
    • Footprinting
      • Identificación Tecnologías web
        • WordPress
        • Joomla
        • Drupal
        • Magento
      • Fuzzing
      • Validación de los certificados
    • Vulnerabilidades comunes
      • File Upload
      • SQL Injection
      • Cross-site scripting
      • XXE Injection
      • LFI - Local File Inclusion
        • Log Poisoning
      • RFI - Remote File Inclusión
      • CSRF - Cross-Site Request Forgery
      • SSRF - Server-Side Request Forgery
      • SSTI - Server-Side Template Injection
      • CSTI - Client-Side Template Injection
      • Padding Oracle Attack
      • NoSQL Injection
      • LDAP Injection
    • Laboratorios
  • ☁️AWS Pentesting
    • Introducción a Amazon Web Services AWS
    • Acceso Inicial
    • IAM
      • Políticas de IAM
      • Enumeraciones
      • Privesc-Paths
        • Permisos de IAM
        • Permisos sobre políticas
        • AssumeRolePolicy Update
        • IAM:PassRole*
          • PassExistingRoleToCloudFormation
    • S3
      • Enumeración
      • S3_public
      • OSINT
    • Lambda
      • Enum Lambda
      • Enum API Gateway
      • Privesc-Paths
        • RCE sobre Lambda
        • PassExistingRoleToNewLambdaThenInvoke
        • PassRoleToNewLambdaThenTrigger
        • EditExistingLambdaFunctionWithRole
    • EC2
      • Enumeración
      • Privesc-Paths
        • EC2_SSRF
        • CreateEC2WhithExistingIP
        • PassExistingRoleToNewGlueDevEndpoint
        • ECS_takeover
    • VPC
      • Enumeración
      • PivotingInTheCloud
    • Bases de Datos
      • RDS
        • Enumeración
      • DynamoDB
        • Enumeración
    • ECS
      • Enum ECR
      • Enum ECS
      • Enum EKS
    • AWS Secrets Manager
      • Enumeración
    • Análisis de vulnerabilidades Automatizado
    • Blue Team AWS
      • CloudTrail
      • CloudWatch
      • GuardDuty
      • AWS Inspector
      • AWS Shield
      • Web Application Firewall
    • Notas
      • Terraform
  • 🔫Red_Team
    • Introducción a Red Team
      • Assume breach
    • ¿Qué es MITRE ATT&CK?
      • Guia de uso de Invoke-AtomicRedTeam
    • C2 Comando y control
      • Sliver C2
        • Instalación
        • Beacons y Sesiones
        • Perfiles
        • mTLS y WiewGuard
        • HTTP / HTTPS
        • DNS
        • Stagers: Basics
        • Stagers: Proccess Injection
        • Basics de Implates
        • Ejecución de Assembly
        • Sideload
        • SpawnDLL
        • Sliver Extensions
  • 💾Active Directory
    • Teoria
      • Componentes Físicos
      • Componentes Lógicos
      • GPO VS ACL
      • Kerberos
        • Funcionamiento de Kerberos
      • Usuarios por defecto
    • Enumeraciones
      • ¿Por qué enumerar?
      • Enumeración manual
      • Enumeración con PowerView
    • Ataques en AD
      • Mimikats
        • Comandos
      • Password Spraying
      • LLMNR Poisoning
      • Relay Attacks
        • NTLM
      • Kerberoasting
    • Tools
      • AuxRecon
      • Powershell
      • PowerView.ps1
      • ADPeas
      • Mimikatz
        • Comandos
    • AD Lab
  • 🌩️Azure Coud Pentesting
    • Introducción a Azure y Office 365
    • Introducción a Microsoft Indentity Services
    • Enumeración
    • Azure Files
      • Encontrar Fuga de Datos
    • Microsoft Graph
    • Notas
  • 📱Mobile Pentesting
    • Análisis de Aplicaciones Móviles en MobSF
    • ¿Cómo interceptar tráfico de una aplicación Flutter Android con Burp?
  • 📶Wireless
    • Terminología
    • Tipos de Wireless Networks
    • Formas de Autenticación
    • Cifrados
      • WEP
      • WPA
      • WPA2
      • WPA3
    • Ataques
  • 😎Extras
    • Docker
      • Port Forward y volúmenes
      • Docker Compose
      • Container Breakouts
    • Comandos Utiles
    • Fliper Zero
    • Páginas útiles
  • Kali Set Up
Con tecnología de GitBook
En esta página
  • Comandos útiles
  • Más comandos
  • Referencias
  1. AWS Pentesting
  2. S3

Enumeración

AnteriorS3SiguienteS3_public

Última actualización hace 1 año

Durante el inicio de unas pruebas post-autenticadas, es ideal ejecutar los siguientes comandos para recopilar información sobre la infraestructura relacionada al servicio de S3.

Comandos útiles

Listar todos los Buckets de la cuenta

aws s3 ls

Listado de objetos de un Bucket específico

aws s3 ls s3://bucket-name

Enumera Todos los objetos de un Bucket incluyendo contenido de las carpetas existentes.

aws s3 ls s3://mybucket --recursive

Descarga archivos

aws s3 cp s3://mybucket/test.txt test2.

Subida de archivos

aws s3 cp ./test.txt s3://mybucket/test2.txt

Copiar archvios de S3 a S3

aws s3 cp s3://mybucket/test.txt s3://otherbucket/test2.txt

Más comandos

# Get buckets ACLs
aws s3api get-bucket-acl --bucket <bucket-name>
aws s3api get-object-acl --bucket <bucket-name> --key flag

# Get policy
aws s3api get-bucket-policy --bucket <bucket-name>
aws s3api get-bucket-policy-status --bucket <bucket-name> #if it's public

# list S3 buckets associated with a profile
aws s3 ls
aws s3api list-buckets

# list content of bucket (no creds)
aws s3 ls s3://bucket-name --no-sign-request
aws s3 ls s3://bucket-name --recursive

# list content of bucket (with creds)
aws s3 ls s3://bucket-name
aws s3api list-objects-v2 --bucket <bucket-name>
aws s3api list-objects --bucket <bucket-name>
aws s3api list-object-versions --bucket <bucket-name>

# copy local folder to S3
aws s3 cp MyFolder s3://bucket-name --recursive

# delete
aws s3 rb s3://bucket-name –-force

# download a whole S3 bucket
aws s3 sync s3://<bucket>/ .

# move S3 bucket to different location
aws s3 sync s3://oldbucket s3://newbucket --source-region us-west-1

# list the sizes of an S3 bucket and its contents
aws s3api list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[].Size), length(Contents[])]"

# Update Bucket policy
aws s3api put-bucket-policy --policy file:///root/policy.json --bucket <bucket-name>
##JSON policy example
{
  "Id": "Policy1568185116930",
  "Version": "2012-10-17",
  "Statement": [
  {
      "Sid": "Stmt1568184932403",
      "Action": [
        "s3:ListBucket"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::welcome",
      "Principal": "*"
  },
  {
    "Sid": "Stmt1568185007451",
    "Action": [
      "s3:GetObject"
    ],
    "Effect": "Allow",
    "Resource": "arn:aws:s3:::welcome/*",
    "Principal": "*"
  }
  ]
}

# Update bucket ACL
aws s3api get-bucket-acl --bucket <bucket-name> # Way 1 to get the ACL
aws s3api put-bucket-acl --bucket <bucket-name> --access-control-policy file://acl.json

aws s3api get-object-acl --bucket <bucekt-name> --key flag #Way 2 to get the ACL
aws s3api put-object-acl --bucket <bucket-name> --key flag --access-control-policy file://objacl.json

##JSON ACL example
## Make sure to modify the Owner’s displayName and ID according to the Object ACL you retrieved.
{
  "Owner": {
    "DisplayName": "<DisplayName>",
    "ID": "<ID>"
  },
  "Grants": [
  {
    "Grantee": {
      "Type": "Group",
      "URI": "http://acs.amazonaws.com/groups/global/AuthenticatedUsers"
    },
  "Permission": "FULL_CONTROL"
  }
  ]
}
## An ACL should give you the permission WRITE_ACP to be able to put a new ACL

Referencias

☁️
ls — AWS CLI 1.27.110 Command Reference
Logo
Uso de comandos alto nivel (s3) con la AWS CLI - AWS Command Line InterfaceAWS Command Line Interface
cp — AWS CLI 2.11.11 Command Reference
Logo