Re:Hacking on a plane: Leaking data of millions and taking o...
by SoftTalker on Thursday December 08, 2022 @04:28PM
(#33913705)
You can't trust the client. You need to validate everything on the server in the context of the authenticated session. At that point, it doesn't really make sense for the client to be submitting data that will have to be looked up and verifed anyway.
[ Parent
| on HN ]
Re:Hacking on a plane: Leaking data of millions and taking o...
by noduerme on Thursday December 08, 2022 @05:49PM
(#33914869)
If the client has a session, the client is passing the session hash on each and every call. You have to accept it and check it. Whether it's in a session cookie or manually as a GET param. The server doesn't "know" what session it's receiving a call from; it uses the session cookie sent by the client to check it.
Meaning, those $_SESSION variables in PHP are stored on the server, but the server only knows which session to access based on a key passed with every call from the client. A hacker copying someone's php session id would "trick" PHP into using the target's server side variables.
If you're coming from a reset password email and the user has no active session, a token has to be sent via GET and checked, which means you have to look it up and verify it.