Cyberlium
Cyberlium
Cyberlium on Android·Google Play Store

Learn cybersecurity with hands-on labs and AI mentor support on your phone.

Mod 19 · Les 3/5
In progress
Module 19•Lesson 3 of 5•⏱️ 15 min read•Beginner+40 XP

Keys, Roles, and Logging

No long-lived keys in git. CloudTrail-style logs conceptually.

Keys, Roles, and Logging
00:00/10:35

Visual · keys_roles_logging

Standing keys in git are a remote admin door. Prefer roles and short-lived credentials. Audit logs say who did what — on an account YOU own.

A long-lived key in a repository is a standing invitation. Roles expire. Logs tell you who used the door — if you turned them on.

Lessons 1–2 put identity above the WAF and named public storage plus over-broad IAM as the usual misconfig. This lesson names the three hygiene objects that sit under that: long-lived access keys (especially in git), roles that mint short-lived credentials instead of standing secrets, and CloudTrail-style audit logs — conceptually: who did what, when, from where. In Cyberlium wording you will not get a log-wiping guide, a key-cracking kit, or a cross-account assume-role attack chain. You will write why git must not hold cloud secrets, why a role beats a key left in a laptop folder, and why an account without audit logs is flying blind. This is original Cyberlium teaching mapped to the Ethical Hacking cloud-computing domain — not official Official Certification training, not a cert, not exam dumps. You will not search other people’s repositories for keys as homework. You will not disable someone else’s trail. You will not open a stranger’s IAM. Next is Lab — IAM Hygiene on an Account You Own: MFA, list key metadata, notes chmod 600 — or skip with a hypothetical if you have no cloud. Here you lock the concepts.

1. No long-lived keys in git — standing secrets are remote admin

A long-lived access key is a secret that stays valid until someone disables it. If that secret is committed to git, copied into a screenshot, or pasted into a ticket, anyone who can read the copy can call the cloud API as that identity — often from another country, without your laptop. Lesson 1’s WAF does not see a “hack.” It may not see the API at all. The fix is not a prettier .gitignore after the leak. The fix is: do not create standing keys unless a named job cannot use a role; never commit secrets; if a secret leaked, disable it on an account you own and rotate. Pasting live keys into cyberlium-lab notes fails this lesson the same way live passwords failed Module 6.

Grayhat “keys in GitHub” hunting against strangers is not homework. If you accidentally committed a key in a repo YOU own, disable and rotate on YOUR account — still not a tutorial in scraping the world’s git hosts. Legal line: original Cyberlium teaching mapped to the Ethical Hacking cloud-computing domain — not official Official Certification training, not a cert, not exam dumps.

Command guide

No long-lived keys in git — WHAT/WHY

═══ LINUX / macOS (Web & API Security Testing) ═══

Test HTTP methods on authorized lab endpoint

Command — copy this

for method in GET POST PUT DELETE OPTIONS; do
  curl -s -o /dev/null -w "%-8s -> Status: %{http_code}
" -X $method "http://${LAB_HOST:-127.0.0.1}/api/v1/user"
done

Test JSON API with Authorization Bearer header

Command — copy this

curl -s -X POST "http://${LAB_HOST:-127.0.0.1}/api/v1/profile" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <TEST_TOKEN>" \
  -d '{"id": 1, "action": "view"}' | jq . 2>/dev/null || cat

Check for CORS misconfiguration headers

Command — copy this

curl -s -I -H "Origin: https://attacker.com" "http://${LAB_HOST:-127.0.0.1}/api/v1/status" | grep -i "Access-Control"

2. Roles and short-lived credentials beat a key on disk

A role (or the equivalent: instance profile, workload identity, OIDC to a CI job) is a named job that can obtain temporary credentials when something you own proves it should. Those credentials expire. A stolen laptop then holds less of a standing door than a ten-year access key in a file named secrets.env. Humans should prefer console or SSO plus MFA over a personal access key. Workloads should prefer the provider’s role mechanism over a key baked into an image. You do not need an assume-role exploit chain to use that sentence. You need to prefer expiry.

Over-broad roles are still Lesson 2: a job that can do everything is standing admin with extra steps. Do not attach full administrator “so the demo works.” Do not mint a second long-lived key for class. Lesson 4 counts keys on identities you own. If you have no cloud, write: “no standing keys; CI would use a role; humans use MFA console.”

Command guide

Roles and short-lived creds — WHAT/WHY

═══ LINUX / macOS (Web & API Security Testing) ═══

Test HTTP methods on authorized lab endpoint

Command — copy this

for method in GET POST PUT DELETE OPTIONS; do
  curl -s -o /dev/null -w "%-8s -> Status: %{http_code}
" -X $method "http://${LAB_HOST:-127.0.0.1}/api/v1/user"
done

Test JSON API with Authorization Bearer header

Command — copy this

curl -s -X POST "http://${LAB_HOST:-127.0.0.1}/api/v1/profile" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <TEST_TOKEN>" \
  -d '{"id": 1, "action": "view"}' | jq . 2>/dev/null || cat

Check for CORS misconfiguration headers

Command — copy this

curl -s -I -H "Origin: https://attacker.com" "http://${LAB_HOST:-127.0.0.1}/api/v1/status" | grep -i "Access-Control"

3. CloudTrail-style logs: who, what, when, from where — conceptually

Audit logs (AWS CloudTrail is the famous name; other providers have equivalent trails) record management events: which identity created a key, who made a bucket public, where the API call appeared to come from. Conceptually that is a security camera for the control plane. Defenders use it to answer “did we do that?” after a surprise. This course names the camera. It does not teach you to wipe it, spoof it, or flood it. Module 6 already put tester documentation on the opposite side of covering tracks. The same sentence applies in cloud: on accounts you own, leave the trail on. On accounts you do not own, you do not touch logging.

You do not need a query cookbook aimed at someone else’s trail. Customer job: logging on, retained, readable by a named owner. Alerts like “new access key created” explain why Lesson 4 counts keys — not how to bypass them. If you own no account, write “hypothetical: trail on, root rare and MFA’d.” Do not disable logging on a shared family account “to see if anyone notices.”

4. Unused keys, unused humans — standing doors you forgot

Identities accumulate. An intern key from last year, a user who left, a second access key “for the laptop” that never got deleted — each is a door. Hygiene is a count: how many long-lived keys exist for users you own, which have not been used, which humans still have console without MFA. Lesson 4 is that count on a live account you own, or an honest skip. Today you write that unused is a finding without turning unused into a privilege-escalation lab against a tenant you do not administer.

Forbidden proofs: logging in as a classmate to list their keys; a work account without written permission; creating keys so the count is non-zero. If you find a key in YOUR old gist, disable it in YOUR console and do not paste the secret. chmod 600 on notes that even mention a rotation.

5. YOUR trail and YOUR IAM — not a stranger’s control plane

Other tenants’ IAM is out. Other tenants’ git is out as a hunting ground. Other tenants’ CloudTrail is out. “The API was reachable” is not consent — Module 1 already spent that sentence on public websites. Cloud control planes are public endpoints by design so customers can log in. That design is not a lab invitation. If you are unsure the account is yours, you stop. If you have no cloud, you still complete this lesson on definitions. Do not open a friend’s console to make logging feel real. Lesson 4 will say the same skip out loud.

Provider docs on enabling a trail or a role on an account you own are fair reading. Write-ups on stealing credentials from someone else’s app are not this course. If a sentence would help steal a key from a tenant you do not own, delete it. If it would help future-you keep YOUR account, keep it.

6. Wrong vs right: hunting keys in other people’s git vs roles, expiry, and YOUR logs

Worked failure — same words “access key” and “CloudTrail,” opposite blast radius. Right never needs a stranger’s IAM to learn expiry.

  • Wrong: Search other people’s git for keys. Paste live secrets into notes. Disable someone else’s trail. Assume roles in a tenant you do not own. Mint extra standing keys for class. Call it Ethical Hacking. This path is not official certification training.
  • Right: No long-lived keys in git. Prefer roles and short-lived credentials. CloudTrail-style logs on, conceptually, for an account you own or would own. File $HOME/cyberlium-lab/keys-roles-notes.txt, chmod 600. Next: Lab — IAM Hygiene on an Account You Own — or skip with a hypothetical.

7. Hands-on: lock keys-roles-notes.txt — concepts, no secret paste, no stranger IAM

On a computer you own, create cyberlium-lab if needed. Fill the template. Do not paste access-key secrets. Do not add a git-dork kit. chmod 600. The block writes notes only.

Hands-on Exercise

Mission: keys-roles-notes.txt in cyberlium-lab (mode 600)

1) In your own words: no long-lived keys in git; roles mint short-lived credentials; CloudTrail-style logs are a camera, not a wipe kit. 2) Fill $HOME/cyberlium-lab/keys-roles-notes.txt with the legal line and ethics refuse line. chmod 600. Do not paste secrets. 3) Ethics: no hunting other people’s git, no stranger IAM, no disabling someone else’s trail.

Pro Tip

Stuck? Ask Cyberlium AI Mentor

If “I cannot learn keys without finding a live one on GitHub” still feels true, ask for a hint — not a dork. Try: "Hint only: why standing keys in git are a door, why roles expire, what CloudTrail-style logs record, and why Lesson 4 may skip if I have no cloud?" You still fill keys-roles-notes.txt. No secret paste. No stranger console.

You now treat standing cloud keys in git as a remote admin door, prefer roles that expire, and treat audit logs as a camera you leave on — on accounts you own. Hunting other people’s secrets is out. Notes are locked in cyberlium-lab. This is original Cyberlium teaching mapped to the Ethical Hacking cloud-computing domain — not official Official Certification training, not a cert, not exam dumps. Next — Lab — IAM Hygiene on an Account You Own — MFA on root/console, list access keys you own, cloud-iam-lab.txt chmod 600, or skip with a hypothetical. Do not open a stranger’s console.

Practice QuizQuestion 1
Multiple choice
Q1

APPLY: A teammate wants to dork GitHub for live cloud keys “to understand Ethical Hacking Module 19.” What are keys vs roles vs logs here, and what do you do?

Practice QuizQuestion 2
True or False
Q2

APPLY: True or False: If you have no cloud account, the ethical lab is to open a classmate’s IAM and disable their unused keys.

Practice QuizQuestion 3
Multiple choice
Q3

APPLY: Which pairing matches this lesson’s artifact and the next lab?

Practice QuizQuestion 4
Multiple choice
Q4

APPLY: curl of http://192.168.0.1/ shows a home router login (TP-Link / Netgear / Huawei / "Router Admin"). Is that DEMO in scope as a hacking target?

←Previous: Public Storage and Over-broad IAM
Answer 4 practice quiz questions to unlock XP reward. (0/4 answered)
Skip quiz & read next →