Re: [Unbearable] Dealing with header injection through reverse proxies

Piotr Sikora <piotrsikora@google.com> Tue, 18 July 2017 09:20 UTC

Return-Path: <piotrsikora@google.com>
X-Original-To: unbearable@ietfa.amsl.com
Delivered-To: unbearable@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BCB8E131DD2 for <unbearable@ietfa.amsl.com>; Tue, 18 Jul 2017 02:20:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.002
X-Spam-Level:
X-Spam-Status: No, score=-2.002 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=google.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z2PwBgNcX7Ol for <unbearable@ietfa.amsl.com>; Tue, 18 Jul 2017 02:20:20 -0700 (PDT)
Received: from mail-ua0-x22e.google.com (mail-ua0-x22e.google.com [IPv6:2607:f8b0:400c:c08::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 83B72131DC7 for <unbearable@ietf.org>; Tue, 18 Jul 2017 02:20:18 -0700 (PDT)
Received: by mail-ua0-x22e.google.com with SMTP id z22so16345628uah.1 for <unbearable@ietf.org>; Tue, 18 Jul 2017 02:20:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pnJj1xGMWzkB/dY6mU5c042WxmIomRLVLQyZbaVVsVw=; b=Ok6Yd3EmzzRJYfJlR+HBMPB8LEUzacFuK9kCcSsX2xo4FV1uatJ+XCO/KyY2SG72ee zPMt5wDIa7sy5OoZrvUcT02x2nN1hMM6Upu8FyCxuwazJAaRv5NzpSg6Q6tJip2pPk+M 1mEQ8u+3RASIAX8/tTAuANDiXmFAjqF/j4QiUokHycFRqGXrY6arXm6xNHMkhmhRfi8e ZdAAZ9kG9EFBOKi6KV1muLW1S3HHuw09d4WJju/vlJB46CWBgkKzxq+GmdEVJdjUMDiK 85jY/ra3Dvd1faRYQ6C2wYgMCIiUInpNlO3lTztkSUqwjSlMhqhOsnX/lfuvjcc18BSg vaug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pnJj1xGMWzkB/dY6mU5c042WxmIomRLVLQyZbaVVsVw=; b=Hw0R9dq6qrWEWDJkTxl4y/KqBFWW8XFgZiqecT+9uFIb0nH8QQcEqeBaz6l7usIzUv 9GMTyqstmzeMJlLFTZFbcn9omYvkDtUKfWlY2AI6ew0N6FgAcanozeEUcydqh3hANT8R uGEn2zyipircYNbSf5PQytTdnOaQPM5+SW2HZC3dug6crytE2/PUwVT44Qk0Wdh6gS/9 0WzNgpZ/ut700NXbjFlabS/k4JL+U6aBgyO7NxKGLcH6kszCLxaAbpphPw2Nj9p2Akfz sLsFKWn3bgVmTmkBU5swpijbpcH3jbeWTG4I4ODrHGdpHbiYRyt/pNyvfuI7HqdYgD2J gW3g==
X-Gm-Message-State: AIVw113/8ToV5leQhggZPprjlLwxHY2//RBqCxJzZTItysWjvlh2EbBF o7OibP4h8EkX8WTa4N1FvQ/XPy/0n9O8rq0=
X-Received: by 10.31.169.15 with SMTP id s15mr371620vke.70.1500369617468; Tue, 18 Jul 2017 02:20:17 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.103.176.67 with HTTP; Tue, 18 Jul 2017 02:20:16 -0700 (PDT)
In-Reply-To: <20170717184507.GA10072@1wt.eu>
References: <CABcZeBNK4zHCR4V8cRAJBxC0AiVpep8HWoX8Ntnr9ZTZGq8S+A@mail.gmail.com> <20170717184507.GA10072@1wt.eu>
From: Piotr Sikora <piotrsikora@google.com>
Date: Tue, 18 Jul 2017 11:20:16 +0200
Message-ID: <CAF-CG+Jqnv_TxH9=b0N2dUQr=J0iuBwyyXGxem0MJt0qvkuMOw@mail.gmail.com>
To: Willy Tarreau <w@1wt.eu>
Cc: Eric Rescorla <ekr@rtfm.com>, IETF Tokbind WG <unbearable@ietf.org>, HTTP Working Group <ietf-http-wg@w3.org>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/unbearable/aMvlFkp4fGtEOIPBmCAepFZ5qhk>
Subject: Re: [Unbearable] Dealing with header injection through reverse proxies
X-BeenThere: unbearable@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "\"This list is for discussion of proposals for doing better than bearer tokens \(e.g. HTTP cookies, OAuth tokens etc.\) for web applications. The specific goal is chartering a WG focused on preventing security token export and replay attacks.\"" <unbearable.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/unbearable>, <mailto:unbearable-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/unbearable/>
List-Post: <mailto:unbearable@ietf.org>
List-Help: <mailto:unbearable-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/unbearable>, <mailto:unbearable-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Jul 2017 09:20:22 -0000

Hey Willy,

> What I've seen and used was slightly different :
>   1) proxies unconditionally remove the header field
>   2) proxies unconditionally add the new header field even with no
>      certificate
>   3) servers verify that there is exactly one header field
>
> This way even if step 1 above fails (eg: usual typo in the rule needed
> to strip the header field which nobody notices since nobody injects
> such a field name), step 2 ensures that any injection will be detected
> in step 3.

This is exactly what the current draft suggests and what EKR objects,
because misconfigured proxy that doesn't know about
"X-Client-Certificate" won't execute steps 1-3 for the
"X-Client-Certificate" header.

Best regards,
Piotr Sikora