LESSON 33 · INTERMEDIATE5 min read

The Browser Security Model and the OWASP Top 10

Learn the rules browsers use to isolate sites, then map real vulnerability classes to the OWASP Top 10 and a practical threat model.

OWASP Top 10 · MITRE ATT&CK · NIST CSF 2.0Free to readModule 8 of 14
YOUR NEXT SMALL WINS

By the end, you’ll be able to…

  • Explain the same-origin policy, CORS, cookies, and content security policy.
  • Map common web weaknesses to the OWASP Top 10 categories.
  • Recognise how security misconfiguration and insecure defaults create exposure.
  • Threat model a web application using entry points and trust boundaries.

01The Browser Is a Security Boundary

A browser runs code from many different sites in one process tree. The same-origin policy is the rule that keeps one origin from freely reading another origin's data. An origin is the combination of scheme, host, and port. https://app.example.com and https://admin.example.com are different origins. So are http://example.com and https://example.com. This isolation is fundamental to the web, and most browser security features are refinements of it.

Cross-Origin Resource Sharing (CORS) lets a server deliberately relax the same-origin policy for specific origins, methods, and headers. A permissive CORS policy such as Access-Control-Allow-Origin: * with credentials enabled can expose authenticated data. CORS is not authentication. It is a browser-enforced permission system, and it must be configured narrowly.

Cookies have their own rules. The Secure attribute sends them only over HTTPS. HttpOnly prevents JavaScript from reading them, reducing the impact of XSS. SameSite controls when browsers attach cookies to cross-site requests. A session cookie should normally be Secure, HttpOnly, and SameSite=Lax or Strict unless a documented cross-site flow requires otherwise. Each attribute removes a different attack path.

secure-response.httpHttp
HTTP/1.1 200 OKContent-Type: text/html; charset=UTF-8Set-Cookie: session=...; Secure; HttpOnly; SameSite=Lax; Path=/Strict-Transport-Security: max-age=31536000; includeSubDomainsContent-Security-Policy: default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'none'X-Content-Type-Options: nosniffReferrer-Policy: strict-origin-when-cross-originPermissions-Policy: camera=(), microphone=(), geolocation=()

02The OWASP Top 10 as a Map

The OWASP Top 10 is an awareness document, not a complete checklist. It groups common web application risks so teams can prioritise education and testing. The current categories include broken access control, cryptographic failures, injection, insecure design, security misconfiguration, vulnerable and outdated components, identification and authentication failures, software and data integrity failures, security logging and monitoring failures, and server-side request forgery.

The most important category is often broken access control. A valid user can often reach another user's data by changing an identifier, omitting a tenant header, or calling an administrative endpoint directly. Authentication failures are similarly common: weak password storage, missing MFA, session fixation, and unsafe account recovery. These are not exotic bugs. They are missing checks in ordinary workflows.

Use the Top 10 to structure a review. For each category, ask which assets, entry points, and trust boundaries apply. Then write a testable question: 'Can a customer read another customer's invoice by changing the ID?' 'Does the password reset token expire?' 'Can an uploaded SVG execute script when viewed?' A map is useful only when it leads to specific tests.

owasp-review-map.txtPlain text
A01 Broken Access Control  Test: change object IDs, tenant headers, roles, and HTTP methods.A02 Cryptographic Failures  Test: password storage, TLS, sensitive data at rest, key handling.A03 Injection  Test: SQL, NoSQL, OS command, template, header, and log injection.A04 Insecure Design  Test: business rules, abuse cases, rate limits, trust boundaries.A05 Security Misconfiguration  Test: defaults, debug mode, directory listing, verbose errors, cloud storage.A06 Vulnerable Components  Test: dependency inventory, versions, advisories, patch latency.A07 Authentication Failures  Test: MFA, sessions, reset, lockout, credential stuffing, enumeration.A08 Integrity Failures  Test: unsigned updates, insecure deserialization, CI/CD trust.A09 Logging and Monitoring Failures  Test: security events, alerting, retention, tamper resistance.A10 SSRF  Test: URL fetchers, image proxies, webhooks, metadata endpoints.

03Insecure Defaults and Exposure

A secure design can still be defeated by a misconfigured deployment. Debug mode left on in production can expose stack traces, environment variables, and interactive consoles. Default administrator credentials, directory listing, permissive cloud storage, unnecessary HTTP methods, and verbose error messages all help an attacker understand and abuse the system.

Configuration must be treated as code. Define the expected state, review it in pull requests, test it in CI, and monitor for drift. Remove sample applications and unused features. Restrict management interfaces to trusted networks. Use separate credentials and data for development, staging, and production. Never let a development shortcut become a production default.

Error handling is part of configuration. Users should receive a stable, non-sensitive message with a correlation ID. Operators should receive the detailed error in a protected log. A stack trace shown to an attacker can reveal framework versions, file paths, database names, and internal logic. That information makes the next attack easier.

04Threat Model the Request Path

A web request crosses many trust boundaries. The browser sends data the server must not trust. The server calls downstream services, databases, queues, and third-party APIs. Each call has an identity and a permission boundary. The application must validate input, enforce authorisation, encode output, and handle failures without leaking information.

Draw the request path for one important action, such as 'issue a refund' or 'download an invoice'. Mark where identity is established, where authorisation is checked, where data is stored, and where it leaves the system. Then ask what happens if each step is skipped, replayed, or given a manipulated identifier. This is more productive than testing random payloads without a model.

A secure web application is not one that passes a scanner. It is one where the designers have thought about abuse cases, the developers enforce checks consistently, the deployment is hardened, and the operators can detect and respond to attacks. The remaining lessons give you the specific mechanics for the most important failure modes.

LET IT CLICK

The ideas worth keeping.

  • The same-origin policy, CORS, cookies, and CSP are separate browser controls with separate failure modes.
  • The OWASP Top 10 is a map for asking specific, testable questions, not a complete security program.
  • Broken access control and authentication failures are ordinary missing checks, not exotic exploits.
  • Configuration, defaults, and error handling are part of the attack surface.
TURN UNDERSTANDING INTO SOMETHING YOU CAN DO

Make it yours.

Type and test your code right here in the interactive workspace. Run your solution, check the output, and compare with the worked guide when ready.

01

Exercise 1: Classify the weakness

A user changes /api/invoices/1042 to /api/invoices/1043 and receives another customer's invoice. Which OWASP Top 10 category applies, what is the root cause, and what is the fix?

Explore a worked solution
one_possible_solution.mdCybersecurity
Broken access control (A01). The root cause is missing server-side authorisation: the application trusts the object ID from the URL without checking that the authenticated user owns or may access the invoice. The fix is to scope the database query by the authenticated user or tenant and return 404 when the record is not accessible. Add a negative test with two accounts and log denied access attempts.

The object ID is not the vulnerability by itself. The vulnerability is the missing authorisation check on the server.

02

Exercise 2: Review CORS

A response includes Access-Control-Allow-Origin: * and Access-Control-Allow-Credentials: true. Explain why this combination is dangerous and propose a safer configuration.

Explore a worked solution
one_possible_solution.mdCybersecurity
Browsers reject the combination of a wildcard origin with credentials, but the intent is still dangerous and some implementations reflect the request origin instead. If an application reflects any origin and allows credentials, an attacker's site can read authenticated responses. Use an explicit allowlist of trusted origins, allow credentials only when required, restrict methods and headers, and validate the Origin header on the server. Do not use a wildcard for authenticated APIs.

CORS is a browser permission, not an authentication mechanism. A permissive policy can turn a victim's browser into a data-exfiltration tool.

A SMALL QUESTION. A USEFUL NEXT STEP.

What stayed with you?

Check the ideas while they’re fresh. Your answers stay in this page and feedback appears as you go.

A LITTLE ACTIVE RECALL0 / 4 answered
01What is an origin in the same-origin policy?
02Which cookie attribute prevents JavaScript from reading the cookie?
03Which OWASP Top 10 category covers a user reading another user's record by changing an ID?
04Why is a detailed stack trace in a production response risky?

Keep exploring.

The official references behind this lesson, when you want a second angle or the full details.

One lesson closer.

Reading is a start. Trying it yourself makes the connection.

Completion is saved in this browser. It records reading and hands-on practice progress.