Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93173 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26320 invoked from network); 10 May 2016 22:04:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 May 2016 22:04:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.193 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.220.193 mail-qk0-f193.google.com Received: from [209.85.220.193] ([209.85.220.193:34691] helo=mail-qk0-f193.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/1B-63163-CEA52375 for ; Tue, 10 May 2016 18:04:28 -0400 Received: by mail-qk0-f193.google.com with SMTP id i7so1757815qkd.1 for ; Tue, 10 May 2016 15:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=+vJNYDgdSoFij9l6F0itm8z8svrS6/BaI4RgzAzeylU=; b=CW9BdS8/J2C/kV4H00zQWT4jUOt6wKlD8OlYdtOovM6iMA+WL3wOpGkxDO8n+HcaOy q9YGBjyUG8vZzQoNz95JWQJZVWKSsgMRYn8WI5N6NpblCeCGhNpDrBXQ4kK2mUw+TFlt +5JqRF6UcLhY2fpV48MdbKMd1iVDbYXVau8De2MOECZnRV1NrMR8Wa4FGxGABv1AFfGg WNB5sd5DcJHfcCOVuhLWAZd6tgus1XYFlBIeju1aYB0rhJKGk0YCZnaqf+lKjU+7R6tu i7Qt16LUc4BAe951sf10IqR0B2xqPAo0LqtzXMjTagTSH4NNSU8B4ewxwZJX7nsLhcfi Us2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=+vJNYDgdSoFij9l6F0itm8z8svrS6/BaI4RgzAzeylU=; b=mcHnDwDMiiNBD9hF2cBtA/fb1M/qv/oRLhT7qO0c/Q6m89I+uVOjBFAlrP+XSjSUR+ GGI6v5VcP22xAJfR8UbWJHjnNMS5wqOVmktjz5O9vEEpmdUe2JNrIVK3iEz4t3msmT0h Fs8Z2hvi1CEyhX2n9wubAE9HaY/w3xqQ/91NJXbSU9z+QyryUvyVfYlWDgw59NOKHPKk +CVcQeArNXpWCWEbaRgQ7NzDgFEYu0ogr1kj212GpWapX0wWRB3bzSVGVDVJeI07Qb+9 JIL4BlMsRZ03M2STAO323cGsUB+AwYU9rh5dN4gUCqzucThwwj8onKJQX+GtWI1R0+NF mqRQ== X-Gm-Message-State: AOPr4FUQLDH+aiN9TWnnICRWgJnhxFm+pZKlXvaSldXmLV9P2y+7pLH5n6iMxWpGitxmGGghvoygtWNXD1nUNA== X-Received: by 10.55.185.67 with SMTP id j64mr45582229qkf.205.1462917866059; Tue, 10 May 2016 15:04:26 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.140.27.133 with HTTP; Tue, 10 May 2016 15:03:46 -0700 (PDT) In-Reply-To: References: Date: Wed, 11 May 2016 07:03:46 +0900 X-Google-Sender-Auth: Seftc4C-tfZhSzTALhZvc57cIpk Message-ID: To: Rowan Collins Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC DRAFT] Automatic CSRF Protection From: yohgaki@ohgaki.net (Yasuo Ohgaki) Hi Rowan, On Tue, May 10, 2016 at 9:36 PM, Rowan Collins wrote: > Yasuo Ohgaki wrote on 10/05/2016 11:57: >> >> To protect all of URLs automatically, all URLs need to have token. >> That's the reason why all URLs have token. > > > In my opinion, that fails on both counts: not all URLs need protection (I > would say for most applications, the majority of URLs do not need it), and > not all URLs will be protected automatically (because rewriting HTML is a > hard problem, and because some submissions that need protecting are not > generated as HTML). > > Interestingly, the OWASP page has a whole section on the dangers of exposing > CSRF tokens in URLs: > https://www.owasp.org/index.php/Cross-Site_Request_Forgery_%28CSRF%29_Prevention_Cheat_Sheet#Disclosure_of_Token_in_URL > It backs up my gut feeling that exposing the CSRF token too widely can > severely diminish its usefulness; for instance, by exposing tokens in > Referer headers sent to external sites. > > There may be types of application that would benefit from every page having > a "CSRF or die" policy - e.g. online banking - but I don't think they > represent a large proportion of the PHP user space, or benefit significantly > from having the functionality built into the language. For everyone else, > all that's needed is functions to manually generate, save, and validate > tokens, and those can trivially be written as a userland library. Indeed > there are plenty: https://packagist.org/search/?q=csrf Exposure of CSRF token is obvious security risk. As I wrote, the risk is the same as trans sid. In addition, it does not add CSRF token to URLs by default now. (i.e. Protect POST automatically when it is enabled) Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net