Skip to content
Ameen Abozaid
JNR-041

Common vulnerabilities

  • 7 Lessons
  • 2.5 h practice (estimate)
On this page 8 topics

Overview

Topics

  • OWASP Top 10
  • injection
  • broken access control
  • XSS
  • CSRF
  • SSRF introduction

Learn first

2.5 h of practice (estimate)

Learning outcomes

  1. Explain the current OWASP Top 10 categories with a backend example of each.
  2. Demonstrate and fix SQL/JPQL injection, broken access control, and mass assignment.
  3. Explain stored vs reflected XSS and the backend's role (output encoding, content types).
  4. Explain SSRF and protect a URL-fetching feature with an allow-list.

Lessons

  1. 01The OWASP Top 10 tour
  2. 02Injection beyond SQL
  3. 03Mass assignment
  4. 04XSS from the backend's view
  5. 05CSRF revisited
  6. 06SSRF
  7. 07Demo: exploiting and fixing mass assignment and SSRF

Lab and exercises

Lab

JNR-041-LAB1 · Vulnerable Shop

Outcomes: 1–4 · Time: ~2.5 h On a deliberately vulnerable branch with six planted flaws, find each, exploit it locally, fix it, and add a regression test for it. Acceptance: 5 of 6 found and fixed, each with a regression test.

Exercises (assessment: the lab, graded on fixes and tests)

IDOutcomeTask
JNR-041-EX011Name six OWASP Top 10 categories and give one Shop example for each.
JNR-041-EX022Exploit and fix a JPQL query built by string concatenation.
JNR-041-EX032Register with "role":"ADMIN", then fix it with a DTO.
JNR-041-EX042Fix a broken-access-control bug where a customer can update another's profile.
JNR-041-EX053Explain stored vs reflected XSS and state two things a JSON backend does to reduce the risk.
JNR-041-EX064Explain SSRF with one example for an "import from URL" feature.
JNR-041-EX074Write an allow-list check for a URL-fetching feature and a test that rejects an internal address.
Show solutions
  • EX01 For example: access control (IDOR), injection (JPQL concatenation), cryptographic failures (MD5 passwords), security misconfiguration (open Actuator), vulnerable components (old library), SSRF (URL import). Verify names against the current edition.
  • EX02 Attack name=' or '1'='1; fix with :name and setParameter, or a Spring Data derived query.
  • EX03 Use a RegisterRequest(email, password) record and set the role server-side to CUSTOMER.
  • EX04 Take the user from the principal and update only that user's record; return 404 for other ids.
  • EX05 Stored: payload saved and shown to others; reflected: echoed from the request. Backend: correct Content-Type and no unencoded HTML; encode output for HTML and set nosniff/CSP headers.
  • EX06 The attacker supplies http://localhost:8080/actuator/env or a cloud metadata address and the server fetches it for them.
  • EX07 Parse the URL, require https, check host is in an allow-list, resolve the address and reject loopback/private ranges; test with http://127.0.0.1/.

Quiz

Outcomes: O1 OWASP Top 10 · O2 injection, access control, mass assignment · O3 XSS · O4 SSRF.

A self-check for you: nothing is graded, saved or sent anywhere. Choose an answer, then check it. You can try again as often as you like.

  1. 1OWASP publishes:O1
  2. 2An IDOR belongs to:O1
  3. 3The reliable defense against SQL injection is:O2
  4. 4Sort-column names that cannot be parameters should be:O2
  5. 5Mass assignment happens when:O2
  6. 6The best fix for mass assignment is:O2
  7. 7Stored XSS means the payload is:O3
  8. 8For a JSON API, XSS risk is reduced by:O3
  9. 9SSRF means the:O4
  10. 10The best protection for a URL-fetching feature:O4

Practical part

The lab is the assessment: six planted flaws, each found, exploited, fixed, and covered by a regression test. Pass: 5 of 6 fixed with tests, plus quiz 8 of 10.

Common mistakes

Binding request bodies directly to entities; fetching user-provided URLs unrestricted.

Assessment

The lab, graded on fixes and tests.

Career relevance

OWASP API Security (MID-052).

Type to search levels, phases, modules and lessons.