RCE VIA S3-BUCKET
AWS access keys were exposed in a public GitHub repository, allowing the author to authenticate to an S3 bucket and list, upload, and delete files. The author claims this could allow uploading a PHP file to gain access to the machine, though the program later stated the bucket was not in scope.
medium.com
Published on medium.com
الْحَ� ْدُ لِلَّهِ الَّذِي عَلِ� َ بِالْقَلَ� ِ، عَلَّ� َ الإِنْسَانَ � َا لَ� ْ يَعْلَ� ْ، وَالصَّلَاةُ وَالسَّلَا� ُ عَلَى خَيْرٍ � ُعَلِّ� ِ النَّاسِ الْخَيْرَ، � ُحَ� َّدٍ أَ� َّا بَعْدُ،
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, AWS access keys were committed to a public GitHub repository, and the associated IAM credentials had write permissions on the S3 bucket.
Impact
An attacker with the exposed keys could list, upload, and delete files in the bucket, and the author claims this could lead to remote code execution by uploading a PHP file, though the program later said the bucket was not in scope.
What the attacker needed
Public GitHub repository with AWS keys; Valid AWS credentials with S3 permissions; AWS CLI installed
How it was found
- Search GitHub for the target domain together with the string aws_access_key_id.
- Inspect repositories and find a code snippet containing an access key ID and secret access key.
- Configure the AWS CLI with the found credentials and a region.
- List S3 buckets to confirm the credentials are valid.
- List the contents of the identified bucket.
- Upload a test file to the bucket and then delete it.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Cloud storage buckets like Amazon S3 can be protected by access keys, which are like passwords for programs. If those keys are accidentally published in a public code repository, anyone can use them to read or change the bucket's contents. Here, the keys were found on GitHub and gave the author control over a bucket.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.