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

2. Ports and Protocols: SSH, HTTP, HTTPS, FTP/SFTP and DNS

2.3 HTTP – Port 80

HTTP ha web cha bhasha aahe. Browser request pathavto, server response deto. Burp Suite shiktana (Part 10) tumhi hech requests pakdun badlnar aahat, mhanun structure nit samja.

GET /login.php?next=/profile HTTP/1.1          <- method, path + query, version
Host: shop.example.com                         <- which website (virtual host)
User-Agent: Mozilla/5.0 ...
Cookie: PHPSESSID=8f2c1a...                    <- session identifier
                                               <- blank line, then optional body

HTTP/1.1 200 OK                                <- status line
Content-Type: text/html; charset=UTF-8
Set-Cookie: PHPSESSID=8f2c1a...; HttpOnly
<html> ... </html>
Method Meaning Typical use
GET Read a resource; parameters in the URL Open a page, search
POST Send data in the body Login form, upload
PUT / PATCH Replace / update a resource REST APIs
DELETE Delete a resource REST APIs
HEAD Like GET but headers only curl -I
OPTIONS Which methods are allowed CORS pre-flight
Status class Meaning Examples
1xx Informational 101 Switching Protocols
2xx Success 200 OK, 201 Created, 204 No Content
3xx Redirect 301 Moved Permanently, 302 Found, 304 Not Modified
4xx Client error 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found
5xx Server error 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable
curl -I http://example.com          # only headers
curl -v http://example.com          # full request and response

Why this matters for security

Plain HTTP is readable by anyone on the path (Wi-Fi, ISP, a compromised router) – passwords and cookies travel in clear text. HTTP is also stateless, so applications use cookies/sessions; stealing a session cookie (for example through XSS) means logging in as the victim. Almost every web attack in the OWASP Top 10 is a manipulated HTTP request.

Ravindra Bagale's Tip

Many students get confused between 401 and 403. 401 means "I don't know who you are – please log in" (authentication); 403 means "I know who you are, but you don't have permission" (authorization). Interviewers often ask about this difference – very simple, but remember it.

Practice task

Run curl -v http://example.com -o /dev/null and identify: the request line, the Host header, the status code and two response headers.

Extended teaching notes

Why this lesson matters

Hardening is deleting unnecessary risk: fewer packages, fewer open ports, fewer privileged accounts, faster patches, better logs.

Hardening related services

[('SSH', 'Key auth, no root login, Fail2ban or equivalent, SG limited to your IP/VPN.', '', ''), ('SMB / NFS / LDAP / SNMP', 'Do not expose to the internet; patch; strong auth; disable unused versions (e.g. SMBv1).', '', ''), ('SMTP', 'Authenticated relay only; SPF/DKIM/DMARC for your domains.', '', ''), ('DNS', 'Restrict zone transfers; monitor for unexpected records (crt.sh for certs).', '', ''), ('Firewalls', 'Host firewall + cloud SG/NSG; default deny; document every allow.', '', '')]

Real examples

Global: CIS Benchmarks exist for Linux, Windows and clouds. Indian company (sample): a Pune team requires SSH keys only and weekly patch windows for internet-facing hosts.

Mini case study

Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.

Defender's worksheet (do this today)

  1. Write the lesson title, date and the exact lab target you are allowed to use.
  2. List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
  3. Run one safe check from the lesson on a lab system only. Paste the command and output.
  4. Write a two-sentence fix you would give a teammate.
  5. Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.

Indian workplace (sample data)

Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).

Global practice

Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.

Everyday analogy

Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.

Key terms

  • Control: a safeguard (patch, config, process, detection).
  • Finding: a weakness backed by evidence.
  • Remediation: the fix plus how you verified it.
  • Scope: systems you have written permission to touch.
  • Least privilege: only the access the task needs.
  • Defence in depth: several layers so one failure does not end the story.

Common mistakes

  • Skipping written permission "just for a quick scan".
  • Practising on hostel, office or public targets without authorisation.
  • Collecting tool output without writing the fix.
  • Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
  • Publishing screenshots that contain secrets, cookies or internal hostnames.

Recap

  • Evidence, fix, owner, date.
  • Own lab only.
  • Fix > spectacle.