From patchwork Mon Nov 11 18:29:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Kuster X-Patchwork-Id: 179099 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7021636ilf; Mon, 11 Nov 2019 10:30:38 -0800 (PST) X-Google-Smtp-Source: APXvYqymu3xj0SiL/TT35ZXAlWEiSvX/iGfL4PRfKxFOIpYFW8mrg8c5iObhpuybv/N0hqvlwyCS X-Received: by 2002:a63:712:: with SMTP id 18mr20011224pgh.384.1573497038261; Mon, 11 Nov 2019 10:30:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573497038; cv=none; d=google.com; s=arc-20160816; b=aN6miMyOPcLIWr8aAh6ORSjZElOWfK/LOCmY4JIyuVyo3AgfocMbd+TSIdlMNdExfu FHE8QSjCQqGg2v98yz0pFfBFyufdR2ubtQDLSo8LZaYmrIDvQB+8WsUny0l7NFaEi9eI qP8caYKu4/rGZYY0IG88DJB0bm5YLylSE48OdHUHhtYWF8UjS7MrENWzOeD1vPWOnoPP DranaFVPGo1WsjVzWUd+fSuQux4EnV/i+mCX32pgQteDVdVrSH4tc1JgJq9Tg6l3iMea adYksPc2Cs4n+dSJc+hWENI7ALArna281myb9Yl+0z2BECkT/aGJsgABmgnoaC/9wOd8 skfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=HPKDPV/HZkG4TIJKQ1rYxb8rLxc1jVAm7OI+aGMyMho=; b=oj3r+8LpP7I4dl6moF95iJXoX3Fl7WniBRMDWgJ/Kba9znTvM4DfXN7ZuKcsquMeBQ DPJ94qjooghWh77u5gKiG8GzTjFwVQlyAXZFBEd9TBbtUWJRKKNLAK1QpCYUG1jc3eyX YjUv3BBOK0ZGQnDulrknpxA3fkBtCGlBHX/jUyXrveNMlh7L8JBXwSO0UCqyOO6+DtKy LDOiCMxaRifEedsKkJnsbAfyoIJb8OgJaY6u0y2gUR7AcgbBYx+2u42yaxF9fOC34FYV TSFE6CIqxNFjAEX4fgU49iHTDfeuggCC2Wg0q6zWGtRD09uHWpkPRlDaArFc/L5zeQSe SnHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=ZIIQbb+6; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id ck13si227698pjb.90.2019.11.11.10.30.37; Mon, 11 Nov 2019 10:30:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=ZIIQbb+6; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ec2-34-214-78-129.us-west-2.compute.amazonaws.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 22CC87FC0C; Mon, 11 Nov 2019 18:30:23 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by mail.openembedded.org (Postfix) with ESMTP id D78AA7FA48 for ; Mon, 11 Nov 2019 18:30:10 +0000 (UTC) Received: by mail-pl1-f173.google.com with SMTP id o9so8121011plk.6 for ; Mon, 11 Nov 2019 10:30:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=Veb47STQy06JyrRpRrtcJzVXh/pb7PA3d6emSS2vUrE=; b=ZIIQbb+64vb2wQrZYvcjTy/9pUB6jctLAWcPE7Gs5EGt5p3917A2LXgKIXQ1ToXkA3 6PaS1Y/Ndn1jwZbq+tHx0YBJAbcQrkwaSmKIW7fKP1HfkjfvDi1rNG0el56Hnf0tEWSs MYxh3kf6y8FJ4DskzXapv1+/m8fEBWq1SUg7p2MNdjMAZBAbqHBCC/8SDeAEVFgSIO2M mn7n2wrxOvoIDjwcVWGTUO2iK+D/5jDOrbKuiMSCb+7BQ6MIS4XVUOS6BdC/wKoogfEo A2G1+aabXDim4w+lsLNiegAhzeY2umu1gVJ2RVy1AT3LLq213SYXZ+rC4RvdoCOib+U6 mOFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Veb47STQy06JyrRpRrtcJzVXh/pb7PA3d6emSS2vUrE=; b=tQg2Hfw6MAK0CS7/luyTGYsNWYDmVt/HjeSiZ2Ku94nFEre/wiAE3qguKcNGB8OUto RPI6nWRadI4vZlDPS6oY+U6uqj83GlP6UZs0CwDRGFyqpJe+VDwSDbxr0qyOZEe+z1wQ JF80CFvHjJY/eObAhlY3asDnl5i1nBLjqTyhrsRf5xiTnzsiTSt1e+CobAs2PEq3eVLC Kt4DPB0pTTbOgoJxy0Xd1uvBi/7FrbUD9kodHXYVOkMMOfmrZBOgj+3Xr1YdkTr3DMWy 8CUU1gFn5Z19mChWRZTkQ4mqBBonQpy/5lXd4DZarhHPXegzGgiG9UTM33oOFm4G1Ptn FjVA== X-Gm-Message-State: APjAAAVx4xJ4Zxq2ERFkE5kJUPwOSvJD99L+gpsYczlDT/73G5QQ3TU/ gtHt1c17oJHp6euMdltc0EPMyhxi X-Received: by 2002:a17:902:b702:: with SMTP id d2mr716984pls.104.1573497010723; Mon, 11 Nov 2019 10:30:10 -0800 (PST) Received: from akuster-ThinkPad-T460s.mvista.com ([2601:202:4180:a5c0:604a:b703:29ca:5c7d]) by smtp.gmail.com with ESMTPSA id l62sm17731698pgl.24.2019.11.11.10.30.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Nov 2019 10:30:10 -0800 (PST) From: Armin Kuster To: openembedded-core@lists.openembedded.org Date: Mon, 11 Nov 2019 10:29:44 -0800 Message-Id: <2435c38e109cac68476ee672eca09b4cd6237ed4.1573496794.git.akuster808@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Subject: [OE-core] [zeus 02/21] file: fix CVE-2019-18218 X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org From: Ross Burton Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster --- .../file/file/CVE-2019-18218.patch | 55 ++++++++++++++++++++++ meta/recipes-devtools/file/file_5.37.bb | 3 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/file/file/CVE-2019-18218.patch -- 2.7.4 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/recipes-devtools/file/file/CVE-2019-18218.patch b/meta/recipes-devtools/file/file/CVE-2019-18218.patch new file mode 100644 index 0000000..3d02c5a --- /dev/null +++ b/meta/recipes-devtools/file/file/CVE-2019-18218.patch @@ -0,0 +1,55 @@ +cdf_read_property_info in cdf.c in file through 5.37 does not restrict the +number of CDF_VECTOR elements, which allows a heap-based buffer overflow (4-byte +out-of-bounds write). + +CVE: CVE-2019-18218 +Upstream-Status: Backport +Signed-off-by: Ross Burton + +From 46a8443f76cec4b41ec736eca396984c74664f84 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Mon, 26 Aug 2019 14:31:39 +0000 +Subject: [PATCH] Limit the number of elements in a vector (found by oss-fuzz) + +--- + src/cdf.c | 9 ++++----- + src/cdf.h | 1 + + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/cdf.c b/src/cdf.c +index 9d6396742..bb81d6374 100644 +--- a/src/cdf.c ++++ b/src/cdf.c +@@ -1016,8 +1016,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h, + goto out; + } + nelements = CDF_GETUINT32(q, 1); +- if (nelements == 0) { +- DPRINTF(("CDF_VECTOR with nelements == 0\n")); ++ if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) { ++ DPRINTF(("CDF_VECTOR with nelements == %" ++ SIZE_T_FORMAT "u\n", nelements)); + goto out; + } + slen = 2; +@@ -1060,8 +1061,6 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h, + goto out; + inp += nelem; + } +- DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n", +- nelements)); + for (j = 0; j < nelements && i < sh.sh_properties; + j++, i++) + { +diff --git a/src/cdf.h b/src/cdf.h +index 2f7e554b7..05056668f 100644 +--- a/src/cdf.h ++++ b/src/cdf.h +@@ -48,6 +48,7 @@ + typedef int32_t cdf_secid_t; + + #define CDF_LOOP_LIMIT 10000 ++#define CDF_ELEMENT_LIMIT 100000 + + #define CDF_SECID_NULL 0 + #define CDF_SECID_FREE -1 diff --git a/meta/recipes-devtools/file/file_5.37.bb b/meta/recipes-devtools/file/file_5.37.bb index 6547d12..509b6ce 100644 --- a/meta/recipes-devtools/file/file_5.37.bb +++ b/meta/recipes-devtools/file/file_5.37.bb @@ -14,7 +14,8 @@ DEPENDS_class-native = "zlib-native" # Blacklist a bogus tag in upstream check UPSTREAM_CHECK_GITTAGREGEX = "FILE(?P(?!6_23).+)" -SRC_URI = "git://github.com/file/file.git" +SRC_URI = "git://github.com/file/file.git \ + file://CVE-2019-18218.patch" SRCREV = "a0d5b0e4e9f97d74a9911e95cedd579852e25398" S = "${WORKDIR}/git"