Skip to content

Expert · Web attacks and their fixes · topic 24 of 35 · 20 min

SSRF and authentication flaws

Explanation

SSRF tricks the server into fetching a URL the attacker chooses, sometimes reaching internal systems; the fix is to allow only known destinations. Authentication flaws are weak logins — no rate limit, weak passwords, poor sessions; the fixes are rate limiting, strong hashing, and solid session handling.

SSRF: making the server fetch for you

Server-side request forgery (SSRF) happens when an app takes a URL from the user and fetches it on the server, without restricting where it can go. Because the server often sits inside a trusted network, an attacker can make it request internal addresses that they could never reach directly — for example internal admin pages or cloud metadata services.

Think of it like this: Think of asking a trusted office peon to fetch a document for you. You are not allowed in the back rooms, but the peon is. If the peon fetches any room you name without question, you can reach the back rooms through them. SSRF is naming an internal "room" and letting the server fetch it.
  • Fix: allow only a strict list of known, external destinations; reject internal addresses and unexpected schemes.
  • Fix: do not send the raw response back to the user; fetch server-side with tight limits.
  • Detection: outbound requests from the server to internal or unusual addresses in logs.

Authentication flaws

Authentication is proving who you are. Common flaws: no limit on password guesses (so attackers can try many), weak password rules, passwords stored unsafely, sessions that never expire or are easy to steal, and weak or missing multi-factor authentication. Each makes it easier for an attacker to become a legitimate user.

WeaknessFix
Unlimited login attemptsRate limiting and account lockout/backoff
Weak or reused passwordsStrong password policy; check against known-breached lists
Passwords stored in plain textHash with a slow algorithm (bcrypt/Argon2) and a salt
Sessions that never end or leakShort expiry, secure + HttpOnly cookies, rotate on login
No second factorOffer and encourage multi-factor authentication (MFA)

Detection and defence

Detection: many failed logins from one source (credential stuffing or brute force), logins from odd locations, and sudden spikes. Defence: rate-limit and monitor the login, hash passwords properly, handle sessions securely, and offer MFA. These are also exactly the OWASP "Identification and authentication failures" items — the attack and the fix are two sides of the same list.

Careful: Testing authentication can mean trying many passwords. Do this only against your own lab or accounts you are authorised to test, never real users' accounts, and never with real breached-credential lists against a live service. That crosses into illegal account access.

Need help?

Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.

Try:

Watch the lesson

SSRF and authentication flaws · 1/7

SSRF = server fetches for you

SSRF: the server fetches a URL the attacker chooses, maybe reaching internal systems.

Prefer a video by a teacher? Find free videos on “ssrf and authentication vulnerabilities explained with fixes” on YouTube ↗

In real life: Locking the front door

A lab app lets a learner try passwords endlessly and stores them in plain text. He reports two findings: add rate limiting plus lockout so guessing is impractical, and hash passwords with bcrypt and a salt so a database leak does not reveal them. He also finds a URL-fetch feature with no restrictions (SSRF) and recommends an allow-list of external destinations. Every finding names the OWASP category and a concrete fix.

Practice (0/3 done)

Task 1 · Question

SSRF tricks the server into…

Task 2 · Question

Passwords should be stored…

Task 3 · Code · Python

Model an SSRF allow-list check. Write allowed(host, allowlist) that returns True only if host is in the allowlist (a list of permitted hostnames), else False.

Quick quiz

Question 1

1.The main fix for SSRF is…

Question 2

2.Rate limiting the login defends against…

Question 3

3.A salt in password hashing is…

Question 4

4.MFA (multi-factor authentication) adds security by…

Read more (free)

Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.

The main fix for SSRF is…

Answer: Allowing only known destinations and blocking internal addresses

Restricting where the server may fetch stops SSRF.

Rate limiting the login defends against…

Answer: Endless password guessing (brute force/stuffing)

Limiting attempts makes guessing impractical.

A salt in password hashing is…

Answer: Extra random data so identical passwords hash differently

A salt makes each hash unique and defeats precomputed tables.

MFA (multi-factor authentication) adds security by…

Answer: Requiring a second factor beyond the password

A second factor protects even if the password leaks.

Which password is strongest?Related

Answer: river tiffin kite seventeen lamp

A long passphrase of random words has far more possible combinations and is not in common lists.

From Passwords and multi-factor authentication

After login, how does the server know who sends GET /api/notes?Related

Answer: The browser sends the session cookie automatically and the server looks it up

The browser stores the cookie and sends it with each request to the same site; the server finds the session row and its user id.

From Signup and login end to end

Even a cracked password matters less when the account has…Related

Answer: Multi-factor authentication

MFA requires a second factor beyond the password.

From Password hashing and cracking (your own hashes only)

Stored XSS differs from reflected XSS because it…Related

Answer: Is saved on the server and shown to many viewers

Stored XSS persists and affects every viewer of the page.

From Cross-site scripting (XSS)

Pass the quiz (60% or more) or mark this topic as done when you are ready.

Your progress is saved on this device only.

Next steps

  1. This is the last topic of “Web attacks and their fixes”. The module exam comes next.
  2. Module 7 exam: web attacks and fixes · 13 questions · 22 min, without help. 4 topics of this module still to finish first.
  3. Then the next module, Deeper lab skills: passwords, privilege, Metasploit, wireless. 35 topics left in the course before the final exam.

← Previous: CSRF and IDOR