Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56296 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81646 invoked from network); 12 Nov 2011 00:49:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Nov 2011 00:49:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=rui_hirokawa@yahoo.co.jp; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rui_hirokawa@yahoo.co.jp; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain yahoo.co.jp designates 114.111.99.167 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rui_hirokawa@yahoo.co.jp X-Host-Fingerprint: 114.111.99.167 smtp506.mail.kks.yahoo.co.jp Received: from [114.111.99.167] ([114.111.99.167:46422] helo=smtp506.mail.kks.yahoo.co.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/00-15743-882CDBE4 for ; Fri, 11 Nov 2011 19:49:13 -0500 Received: (qmail 98079 invoked by alias); 12 Nov 2011 00:49:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.jp; s=yj20110701; t=1321058948; bh=asAJnQjUxqnnoXu12hcFqhsZwxem5RVNO+s2EeTV8Vc=; h=Received:X-Apparently-From:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:X-Enigmail-Version:Content-Type:Content-Transfer-Encoding; b=C9kq+FgWPXghKMQst7OjNSsUidnBp8DJVIiH7jTLQcqbdA6ErAz6ZP7zIHjK+Uhu6ySDJFCJzFJbxJDwhgyhH9SrzfiI/d2jEpxe6fhM5KeGxfw568Pfuvbg5+N7ekWh++MHuGGP0Bz+kCoZeHhv1vv4WvZuCA/SWydiM0RNc9M= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=yj20110701; d=yahoo.co.jp; h=Received:X-Apparently-From:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:X-Enigmail-Version:Content-Type:Content-Transfer-Encoding; b=lAGiZzOq0lFWI3ZIoCKYTIGkG/veRpjvI7LuFQxop7oWC1kAaqHcND9clSa4STWtvaNU25+M6fi4dUZC2P06kMG2dZ0IAit3YBuQkkY6371cHwhqdEuqN1ESpHAxphctaubnUr5xhInzWZ6okv8UyJoQsQ9NoqKoaXW3wOZlRtU= ; Received: from unknown (HELO flight.example.com) (119.242.99.10 with plain) by smtp506.mail.kks.yahoo.co.jp with SMTP; 12 Nov 2011 00:49:08 -0000 X-Apparently-From: Message-ID: <4EBDC283.3040700@yahoo.co.jp> Date: Sat, 12 Nov 2011 09:49:07 +0900 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: X-Enigmail-Version: 1.4a1pre Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Strict session? From: rui_hirokawa@yahoo.co.jp (Rui Hirokawa) Hi, I strongly recommend to submit the Strict session patch for php-src(HEAD) because the vulnerability of PHP against the session adoption/fixation attack is annoying issue of the PHP programmers for many years. I also suggest to apply this patch for PHP_5_4 after PHP 5.4.0 is released. For PHP 5.4.1, I suggest that the default value of session.use_strict_mode should be 0 (Off) to maintain the backward compatibility. Rui Yasuo Ohgaki wrote: > Hi all, > > Few years ago, I have proposed strict session. > It seems PHP 5.4 and php-src don't have protection against session > adoption yet. > > Since there will be many TLDs, session adoption attack will be > very easy for some domains until browsers support them. > Even without new TLDs, attacker may place cookie file to attack > session adoption or can exploit paths or domains, since there is no > standard for precedence. > > e.g. Domain has more precedence over path on Chrome while > path has greater precedence on IE. This is due to the order difference > of sent cookies. (If there are multiple cookies are set for domain/path, only > one became the outstanding cookie. I think PHP uses first IIRC while other > implementation may use the last. Therefore, browser may not able to > solve this issue, since it may destroy apps specific to browser) > > Even if a programmer sets path and domain for PHP session id cookie, > attackers may exploit this to fix session id with session managers that are > vulnerable to session adoption. > > If you don't get idea, play with cookie with/without domain/path is set/unset. > You'll see how attacker may use session adoption. Default session module's > configuration (domain not set, path set to /) is very easy to exploit anyway. > > I usually set both exact application domain/path, and unset all domain/path > cookies for session id to prevent the attack. I guess this is not > widely adopted. > Even this is not enough. For example, if subdomain is added, Chrome has > greater precedence for subdomain and attacker may exploit it. > > I pasted a patch for PHP 5.2 that rejects uninitialized session id. I > think original > patch was written by Stefan Esser. It is for PHP 5.2, but it's easy to port to > current PHP. If one would like to old behavior, he/she can just turn off the > strict session. > > There are too many ways to exploit session with session adoption vulnerable > session manger. Simple solution is making session manager strict. > > Any comments? > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > >