Module 2 of 5Free to explore

OWASP Top 10 and ASVS: SSRF, IDOR, Deserialization, Auth

2 hoursTheory and practiceMedium

Study-time guide: 15 min reading and analysis, 65 min core exercises, 40 min review and deliverable. Additional external-platform execution is estimated separately.

Risk categories and verification requirements have different jobs

OWASP Top 10 supports discussion of risk categories, while ASVS provides a foundation for application verification requirements. Memorizing category names is insufficient. Select a concrete subject, action, object, and expected denial for your service. Use the current Top 10:2025 and an identified ASVS edition; record the edition in your report instead of mixing requirement identifiers from different versions.

Our original case is a project API serving two organizations. A student reads owned material; a tenant administrator reads material within that organization. Being an administrator must not grant access to another tenant. This self-contained Python example models that decision. It uses no network services and is not production middleware.

def can_read(subject, project):
    same_tenant = subject['tenant'] == project['tenant']
    allowed_owner = subject['id'] == project['owner']
    tenant_admin = subject['role'] == 'tenant-admin'
    return same_tenant and (allowed_owner or tenant_admin)

alex = {'id': 7, 'tenant': 'A', 'role': 'student'}
admin = {'id': 8, 'tenant': 'A', 'role': 'tenant-admin'}
own = {'id': 42, 'tenant': 'A', 'owner': 7}
foreign = {'id': 43, 'tenant': 'B', 'owner': 9}
assert can_read(alex, own)
assert not can_read(alex, foreign)
assert not can_read(admin, foreign)
print('three authorization cases passed')

Object context matters

Checking only role == tenant-admin would create a cross-tenant authorization bypass. Checking only that a session exists would allow an ordinary IDOR: authentication identifies a caller but does not authorize reading the selected object. A client-supplied tenant parameter is also untrusted. Obtain identity context from a verified session and compare it with the resource record.

SSRF involves another boundary: the application makes an outgoing request. When a user chooses a preview URL, project authorization does not make that URL safe. Destination policy, address validation, and redirect handling need their own controls; checking one string fragment is unreliable. Deserialization is a separate concern again. Treat JSON as data and validate its schema. Do not accept formats that construct arbitrary objects or trigger actions from untrusted sources without a specific protective design.

Exercise: expand the API matrix

Add an owned project in another tenant, an unrelated project in the same tenant, and a valid same-tenant administrator case. Then design negative preview URL cases: an unknown domain, a forbidden network destination, and a redirect outside the permitted destination. Use synthetic addresses such as preview.example.test; real internal services are unnecessary.

Acceptance criteria: the server authorizes every selected object; administrators cannot cross tenant boundaries; URLs pass a separate outgoing-request policy. Identify which properties the local example demonstrates and which require an integration test of the service.

Work deliverable

Submit the API access matrix and server-handler requirements, separating authorization, SSRF, and deserialization. Review them against OWASP ASVS, the Authorization Cheat Sheet, and SSRF Prevention.

Lesson: read the function line by line

Start in ordinary language if code is unfamiliar. subject describes the caller; project is the selected object. tenant denotes an organizational boundary. == compares values. and requires both conditions; or accepts an alternative. The function returns a permission decision. It does not authenticate a person or make an HTTP request. A real application must obtain inputs from a trusted context.

Trace alex and own on paper: tenant matches and ownership matches, so access is true. For admin and foreign, the role matches but tenant does not, so the result is false. This exposes the significance of parentheses. (same_tenant and allowed_owner) or tenant_admin would allow an administrator without a tenant boundary. That is a mechanism error rather than a change of OWASP category name.

Save the main example as plain text in authorization_lab.py. With Python 3 installed, use python3 authorization_lab.py on macOS/Linux or py authorization_lab.py on Windows if the launcher exists. No packages, cloud account, or network service are required. An assertion stops execution when its condition is false. Successful output describes only the listed cases. Without an interpreter, build the truth table and label execution as unperformed.

Practice extension: a parenthesis-error control

Make a separate function copy containing the incorrect expression above. Retain the forbidden admin, foreign test; it should fail. Preserve the original. Add an administrator of the correct tenant and a student reading another owner’s object in the same tenant. The first is allowed by this model; the second is denied. Define case names and expected outcomes before running, rather than adapting tests to a flawed implementation.

Top 10 supports risk communication, while ASVS supports verification scope. Fix an edition, such as Top 10:2025, and obtain ASVS requirement identifiers from the actual selected document. Do not invent numbers from memory. For a Russian customer, add an internal requirement ID and acceptance reference separately from legal obligations.

Add a run record with function version, cases, actual output, and limits. The local model checks this function on these inputs. It does not establish that every real endpoint calls the function correctly, that sessions are authenticated, or that database operations are atomic. Convert those limits into specific integration checks in later modules.

Try the idea yourself

Where to put a check

Change the conditions and observe this training model. It runs in your browser and does not change your computer.

A team is preparing a release. Enable the independent checks and see what remains unknown.

Observation

Choose conditions above to see an explanation of the result.

Independent exercise · Russian

Приёмная платформа технопарка импортирует списки оборудования от четырёх арендаторов. Перед запуском в 2027 году архитектор записал одно требование «учесть OWASP». Тестировщику предстоит превратить его в условия приёмки конкретного импорта.

Evidence

Сервис принимает подписанный сеанс арендатора, номер заявки, идентификатор каталога поставщика и пакет JSON. Договорённость команды допускает два заранее настроенных каталога. Схема пакета разрешает только поля «артикул» и «количество». Обработчик пишет позиции в заявку.

Assignment

Подготовьте четыре строки для ревью контракта. Укажите, что подтверждает личность, кто разрешает запись в выбранную заявку, как ограничено исходящее соединение и когда пакет можно передать обработчику.

Compare your reasoning

Для первой строки проверьте подпись и срок сеанса. Для второй сопоставьте арендатора из сеанса с владельцем заявки и правом записи. Для третьей нужны выбор каталога по серверному справочнику и запрет переходов за разрешённые назначения. Для четвёртой — строгая проверка структуры, типов и обязательных полей до создания позиций. На каждую строку приходится отдельное ожидаемое решение при отказе.

Personal practice environment

Check an excerpt, find matching lines and compute the SHA-256 of the original text. Temporary data expires after 30 minutes or when you close the environment.