Re: [dmarc-ietf] Reversing modifications from mailing lists

Alessandro Vesely <vesely@tana.it> Wed, 01 December 2021 11:45 UTC

Return-Path: <vesely@tana.it>
X-Original-To: dmarc@ietfa.amsl.com
Delivered-To: dmarc@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 8CE993A0400 for <dmarc@ietfa.amsl.com>; Wed, 1 Dec 2021 03:45:57 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.95
X-Spam-Level:
X-Spam-Status: No, score=-3.95 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-1.852, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=neutral reason="invalid (unsupported algorithm ed25519-sha256)" header.d=tana.it header.b=GFUZRbUm; dkim=pass (1152-bit key) header.d=tana.it header.b=DKN9aBkA
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 X8F4kOW1DnTt for <dmarc@ietfa.amsl.com>; Wed, 1 Dec 2021 03:45:50 -0800 (PST)
Received: from wmail.tana.it (wmail.tana.it [62.94.243.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3C9A63A00E9 for <dmarc@ietf.org>; Wed, 1 Dec 2021 03:45:49 -0800 (PST)
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=tana.it; s=epsilon; t=1638359144; bh=BtMpPiKRZHAXSWrayZz1LMgRzVsIaamfy7OxwjTpYOs=; l=2387; h=Subject:To:References:From:Date:In-Reply-To; b=GFUZRbUmKuDoB+rDRJSzdMrxa3gvq7+GP5Elw6kAM1atGJW2B5bI68A9YmlkxnFEp 6FKtVvhVVclbDVO7mdZCw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tana.it; s=delta; t=1638359144; bh=BtMpPiKRZHAXSWrayZz1LMgRzVsIaamfy7OxwjTpYOs=; l=2387; h=To:References:From:Date:In-Reply-To; b=DKN9aBkAZh0q+0SWU7CLASEOO6m4CctPdGNY/ECDxYhjZDfnM2tCoH1fEIii1Fg/a gVBwGOsW++BO97stz4xx2NPfQftja+268j2iGEhMvRHU/F1Tw7P2alx6dtURDnDAlY KYOdPW9usMlSqmuzAb1SU/7mvUF+ggHw7u5JOKv2ViLftiY4usA4Ia2bKw8KH
Authentication-Results: tana.it; auth=pass (details omitted)
Original-From: Alessandro Vesely <vesely@tana.it>
Received: from [172.25.197.111] (pcale.tana [172.25.197.111]) (AUTH: CRAM-MD5 uXDGrn@SYT0/k, TLS: TLS1.3, 128bits, ECDHE_RSA_AES_128_GCM_SHA256) by wmail.tana.it with ESMTPSA id 00000000005DC0F8.0000000061A76068.00005DA5; Wed, 01 Dec 2021 12:45:44 +0100
To: John R Levine <johnl@taugh.com>, Wei Chuang <weihaw@google.com>, dmarc@ietf.org
References: <20211129030358.BC1EA30B80A5@ary.qy> <0e941529-1c93-b84d-ae7f-01c505a52c60@tana.it> <d6116d53-b415-f4d1-67e6-3a765f83754d@taugh.com> <4eb213fc-c269-3d62-36dd-50fd39efb368@tana.it> <CAAFsWK2BLP8+GOVzdDtn_PsyAGaKwt0Y3F_hQWkdTHdC6RhD=A@mail.gmail.com> <b2b240b0-a658-b852-fe22-6902de577745@taugh.com>
From: Alessandro Vesely <vesely@tana.it>
Message-ID: <d3bb0d23-8930-8b7e-3c5e-03821daaae2a@tana.it>
Date: Wed, 01 Dec 2021 12:45:43 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0
MIME-Version: 1.0
In-Reply-To: <b2b240b0-a658-b852-fe22-6902de577745@taugh.com>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/dmarc/vSNZH9nLKEiwwUarFZ9JFzKX0Zo>
Subject: Re: [dmarc-ietf] Reversing modifications from mailing lists
X-BeenThere: dmarc@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Domain-based Message Authentication, Reporting, and Compliance \(DMARC\)" <dmarc.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dmarc>, <mailto:dmarc-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/dmarc/>
List-Post: <mailto:dmarc@ietf.org>
List-Help: <mailto:dmarc-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dmarc>, <mailto:dmarc-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 01 Dec 2021 11:45:58 -0000

On Tue 30/Nov/2021 18:30:39 +0100 John R Levine wrote:
> On Tue, 30 Nov 2021, Wei Chuang wrote:
>> What about adding a footer to some html mime part is poorly handled when
>> using "l="?  Multipart bodies could be handled by other techniques.
> 
> See section 8.2 in the DKIM spec which says if you use l= you need to be 
> careful with your MIME boundaries so naughty people can't add another part that 
> overlays the real message.


I'm not clear about the last but one paragraph of that section:

    An example of such an attack includes altering the MIME structure,
    exploiting lax HTML parsing in the MUA, and defeating duplicate
    message detection algorithms.

I'm going to file an errata about it.  Altering the MIME structure is only 
possible if the value of l= is less than the original message length.  If the 
whole MIME structure forms the body hash, including the epilogue, it is not 
feasible to alter it.  If Content-Type is not signed, the attacker can change 
the top boundary and append whatever content she likes, thereby relegating the 
original, unaltered MIME structure to the role of preamble.

Setting l= with MIME structures doesn't help a non-breaking footer addition. 
For plain text messages, it would help.  However, Section 5.4.1. suggests to 
sign Content-Type when setting l=, to avoid the above attack, and signing 
Content-Type makes for breakable DKIM signatures since MLMs overwrite that 
field.  (Yes, they set text/plain again if the type was such, but 
capitalization and comments may differ.)  Hence I retract what I said in my 
previous message[*], that l= works well with a wide range of mailing lists.

Finally, I thought duplicate message detection was rather related to Message-ID 
than to l=.


> I have seen lists that edit the footer into the HTML of the body, I think at 
> Yahoo groups.  Don't see how you're going to describe that in a reversible way.


Hm... when HTML parts are paired by alternative plain text parts, it is hard, 
due to HTML complexity, to make the added footers look alike.

Anyway, I wouldn't want to authenticate a message that underwent an HTML footer 
addition, because it can completely replace the original content in the end 
recipient's eyes.  My draft requires footers to be plain text.


Best
Ale
-- 

[*] https://mailarchive.ietf.org/arch/msg/dmarc/MKgdtkeKzNNguNWHwtrop0gvb_g