Storage and Data Exposure
Chapters and transcript
Storage and Data Exposure Companies keep huge amounts of data in cloud storage: invoices, ID card scans, database exports and backups. Watch. A stranger asks for an invoice file. The bucket is public, so the file simply downloads. No password needed. In this lesson, you will learn how this happens, and how to prevent it.
How storage works Most cloud storage is object storage. You create a container and upload files into it. The files are called objects. For example, a bucket can hold invoice files, and every object can be reached through a web address.
How storage works Each provider uses its own names. On AWS, it is Amazon S3, and containers are called buckets. On Azure, it is Blob Storage. Files are blobs, inside containers, in a storage account. And Google Cloud Storage also uses buckets.
How storage works Whether that web address works for a stranger depends entirely on the access settings. Here, a stranger opens the address of an invoice file. This bucket is private, so the stranger gets an access denied error. If the bucket were public, the file would download.
Public buckets A public bucket, or public blob container, allows anonymous access. Nobody needs to log in. Public storage has real uses, such as images for a public website. The problem is when private data ends up in public storage.
Public buckets How does it happen? A developer makes a bucket public for a quick test, and forgets. Public website files and private exports are kept in the same bucket. Access is given to all users or all authenticated users by mistake. On some providers, that can mean anyone with any account on that provider. Or someone copies a setup from an online example without understanding it.
Public buckets Automated tools guess bucket names and test them. Names like chaicorp backup are easy to guess, and this one is public, so the files leak. The tool also tries chaicorp dev, but that bucket is private, so it is denied. A random name helps a little, but it is not a security control. Access settings are.
Safety switches The major providers now include strong safety switches. AWS has S3 Block Public Access, which can be turned on for a whole account. Azure storage accounts have a setting to disallow anonymous blob access. Google Cloud has public access prevention for buckets. Many new buckets block public access by default, but anyone with enough permission can turn it off. So check.
Safety switches Here is how to check one bucket with the AWS command line. We ask for the public access block of the ChaiCorp invoices bucket. All four settings say true, so public access is blocked. If any of them said false, that would be worth a closer look.
Sharing safely What if you need to share one file with one person for a short time? Do not make anything public. Use a time-limited link. It gives access to one file, and stops working after a set time. AWS calls these presigned URLs. Azure uses shared access signatures. Google Cloud uses signed URLs.
Encryption Encryption protects data in two situations. Encryption at rest protects data stored on disks. A stolen disk shows only scrambled data. Providers now do this by default, and you can manage your own keys with services such as AWS KMS or Azure Key Vault. Encryption in transit protects data moving across a network, such as between a browser and your app. This is normally TLS, the technology behind HTTPS.
Encryption Here is an important limit. This bucket is encrypted at rest. But it is also public. A stranger asks for a file. The access settings say that is allowed, so the provider decrypts the file and hands it over. Encryption at rest protects against stolen hardware, not against bad permissions. That is why access control matters most.
Backups and versioning Data can be lost, not just leaked. A script overwrites files, ransomware encrypts them, or an attacker deletes them. Versioning keeps older versions, so you can restore them. Soft delete keeps deleted data for a set number of days. Locked backups cannot be changed or deleted for a set period. AWS calls this S3 Object Lock. And separate backups live in a different account.
Backups and versioning Why a separate account? An attacker steals an admin login for the main account. They delete the data there. Then they try to delete the backups too. But the backups live in a different account, with different administrators, so the request is refused. The backups survive. Remember to test restoring from them on a regular schedule.
Quick check Quick check. An accountant needs one invoice file from your private bucket, just for today. What is the safest way to share it? Choose your answer.
Key takeaways Let us put it together. Turn on block public access, and keep public and private files apart. Share single files with time-limited links. Require encryption in transit. Remember that access control matters more than encryption for leaks. And turn on versioning, and keep backups in a separate account. Now read the lesson below, and answer the quiz.
Cloud storage is cheap and easy to use, so companies keep huge amounts of data in it: invoices, ID card scans, database exports and backups. When that storage is set up wrongly, private data can become readable by anyone on the internet. This lesson explains how that happens and how to prevent it.
How cloud storage works
Most cloud storage is object storage. You create a container and upload files (called objects) into it. Each provider uses its own name:
- AWS: Amazon S3, where containers are called buckets
- Azure: Azure Blob Storage, where files are blobs inside containers in a storage account
- Google Cloud: Cloud Storage, which also uses buckets
Every object can be reached through a web address. For example, an S3 object might have an address like this:
https://company-invoices.s3.amazonaws.com/2025/invoice-1042.pdf
Whether that address works for a stranger depends entirely on the access settings. If the bucket is private, a stranger gets an "Access Denied" error. If it is public, the file downloads.
Public buckets and blobs
A public bucket (or public blob container) is one that allows anonymous access. Nobody needs to log in. Public storage has real uses, such as hosting images for a public website. The problem is when private data ends up in public storage.
How does this happen?
- A developer makes a bucket public "for a quick test" and forgets to change it back.
- Public website files and private exports are kept in the same bucket.
- A permission is given to "all users" or "all authenticated users" by mistake. On some providers, "authenticated users" can mean anyone with any account on that provider, not just your staff.
- Someone copies a setup from an online example without understanding it.
Attackers and researchers use automated tools that guess bucket names and test them. Names like companyname-backup or companyname-dev are easy to guess. A random name helps a little, but it is not a security control. Access settings are.
The major providers now include strong safety switches:
- AWS has S3 Block Public Access, which can be turned on for a whole account.
- Azure storage accounts have a setting to disallow anonymous blob access.
- Google Cloud has public access prevention for buckets.
Many new accounts and buckets now block public access by default. But these settings can still be turned off by anyone with enough permission, so you must check them.
You can view the S3 Block Public Access setting for one bucket like this:
aws s3api get-public-access-block --bucket company-invoices
When you need to share one file with one person for a short time, use a time-limited link instead of making anything public. AWS calls these presigned URLs, Azure uses shared access signatures (SAS), and Google Cloud uses signed URLs.
Encryption at rest and in transit
Encryption protects data in two different situations.
Encryption at rest protects data while it is stored on disks. If someone stole a physical disk from a data centre, they would see only scrambled data. The major providers now encrypt stored data by default. You can also manage your own keys with services such as AWS KMS, Azure Key Vault or Google Cloud KMS. This gives you more control over who can use the keys and lets you see when they are used.
Encryption in transit protects data while it moves across a network, for example between a user's browser and your app, or between your app and its database. This is normally done with TLS, the same technology behind HTTPS.
Here is an important limit to understand. Encryption at rest does not stop someone who has valid access. If a bucket is public, the provider will decrypt the files and hand them to anyone who asks, because the access settings say that is allowed. Encryption at rest protects against stolen hardware, not against bad permissions. That is why access control matters most.
Backups and versioning
Data can be lost, not just leaked. A user deletes the wrong folder, a script overwrites files, or ransomware encrypts everything. In the cloud, an attacker with admin rights can also simply delete your data.
Useful protections:
- Versioning: keeps older versions of each object. If a file is overwritten or deleted, you can restore an earlier version. S3, Azure Blob Storage and Google Cloud Storage all offer versioning features.
- Soft delete: deleted data is kept for a set number of days before it is gone for good.
- Immutable or locked backups: some services can lock objects so they cannot be changed or deleted for a set period. AWS calls this S3 Object Lock. Azure and Google Cloud have similar retention and immutability features.
- Separate backups: keep at least one copy in a different account or project, with different administrators. Then one stolen login cannot destroy both the data and the backups.
A backup is only useful if it works. Test restoring from backups on a regular schedule.
How to defend
- Turn on the provider's block public access settings at the account level, and only allow exceptions with a written reason.
- Keep public website files and private data in separate buckets.
- Use time-limited links to share individual files.
- Make sure encryption in transit (HTTPS and TLS) is required for all connections.
- Remember that access control matters more than encryption for preventing leaks.
- Turn on versioning for important data, and keep backups in a separate account.
- Use the provider's security tools to scan regularly for public storage.
Check your understanding
Answer every question correctly to complete this lesson. If you miss one, try the quiz again.
1. A storage bucket holding customer documents is set to allow public read access. What does this mean?
2. What does encryption in transit protect?
3. An attacker gets admin access and deletes your files and the backups stored in the same account. What would have helped most?
Locked: answer every quiz question above correctly to complete this lesson.
Spotted a mistake or something unclear? Report a mistake