[websec] Content sniffing

"Richard L. Barnes" <rbarnes@bbn.com> Mon, 09 July 2012 20:55 UTC

Return-Path: <rbarnes@bbn.com>
X-Original-To: websec@ietfa.amsl.com
Delivered-To: websec@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3259121F86C9 for <websec@ietfa.amsl.com>; Mon, 9 Jul 2012 13:55:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -106.561
X-Spam-Level:
X-Spam-Status: No, score=-106.561 tagged_above=-999 required=5 tests=[AWL=0.038, BAYES_00=-2.599, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xqFHYOifFUrR for <websec@ietfa.amsl.com>; Mon, 9 Jul 2012 13:55:10 -0700 (PDT)
Received: from smtp.bbn.com (smtp.bbn.com [128.33.1.81]) by ietfa.amsl.com (Postfix) with ESMTP id 8BE8521F86C1 for <websec@ietf.org>; Mon, 9 Jul 2012 13:55:10 -0700 (PDT)
Received: from dhcp-192-1-255-151.col.bbn.com ([192.1.255.151]:50741) by smtp.bbn.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from <rbarnes@bbn.com>) id 1SoKzX-0005je-M5 for websec@ietf.org; Mon, 09 Jul 2012 16:55:35 -0400
From: "Richard L. Barnes" <rbarnes@bbn.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Date: Mon, 9 Jul 2012 16:55:35 -0400
Message-Id: <CC7E8027-2CCE-41B7-9244-1638C15830A5@bbn.com>
To: websec@ietf.org
Mime-Version: 1.0 (Apple Message framework v1278)
X-Mailer: Apple Mail (2.1278)
Subject: [websec] Content sniffing
X-BeenThere: websec@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Web Application Security Minus Authentication and Transport <websec.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/websec>, <mailto:websec-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/websec>
List-Post: <mailto:websec@ietf.org>
List-Help: <mailto:websec-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/websec>, <mailto:websec-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 09 Jul 2012 20:55:11 -0000

Related to draft-ietf-websec-mime-sniff, an example of sniffing gone awry:
<http://lcamtuf.coredump.cx/squirrel/>

It's a valid JPEG image that contains and HTML snippet in a comment segment.  As a result, when a browser loads the URL expecting an image, it renders the image content, and when it expects HTML, it skips the binary junk at the top and renders the HTML [*]. (In both cases, the server reports Content-Type text/html.)   What's even more startling is that Chrome helpfully adds the binary junk at the top as the first child of the <body> element in the parsed DOM!

--Richard


[*] At least in Chrome 20.0.1132.47