Dev.to Security 🔐 Cybersecurity 👁 0 📖 1 min read

3DS return URL lost the session because of SameSite=Lax

Found this after a merchant reported that about 2% of 3DS payments ended on a login page instead of the order confirmation. The money was captured. The customer just never saw the success screen, so some of them paid a s

Found this after a merchant reported that about 2% of 3DS payments ended on a login page instead of the order confirmation. The money was captured. The customer just never saw the success screen, so some of them paid a second time.

Our session cookie was SameSite=Lax, which is the browser default now. The flow was: customer completes the challenge, the issuer's ACS page sends a cross-site POST to our return URL, and our handler looks up the session to find the order.

Lax cookies are not sent on cross-site POST requests. They are only sent on top-level GET navigations. So the handler got a request with no cookie, found no session, and redirected to login. It worked in staging because the test ACS simulator did a GET redirect. Real ACS pages post a form.

The fix had two parts. The return endpoint stopped relying on the session and looked the order up by a signed, short-lived token we put in the return URL when we started the 3DS flow. The final redirect after that was a same-site GET, where the cookie is sent normally.

Setting SameSite=None would also have worked, but it widens CSRF exposure on the whole session. A token scoped to one order was cheaper and safer.

Has anyone else seen ACS return behavior differ between test simulators and real issuers?

Payneteasy handles this kind of payment flow for merchants and PSPs — see how it works.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.