From nobody Fri Aug 25 02:23:13 2023
Return-Path: <mixoftix@gmail.com>
X-Original-To: ideas@ietfa.amsl.com
Delivered-To: ideas@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1])
 by ietfa.amsl.com (Postfix) with ESMTP id 9ED07C14CE45
 for <ideas@ietfa.amsl.com>; Fri, 25 Aug 2023 02:23:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.134
X-Spam-Level: 
X-Spam-Status: No, score=-5.134 tagged_above=-999 required=5
 tests=[BAYES_00=-1.9, DEAR_SOMETHING=1.973, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5,
 RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01]
 autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key)
 header.d=gmail.com
Received: from mail.ietf.org ([50.223.129.194])
 by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id cb9pglonYc26 for <ideas@ietfa.amsl.com>;
 Fri, 25 Aug 2023 02:23:11 -0700 (PDT)
Received: from mail-oo1-xc2a.google.com (mail-oo1-xc2a.google.com
 [IPv6:2607:f8b0:4864:20::c2a])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by ietfa.amsl.com (Postfix) with ESMTPS id 2BA3CC151063
 for <ideas@ietf.org>; Fri, 25 Aug 2023 02:23:11 -0700 (PDT)
Received: by mail-oo1-xc2a.google.com with SMTP id
 006d021491bc7-5733710eecaso450542eaf.1
 for <ideas@ietf.org>; Fri, 25 Aug 2023 02:23:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1692955390; x=1693560190;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=Sxbi9nsFF0JGR4R15GBdaQNqr664Bm4qAPPsqkwIbvw=;
 b=jz7pN3C9eaQW0Lh/ekYhgEceYZ6mlSZaTsv/bQ6k+bKS0k7m8HZJZh4deNCfR8+qQ8
 FbQmvHBAmBTWImg3HvmdSd1Y4p7lbpoSj0hfpgEkrDaN4/qnEHXOaE2/F8btqeFYdKjN
 0WEppgpz0+zFH8DHYY9C7oQ909LnWkKRkFtgSjNc1zO65vhM+7EZOkYa8vEhpfT1be8Q
 Qlm322TASDKBfds4N6Bff56ko0Srlkq0zO7OBdpg4FLBEixGUaU8Goy4PMnYuiv8izIl
 etCeKWE67OWy0PzQOkbZNuT2rjpJlFiPA1oloHgWi+lWPH/Pps6XLHhIng3+jSyrnh3M
 KGHA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1692955390; x=1693560190;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=Sxbi9nsFF0JGR4R15GBdaQNqr664Bm4qAPPsqkwIbvw=;
 b=D5Hy+I/L80Xs5P6uJask9V04PVR5Rf74I/4G9aHkLotZZDS/uMq4NIa0Q8CLEevLPy
 y+DqEq/fCqU8ew0SWXRAjM1CeLi0/znTcn8Om/LrJF+T8m3TRBD90g+XD05wieQawG/t
 2Lfqi6Lurzf+DQJr1hSipUPmtCCzrnJqty82G23pH7JqUHyDpKxFYK0C7ocraWwGLRLh
 SHUxwI4kNHiyOh9VG+Ms6eoFCDezTEirwY7Rr42VdBC/VzkNLH1nnh2wu4gm0XuTW7n/
 l6fJjsvU6DEsh9E9Ye89l3elUaiRa7K9M8skbvHPRny62DgDhdBTFlg8oqX/jfcWcQ6O
 LEZg==
X-Gm-Message-State: AOJu0YxJ3NZiXakUn2FMRJTsxVsMTTWdqFqT21UoWTs6d4kxQdn6J9L6
 qW5c525ZgvWUTECQwy6Je7/T3Ws/k8yJU2NFetkdAfHr3RA=
X-Google-Smtp-Source: AGHT+IEeyDpE+UYV2DYCJ5DYtlDf7Wqpc4KBbcqT7kJvAXbq/mszILGusPlf5jkBINTYlW6juGGrUNCu7uAGP3iZ2UM=
X-Received: by 2002:a05:6808:1a84:b0:3a7:53a8:aed2 with SMTP id
 bm4-20020a0568081a8400b003a753a8aed2mr2193597oib.7.1692955389974; Fri, 25 Aug
 2023 02:23:09 -0700 (PDT)
MIME-Version: 1.0
From: Shahin Noursalehi <mixoftix@gmail.com>
Date: Fri, 25 Aug 2023 12:52:58 +0330
Message-ID: <CADrAmL5YbUJPOiQxOaWwwLbJGHYXg-C63ft-CCoNUu+Kucymmg@mail.gmail.com>
To: ideas@ietf.org
Content-Type: multipart/alternative; boundary="000000000000a3dd1a0603bbe4a7"
Archived-At: <https://mailarchive.ietf.org/arch/msg/ideas/VEzD4RXKlCFIUftYIrrEdMFgoW0>
Subject: [Ideas] RFC-8452 enhancement with adding "custom-padding" trick and
 more..
X-BeenThere: ideas@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Discussions relating to the development, clarification,
 and implementation of control-plane infrastructures and
 functionalities in ID enabled networks." <ideas.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ideas>,
 <mailto:ideas-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ideas/>
List-Post: <mailto:ideas@ietf.org>
List-Help: <mailto:ideas-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ideas>,
 <mailto:ideas-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 25 Aug 2023 09:23:11 -0000

--000000000000a3dd1a0603bbe4a7
Content-Type: text/plain; charset="UTF-8"

dear madam / sir

during a private research around RFC-8452 (section 9. security
considerations) in response to any "downgrade attacks" with poor legacy
cryptographic algorithms and also poor key management with modern
algorithms that could end at some sort of "padding oracle attacks",  just
added two "custom-padding" phrases, separating with "|" (vertical bar ) to
the left and right sides of any plaintext, before getting processed by ANY
encryption phase. the sample code bellow in C# explains how simple could
this implementation be (in applied implementation we will replace the
mentioned RNG function bellow with robust editions):

// BGN: add custom-padding to the plain_text
public static string custom_padding(string plain_text)
{
   Random rnd = new Random();
  int custom_padding_size_left = rnd.Next(10, 100);
  int custom_padding_size_right = rnd.Next(10, 100);
   string custom_padding_left =  rnd_simple(custom_padding_size_left);
   string custom_padding_right = rnd_simple(custom_padding_size_right);

  string plain_text_with_custom_padding = custom_padding_left + "|" +
plain_text + "|" + custom_padding_right;
}
// END: add custom-padding to the plain_text

// BGN: generate random string for custom-padding
public static string rnd_simple(int size)
{
  var chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  var stringChars = new char[size];
  var random = new Random();

  for (int i = 0; i < stringChars.Length; i++)
  {
    stringChars[i] = chars[random.Next(chars.Length)];
  }

  var finalString = new String(stringChars);
  return finalString;
}
// END: generate random string for custom-padding


after the decryption phase, the added "custom-padding" phrases could get
clear by addressing those vertical bars (|). so, because of the benefits I
could see in this approach with many cryptographic algorithms (including
RFC-8452), just decided to send this idea to the respected members of IETF
for more evaluation and suggestions.

any feedback welcome,
--shahiN Noursalehi

--000000000000a3dd1a0603bbe4a7
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div><span style=3D"font-family:verdana,sans-serif">d=
ear madam / sir<br><br></span></div><span style=3D"font-family:verdana,sans=
-serif">during a private research around=20
<span class=3D"gmail-comments-comment-item__main-content gmail-feed-shared-=
main-content--comment gmail-t-14 gmail-t-black gmail-t-normal"><span dir=3D=
"ltr">RFC-8452</span></span> (section 9. security considerations) in respon=
se to any &quot;d<span class=3D"gmail-comments-comment-item__main-content g=
mail-feed-shared-main-content--comment gmail-t-14 gmail-t-black gmail-t-nor=
mal"><span dir=3D"ltr">owngrade attacks</span></span>&quot; with poor legac=
y cryptographic algorithms and also poor key management with modern algorit=
hms that could end at some sort of &quot;padding oracle attacks&quot;,=C2=
=A0 just added two &quot;custom-padding&quot; phrases, separating with &quo=
t;|&quot; (</span><span style=3D"font-family:verdana,sans-serif">vertical b=
ar</span>

<span style=3D"font-family:verdana,sans-serif">) to the left and right side=
s of any plaintext, before getting processed by ANY encryption phase. the s=
ample code bellow in C# explains how simple could this implementation be (i=
n applied implementation we will replace the mentioned RNG function bellow =
with robust editions):</span><span style=3D"font-family:verdana,sans-serif"=
><br></span><span style=3D"font-family:monospace"><br>// BGN: add custom-pa=
dding to the plain_text<br></span>
<span style=3D"font-family:monospace">public static string </span><span sty=
le=3D"font-family:monospace">custom_padding</span><span style=3D"font-famil=
y:monospace">(string plain_text)<br>{<br></span>=C2=A0=C2=A0 <span style=3D=
"font-family:monospace">Random rnd =3D new Random();<br>=C2=A0 int custom_p=
adding_size_left =3D rnd.Next(10, 100);<br></span><span style=3D"font-famil=
y:monospace">=C2=A0 int custom_padding_size_right =3D </span>
<span style=3D"font-family:monospace"> rnd.Next(10, 100);</span>

<br>=C2=A0=C2=A0 <span style=3D"font-family:monospace">string custom_paddin=
g_left =3D=C2=A0</span>
<span style=3D"font-family:monospace">rnd_simple</span><span style=3D"font-=
family:monospace">(custom_padding_size_left);<br></span>=C2=A0=C2=A0 <span =
style=3D"font-family:monospace">string custom_padding_right =3D </span>
<span style=3D"font-family:monospace">rnd_simple</span><span style=3D"font-=
family:monospace">(</span><span style=3D"font-family:monospace">custom_padd=
ing_size_right</span><span style=3D"font-family:monospace">);</span>

<br><div></div><div><br></div><div></div><span style=3D"font-family:monospa=
ce">=C2=A0 string plain_text_with_custom_padding =3D custom_padding_left + =
&quot;|&quot; + plain_text + &quot;|&quot; + custom_padding_right;<br></spa=
n><div><span style=3D"font-family:monospace">}<br></span></div><div><span s=
tyle=3D"font-family:monospace">// END: add custom-padding to the plain_text=
</span></div><div><span style=3D"font-family:monospace"></span></div><div><=
span style=3D"font-family:monospace"></span></div><div>
<span style=3D"font-family:monospace"><br></span></div><div><span style=3D"=
font-family:monospace">// BGN: generate random string for custom-padding<br=
></span>

<span style=3D"font-family:monospace">public static string rnd_simple(int s=
ize)<br>{<br>=C2=A0 var chars =3D &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi=
jklmnopqrstuvwxyz0123456789&quot;;<br>=C2=A0 var stringChars =3D new char[s=
ize];<br>=C2=A0 var random =3D new Random();<br><br>=C2=A0 for (int i =3D 0=
; i &lt; stringChars.Length; i++)<br>=C2=A0 {<br>=C2=A0 =C2=A0 stringChars[=
i] =3D chars[random.Next(chars.Length)];<br>=C2=A0 }<br><br>=C2=A0 var fina=
lString =3D new String(stringChars);<br>=C2=A0 return finalString;<br>}<br>=
</span></div><div>

<span style=3D"font-family:monospace">// END: generate random string for cu=
stom-padding<br></span>

<span style=3D"font-family:monospace"></span>

</div><div><span style=3D"font-family:verdana,sans-serif"><br></span></div>=
<span style=3D"font-family:verdana,sans-serif"><br></span></div>after<span =
style=3D"font-family:verdana,sans-serif"> the decryption phase, the added &=
quot;custom-padding&quot; phrases could get clear by addressing those verti=
cal bars (|). so, because of the benefits I could see in this approach with=
 many cryptographic algorithms (including
<span class=3D"gmail-comments-comment-item__main-content gmail-feed-shared-=
main-content--comment gmail-t-14 gmail-t-black gmail-t-normal"><span dir=3D=
"ltr">RFC-8452</span></span>), just decided to send this idea to the respec=
ted members of IETF for more evaluation and suggestions.<br></span><div><di=
v><span class=3D"gmail-comments-comment-item__main-content gmail-feed-share=
d-main-content--comment gmail-t-14 gmail-t-black gmail-t-normal" style=3D"f=
ont-family:verdana,sans-serif"><span dir=3D"ltr"><br></span></span></div><d=
iv><span class=3D"gmail-comments-comment-item__main-content gmail-feed-shar=
ed-main-content--comment gmail-t-14 gmail-t-black gmail-t-normal" style=3D"=
font-family:verdana,sans-serif"><span dir=3D"ltr">any feedback welcome,<br>=
</span></span></div><div><span class=3D"gmail-comments-comment-item__main-c=
ontent gmail-feed-shared-main-content--comment gmail-t-14 gmail-t-black gma=
il-t-normal" style=3D"font-family:verdana,sans-serif"><span dir=3D"ltr">--s=
hahiN Noursalehi</span></span><span class=3D"gmail-comments-comment-item__m=
ain-content gmail-feed-shared-main-content--comment gmail-t-14 gmail-t-blac=
k gmail-t-normal" style=3D"font-family:verdana,sans-serif"><span dir=3D"ltr=
"><br></span></span></div>

</div></div>

--000000000000a3dd1a0603bbe4a7--

