From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161514AbdEWUtH (ORCPT ); Tue, 23 May 2017 16:49:07 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:32879 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1161475AbdEWUtC (ORCPT ); Tue, 23 May 2017 16:49:02 -0400 Subject: Re: [Linux-ima-devel] [PATCH 0/7] IMA: new parser for ima_restore_measurement_list() To: linux-ima-devel@lists.sourceforge.net Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org References: <20170516125347.10574-1-roberto.sassu@huawei.com> <4f5bc289-92cb-1ce2-4496-387efbb11769@linux.vnet.ibm.com> <42b629dd-0d1f-b066-03e4-c013d0891ba7@huawei.com> <4b536b04-0e61-aea4-fc27-8dd12f2e3a1b@linux.vnet.ibm.com> <3b204e09-c1c0-b3bc-90fe-a8dfb86baadc@huawei.com> From: Ken Goldman Date: Tue, 23 May 2017 16:48:44 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <3b204e09-c1c0-b3bc-90fe-a8dfb86baadc@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17052320-8235-0000-0000-00000B8EE563 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007107; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00864636; UDB=6.00429243; IPR=6.00644417; BA=6.00005369; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015555; XFM=3.00000015; UTC=2017-05-23 20:48:45 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052320-8236-0000-0000-00003BF11922 Message-Id: <08bd9fcb-d3ba-e76e-928e-f569e8a4be74@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-23_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705230104 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/18/2017 5:38 AM, Roberto Sassu wrote: > On 5/17/2017 6:28 PM, Ken Goldman wrote: >> On 5/17/2017 3:25 AM, Roberto Sassu wrote: >>> >>> The format of digestN is: :\0, the same used >>> for the file digest. >> >> Since the format is changing from the SHA-1 log format anyway ... >> >> How do people feel about the colon and null terminated string format for >> algorithm identifiers? >> >> The TCG standard enumerations are uint16_t, and there is a registry of >> hash algorithms. >> >> As a consuming parser, it feels nice to know it's always 2 bytes and not >> have to worry about a missing colon or a missing nul terminator risking >> a buffer overflow. > > There cannot be buffer overflow, because the length of each digest > field is known. > > Roberto > I was not referring to the digest, but the digest algorithm. I wanted opinions on the colon and null terminated string format for algorithm identifiers. The TCG standard log uses the TCG standard enumerations. They're always exactly 2 bytes. Parsing is trivial. If IMA uses strings, the attacker can send, e.g., sha1: and not null terminate it. A careful parser can go a byte at a time until it reaches a maximum length - if you specify a maximum length. But it is an attack surface. Is there a corresponding advantage?