Quick Answer
CSRF (Cross-Site Request Forgery) tricks a logged-in user into submitting a request they did not intend. Prevent with CSRF tokens: generate a unique token per session, embed it in forms, verify on submit. Frameworks auto-handle this. Also use SameSite=Strict or Lax cookie attribute. CSRF attacks exploit the fact that browsers auto-send cookies with cross-origin requests.
Answer
CSRF tricks users into unintended actions. Prevent using CSRF tokens, SameSite cookies, and referer validation.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.
PHP interview questions and answers for beginner, junior, mid-level, senior, and expert developers. Ideal for freshers and experienced candidates preparing for PHP roles.