The Real Fullstack

The Invisible Browser Request

CORS blocked the attacker from reading anything. So how did their page still make a transfer?

مهندس أول9 دقيقةمحاكي التدفّقتحدي الشيفرة
httpbrowser-apisspring-securityangular

لم يُترجم هذا التحدي إلى العربية بعد. أنت تقرأ النسخة الإنجليزية.

المهمة:Stop cross-site requests from acting as the user, keep cookie sessions, and don't break the payment-provider return.السياق · أهداف التعلّم ▾

Pocketly's web app authenticates with a session cookie. A phishing page auto-submits a hidden form to /transfer, and an old endpoint still accepts GET /transfer?to=… from a link. Users also return from a payment provider via a cross-site redirect, which must keep their session.

المهمة: Stop cross-site requests from acting as the user, keep cookie sessions, and don't break the payment-provider return.

أهداف التعلّم

  • Explain why browsers attach cookies to cross-site requests.
  • Combine SameSite cookies with anti-CSRF tokens.
  • Never change state with GET.
المحاكاةمحاكاة
attacker
1evil site auto-submits POST /transfer → EXECUTED as the victim
2evil link to GET /transfer?to=attacker → EXECUTED as the victim
user
3user returns from payment provider (GET /checkout/return) → works
4user submits transfer form on our site → works
تشغيل المحاكاة
http.csrf(c -> c.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()))  // Angular reads XSRF-TOKEN    .sessionManagement(…);// session cookie:  Set-Cookie: SESSION=…; Secure; HttpOnly; SameSite=Lax// state changes only via POST/PUT/DELETE — GET /transfer?to=… removed// Angular HttpClient sends X-XSRF-TOKEN automatically for mutating same-origin requests

تبسيط

Four flows with simplified browser cookie rules. نموذج تعليمي — الأرقام توضّح سلوكًا وليست قياسات أداء.

المفاهيم

مفيد قبل هذا التحدي

تحديات ذات صلة

المراجع