Cyberlium
Cyberlium
Cyberlium on Android·Google Play Store

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

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

Bearer Tokens and Sessions

Bearer and cookies both carry session proof — use 127.0.0.1:8812.

Bearer Tokens and Sessions
00:00/03:30

Visual · authn_bearer_sessions

Authorization: Bearer … vs Cookie sessions. 127.0.0.1:8812.

Bearer means “whoever holds this string acts as the subject” — which is why theft equals login.

APIs often use Authorization: Bearer <token> after a login exchange. Browsers may instead hold an HTTP-only session cookie. Both are session proof. TLS protects them on the wire; your notes and clipboard hygiene protect them at rest. Original Cyberlium. Practice a lab bearer on 127.0.0.1:8812. You will NOT steal cookies from other browsers, not phish “login with Google” clones, not hydra password forms on strangers. Next: Authn vs Authz.

1. Bearer is a capability in a string

Anyone who can send the bearer token can call as that subject until expiry or revocation. Treat lab tokens like passwords: 600 files, no screenshots to group chat.

curl -H "Authorization: Bearer lab-token" against YOUR toy. Compare to missing header → 401.

Command guide

Try these commands — Bearer is a capability in a string

═══ TOOLS & WEBSITES ═══ Browse / read these (authorized learning only — stay in YOUR lab / program scope)

Session vs token — https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html Bearer tokens — https://oauth.net/2/bearer-tokens/

═══ INSTALL ═══

Linux (Debian/Ubuntu):

Command — copy this

sudo apt install curl

macOS: Built-in

Windows: Built-in (PowerShell: Invoke-WebRequest)

═══ LINUX / macOS ═══

Command — copy this

curl -sS -H "Authorization: Bearer lab-token" http://127.0.0.1:8812/me
curl -sS -b "session=lab-cookie-value" http://127.0.0.1:8812/me
curl -sS -o /dev/null -w "no auth %{http_code}
" http://127.0.0.1:8812/me

Primary tools to practice this lesson: curl. Reference sites: Session vs token (https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html); Bearer tokens (https://oauth.net/2/bearer-tokens/). Run every command in the box — install first, then the usage lines — only on YOUR lab / program scope.

2. Sessions and cookies are still credentials

Cookie-based sessions need Secure/HttpOnly/SameSite in real apps. On the lab, notice Set-Cookie if present and never replay a classmate’s cookie file.

Bearer vs cookie is transport packaging. The security question is still: who proved identity, and for how long?

3. What you will not do with “session practice”

XSS kits to steal cookies. Evil twin Wi-Fi to sniff tokens. Fake OAuth consent pages. Those are attacks, not literacy.

Ship a note: bearer present → 200; absent → 401 on 127.0.0.1:8812.

4. What you ship: bearer present/absent proof on YOUR lab

401 without bearer, success with lab bearer. Cookie ethics noted. DEMO GATE. Dest 127.0.0.1:8812. No phishing kits. No token theft labs on strangers.

5. What you record before the next lesson

Date. Bearer test results. NEVER classmate cookies. File t13-m03-l02-bearer-sessions.txt chmod 600.

6. Wrong vs right: stranger APIs vs literacy on systems you own

Worked failure — same API word, opposite target. Right never needs a live shop or classmate token.

  • Wrong: Export a friend’s browser cookies “to learn sessions.” Stand up a fake Google login. hydra /login on a public site.
  • Right: Lab bearer only. Next: Authn vs Authz.
Hands-on Exercise

Mission: prove bearer gating without theft theater

1) / STOP if router. 2) curl YOUR 8812 routes with and without Authorization: Bearer. 3) Write theft=login warning in notes. Never phish. Never steal cookies.

Pro Tip

Stuck? Ask Cyberlium AI Mentor

Ask Mentor how to pass Authorization in curl — not how to bypass someone else’s SSO.

Practice QuizQuestion 1
True or False
Q1

APPLY: True or False: Holding a bearer token is enough to act as that subject until revoke/expiry.

Practice QuizQuestion 2
Multiple choice
Q2

APPLY: A zip includes a “Google OAuth phishing kit.” You:

Practice QuizQuestion 3
Multiple choice
Q3

APPLY: Missing Authorization on a bearer-gated lab route should yield:

←Previous: API Keys as Shared Secrets
Answer 3 practice quiz questions to unlock XP reward. (0/3 answered)
Skip quiz & read next →