Ravindra BagaleCourses & study guides मराठी Track your progress

30. Cloud and AWS Security

Cyber Security

30.2 IAM Done Right

In short: IAM (Identity and Access Management) is the front door of your account.

IAM (Identity and Access Management) is the front door of your account. Get this right and most attacks fail.

1. Lock the root user. The root user (your sign-up email) can do everything, including closing the account.

  • Enable MFA on root (IAM console, Security credentials, Assign MFA device).
  • Delete any root access keys. Root should never have keys.
  • Use root only for billing and account-level tasks; do daily work as an IAM user or through IAM Identity Center.

2. MFA for every human. A stolen password alone should never be enough.

3. Least privilege. Give only the permissions a job needs. Compare:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["s3:GetObject", "s3:PutObject"],
    "Resource": "arn:aws:s3:::reels-media-pune/*"
  }]
}

This policy lets the app read and write objects in one bucket. Attaching AdministratorAccess to the app instead would let one bug in your PHP code hand an attacker your whole account.

4. Roles, not access keys. An EC2 instance should get permissions from an IAM role (you did this in Chapter 16), which gives short-lived credentials that rotate automatically. Long-lived access keys in code or ~/.aws/credentials on a server are the most common way cloud accounts get stolen.

5. Review regularly. IAM, Credential report (download CSV) shows who has MFA, old passwords and unused keys. IAM Access Analyzer flags resources shared outside your account.

aws sts get-caller-identity                     # who am I right now?
aws iam generate-credential-report
aws iam get-credential-report --query Content --output text | base64 -d > cred-report.csv
aws iam list-access-keys --user-name dev-sanket  # any old keys?

Ravindra Bagale's Tip

The biggest mistake: writing an access key into your code and pushing it to GitHub. Bots scan public repos within minutes and use the key to start crypto-mining servers – and the bill comes to you. A key should never be in code. Use a role on EC2, aws configure on your laptop, and .gitignore. If it does get pushed, deactivate the key immediately (30.6).

Lab

In your own account: (1) enable MFA on root and on your IAM user, (2) download the credential report and find any user without MFA, (3) create a policy that allows only s3:GetObject on one test bucket, attach it to a test user, and prove with the CLI that s3:PutObject is denied (AccessDenied). Delete the test user afterwards.

Real incident: Ginkgo Bioworks – data taken from old, forgotten cloud environments (Oct 2026)

1. What happened

On 8 October 2026, US biotech company Ginkgo Bioworks said it had recently discovered that an unauthorised third party accessed data from cloud environments mainly linked to its former biosecurity business. The company believes the data came primarily from legacy cloud environments – older cloud setups left over from a business it no longer runs the same way. Ginkgo said it cut off the intruder's access, rotated credentials, took some legacy systems offline as a precaution, and found no evidence the intruder still had access or reached other environments. Its core systems, including financial systems, were not interrupted. The company was clear: this was not a ransomware or encryption event. It informed the FBI and notified customers whose data was involved. Ginkgo has not said how many people were affected, what kind of data was taken, or when the access happened.

2. How the hack happened (public reporting only – high-level)

  1. A company keeps old cloud environments running from a past business line – fewer people watch them, and their access rules may be years old.
  2. An outsider gets access to those legacy environments (Ginkgo has not published the exact entry path).
  3. The outsider reads and takes data stored there – no encryption, no ransom note, so nothing "breaks" that would alert staff quickly.
  4. The company discovers the access, cuts it off and rotates credentials – which tells us access credentials were a key part of the clean-up.
  5. Legacy systems are taken offline and checks confirm the main environments were not reached.

3. How to stop it / defend (this lesson: IAM Done Right)

  • Every cloud account needs an owner. When a business unit closes or is sold, someone must either shut down its cloud accounts or hand them over formally – never just leave them running.
  • Rotate and remove old credentials. Use the IAM credential report from this lesson to find access keys and users nobody has used for 90+ days, and disable them.
  • Least privilege on legacy data too. Old buckets and databases should be locked to a small read-only group, or moved to archive with strict access.
  • Same logging everywhere. Turn on CloudTrail (Chapter 30.5) in old accounts as well as new ones, so access to forgotten data still raises an alert.
  • Delete data you no longer need. Data that does not exist cannot be stolen.

4. How to take care so it won't happen again (checklist)

  • [ ] Make a list of every cloud account and project you have, with an owner name next to each.
  • [ ] Mark which ones belong to old projects, closed teams or past clients.
  • [ ] For each old one: delete it, or archive the data and lock access down.
  • [ ] Download the credential report every month and disable unused keys and users.
  • [ ] Check that CloudTrail and alerts are on in every account, not just the main one.
  • [ ] India students: the same applies to old client projects at IT companies – when a project ends, remove access and clean up its cloud accounts. Report major incidents to CERT-In within the required time (see Ch.34).

Source: Ginkgo Bioworks press release "Ginkgo Bioworks Cybersecurity and Incident Response", 8 October 2026, as reported by TSN Media, "Cyber Breaches, 9 October 2026", 9 October 2026.

Check if you're safe: Website Security Checklist

Real incident: ConnectWise Cloud Backup (SkyKick) – one stolen vendor app secret used to sign in to hundreds of Microsoft 365 tenants (Oct 2026)

1. What happened

ConnectWise Cloud Backup (earlier called SkyKick) is a backup service that managed service providers (MSPs) use to back up their clients' Microsoft 365 mail, OneDrive, SharePoint and Teams data. To do that job, every client gives the backup app broad read and write permission in its Microsoft 365 tenant.

  • On 15 October 2026, someone signed in to customer tenants as the backup app itself, using the app's own secret credential, and received Microsoft Graph access tokens.
  • Huntress confirmed unauthorised sign-ins in 173 tenants it protects. Its later update said almost 1,000 Microsoft tenants saw sign-in activity from the attacker's server, and more than 300 of those sign-ins succeeded.
  • Microsoft Threat Intelligence called it an active supply-chain attack. It said the attacker likely abused permissions customers had already given the app, including the very powerful Directory.ReadWrite.All.
  • ConnectWise published an advisory on 16 October, disabled seven of its app identities on 17 October and suspended the backup service. It said it has no evidence the stored backup archives were accessed.
  • The reports do not yet say how the attacker got the vendor's credential, and how much data was read is still unclear. Educational framing only.

2. How the hack happened (public reporting only – high-level)

  1. When a company connects the backup app, Microsoft Entra ID creates an app identity (service principal) for it inside that company's tenant, with the permissions the admin approved once.
  2. The app proves who it is with a secret or certificate kept in the vendor's own environment. The same credential works in every tenant where the app is installed, so one stolen credential opens many companies at once.
  3. A script signed in as the app to tenant after tenant, a few seconds apart. This is an app-only sign-in: no user and no phone, so MFA never comes into the picture.
  4. The tokens carried the app's existing rights – read and write mail, files, Teams chats and directory data. Microsoft also saw Graph reconnaissance and attempts to add extra credentials as a backdoor.
  5. In about 50 tenants, ConnectWise Cloud Management apps gave themselves admin roles, mostly Exchange Administrator. In one tenant, a Cloud Management app made itself Global Administrator and added new secrets to two other trusted apps – an MSP management tool and Huntress's own security app. A secret added like this keeps working even after the vendor app is switched off. Huntress has not yet confirmed whether this earlier activity was the same operator.
  6. It was hard to see: these sign-ins show only on the separate Service principal sign-ins tab, not the default user sign-ins tab, and directory reads through Microsoft Graph leave no audit trail.

3. How to stop it / defend (this lesson: IAM done right)

  • Least privilege applies to apps and vendors too. Before you approve a third-party app, read the permissions it asks for. Ask the vendor why it needs directory write rights or admin roles.
  • Remove apps you no longer use. ConnectWise asked partners to check even tenants with dormant SkyKick connections. An old, forgotten app with big permissions is an open door.
  • MFA does not protect app identities. Protect them with the controls built for them: Conditional Access for workload identities (allow sign-in only from the vendor's expected locations), app management policies that block or shorten client secrets, and very few people holding the Application Administrator roles.
  • The same idea in AWS: give a vendor an IAM role with an External ID and a narrow policy, never long-lived access keys. Watch CloudTrail for a vendor role that creates access keys or attaches policies to itself, and use IAM Access Analyzer to list everything shared outside your account.
  • Alert on these events: an app adding itself to a directory role, an app changing other apps, or new credentials appearing on an app (SOC and SIEM, Chapter 31).
  • During an incident: disable the vendor app (don't delete it), save the sign-in and audit logs early because they are kept only for a limited time, and remember that tokens already issued stay valid until they expire. Revoking user sessions does not stop app access.

4. How to take care so it won't happen again (checklist)

  • [ ] If you use ConnectWise Cloud Backup or Cloud Management (or older SkyKick apps), follow the ConnectWise advisory: keep the listed apps disabled until ConnectWise gives restore steps, and check service principal sign-ins from 13 October 2026 onwards.
  • [ ] Review the secrets and certificates on all your apps and remove any you did not create.
  • [ ] Remove any directory role you never meant to give an app.
  • [ ] Keep a list of every third-party app in your tenant or AWS account, its owner, its permissions and when it was last used.
  • [ ] Turn on alerts for app role changes and new app credentials.
  • [ ] Plan for a backup vendor outage: know how you would restore if the backup service is suddenly suspended.

Source: Huntress, Jonathan Semon, "ConnectWise (SkyKick) Vendor Credentials Abused in M365 Attacks", 16 October 2026 (updated 17 October 2026); BleepingComputer, Ionut Ilascu, "Hackers breach Microsoft 365 tenants via ConnectWise supply-chain attack", 17 October 2026; The Hacker News, Ravie Lakshmanan, "Hackers Use Compromised ConnectWise Credential to Sign In to 173 Microsoft 365 Tenants", 17 October 2026 (quoting Microsoft Threat Intelligence and Todyl); ConnectWise Trust Center advisory "Cloud Backup (formerly known as SkyKick) Service Interruption", first published 16 October 2026, updated 18 October 2026.

Real incident: Barracuda – a cloud access key given to a vendor was never retired, and an attacker used it to roam about 10 cloud accounts for 44 hours (Nov 2026)

1. What happened

In this lesson you learnt IAM done right: give the smallest access, prefer short-lived roles over long-lived keys, and remove access the moment it is not needed. This real case shows what happens when one old key is forgotten.

  • Barracuda Networks is a network and email security company.
  • Barracuda gave a cloud access key to a third-party vendor (a company working in AI) for an earlier project. When the project ended, the key was not retired. Barracuda said: "That is on us."
  • The key sat in a configuration file in the vendor's GitHub repository. It was exposed when the vendor's development environment was compromised. BleepingComputer reports Barracuda believes the key was stolen in October.
  • On 1 and 2 November 2026, the attacker used it to reach about 10 Barracuda cloud accounts over 44 hours. Barracuda discovered the activity on 4 November.
  • The attacker searched for crypto wallet secrets (for example environment variables named WALLET, MNEMONIC, SEED and PRIV, and seed phrases), so Barracuda believes the motive was money.
  • One reached system stores Barracuda XDR customer integration credentials. Barracuda says it found no evidence they were viewed or stolen, but it asked notified customers to revoke and recreate them and review activity from 1 November 2026.
  • Barracuda says the attack patterns match ARTEX, an open-source AI pentesting framework, and called it a "machine-speed intrusion".

2. How the hack happened (public reporting only – high-level)

  1. A long-lived cloud key was shared with a vendor and left active after the work ended.
  2. The vendor kept the key in a config file in its GitHub repository. The vendor's development environment was compromised and the key leaked.
  3. The attacker signed in to Barracuda's cloud with that key.
  4. Inside, it found more credentials in one system and used them to move into data analytics, source-code repositories and Kubernetes clusters.
  5. It tried to stay in by running a container that mounted the host's file system. A separate attempt to create a new cloud administrator identity was blocked.
  6. Barracuda found it, cut off access, rotated credentials and secrets, and retired two automation servers whose credentials were exposed.

3. How to stop it / defend (this lesson: IAM done right)

Why: a key does not know the project is over. If nobody turns it off, it keeps working for whoever holds it, even years later.

What you can do:

  1. Keep a list of every key you give to a vendor, with an owner and an end date. When the project ends, disable and delete the key the same day.
  2. Prefer roles over keys. Let the vendor assume an IAM role with short-lived credentials, instead of giving a permanent access key.
  3. Give the smallest access. One project should reach only the buckets or services it needs, never many accounts.
  4. Find unused keys every month. Check "last used" dates and disable any key that is old or quiet (Examples 1 to 3).
  5. Block risky actions with guardrails, like creating new admin users or running containers that mount the host. Barracuda's blocked admin attempt shows guardrails work.
  6. Alert on keys used from new places with CloudTrail and GuardDuty, and keep secrets in a secrets manager, not in config files or plain environment variables.

Example 1: list the keys of a vendor user.

  1. Open a terminal where the AWS CLI is set up with an admin profile you trust.
  2. Run aws iam list-access-keys --user-name vendor-project-user
  3. Output (example): AccessKeyId: AKIA...EXAMPLE Status: Active CreateDate: 2026-03-02
  4. What it means: this user still has an active key. Ask: is the project still running?

Example 2: see when the key was last used.

  1. Copy the AccessKeyId from Example 1.
  2. Run aws iam get-access-key-last-used --access-key-id AKIA...EXAMPLE
  3. Output (example): LastUsedDate: 2026-11-01 ServiceName: s3 Region: ap-south-1
  4. What it means: if the project ended long ago but the key was used recently, treat it as a possible leak and start your incident steps.

Example 3: turn the old key off.

  1. Tell the vendor first if the project is still live, so nothing breaks by surprise.
  2. Run aws iam update-access-key --user-name vendor-project-user --access-key-id AKIA...EXAMPLE --status Inactive
  3. Output: (no output means success; the key now shows Status: Inactive)
  4. What it means: the key stops working at once. After a few quiet days, delete it for good.

4. How to take care so it won't happen again (checklist)

  • [ ] Every vendor key has an owner and an end date written down.
  • [ ] Keys are disabled and deleted on the day a project ends.
  • [ ] Vendors use IAM roles with short-lived credentials where possible.
  • [ ] Each key has only the access one project needs.
  • [ ] We review key "last used" dates every month.
  • [ ] Guardrails block new admin users and host-mounting containers.
  • [ ] Secrets live in a secrets manager, not in Git repos or config files.

Source: Barracuda Trust Center, "Barracuda XDR Integration Credentials" advisory, published 10 November 2026 and updated 13 November 2026; BleepingComputer, "Barracuda links cloud breach to ARTEX AI-powered cyberattack" (Bill Toulas), 16 November 2026.

Ravindra Bagale's Tip

When you give a key to anyone, write its end date on the same day. A key never retires itself. Barracuda's key was meant for one old project, but it still opened about 10 cloud accounts months later. Roles with short-lived credentials are safer than permanent keys.

Check if you're safe: Password Strength Checker