Every web application faces two enemies that have been around since the earliest days of the modern web.
Cross-Site Request Forgery (CSRF) exploits the fact that browsers automatically attach cookies â including session cookies â to every request they send to a site. If you are logged in to your bank and you visit a malicious page, that page can silently make your browser fire a transfer request. The bank sees a request signed with your real session cookie and obeys it.
Cross-Site Scripting (XSS) exploits the fact that browsers execute whatever JavaScript a page contains. If an attacker can inject a <script> tag into a page â through a comment field, a URL parameter, or any other unsanitised input â that script runs in the victim's browser with full access to the page's cookies and DOM.
Both attacks share a root cause: unverified trust. CSRF trusts that any request carrying a valid cookie must have been intentional. XSS trusts that any content in the page is safe to render. Two defences match those two failures: a CSRF token (a secret the forged request cannot know) and output escaping (treating every user-supplied string as text, never as markup).
These are not exotic vulnerabilities. CSRF and XSS consistently appear in the OWASP Top 10 list of the most critical web application security risks.
Comments
Loading comments...