All of lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: fw@strlen.de, gregkh@linuxfoundation.org, pablo@netfilter.org
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "netfilter: x_tables: check standard target size too" has been added to the 3.14-stable tree
Date: Wed, 22 Jun 2016 15:25:45 -0700	[thread overview]
Message-ID: <14666343451514@kroah.com> (raw)


This is a note to let you know that I've just added the patch titled

    netfilter: x_tables: check standard target size too

to the 3.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     netfilter-x_tables-check-standard-target-size-too.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 7ed2abddd20cf8f6bd27f65bd218f26fa5bf7f44 Mon Sep 17 00:00:00 2001
From: Florian Westphal <fw@strlen.de>
Date: Fri, 1 Apr 2016 14:17:27 +0200
Subject: netfilter: x_tables: check standard target size too

From: Florian Westphal <fw@strlen.de>

commit 7ed2abddd20cf8f6bd27f65bd218f26fa5bf7f44 upstream.

We have targets and standard targets -- the latter carries a verdict.

The ip/ip6tables validation functions will access t->verdict for the
standard targets to fetch the jump offset or verdict for chainloop
detection, but this happens before the targets get checked/validated.

Thus we also need to check for verdict presence here, else t->verdict
can point right after a blob.

Spotted with UBSAN while testing malformed blobs.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/netfilter/x_tables.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -559,6 +559,13 @@ int xt_compat_match_to_user(const struct
 }
 EXPORT_SYMBOL_GPL(xt_compat_match_to_user);
 
+/* non-compat version may have padding after verdict */
+struct compat_xt_standard_target {
+	struct compat_xt_entry_target t;
+	compat_uint_t verdict;
+};
+
+/* see xt_check_entry_offsets */
 int xt_compat_check_entry_offsets(const void *base,
 				  unsigned int target_offset,
 				  unsigned int next_offset)
@@ -576,6 +583,10 @@ int xt_compat_check_entry_offsets(const
 	if (target_offset + t->u.target_size > next_offset)
 		return -EINVAL;
 
+	if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 &&
+	    target_offset + sizeof(struct compat_xt_standard_target) != next_offset)
+		return -EINVAL;
+
 	return 0;
 }
 EXPORT_SYMBOL(xt_compat_check_entry_offsets);
@@ -615,6 +626,10 @@ int xt_check_entry_offsets(const void *b
 	if (target_offset + t->u.target_size > next_offset)
 		return -EINVAL;
 
+	if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 &&
+	    target_offset + sizeof(struct xt_standard_target) != next_offset)
+		return -EINVAL;
+
 	return 0;
 }
 EXPORT_SYMBOL(xt_check_entry_offsets);


Patches currently in stable-queue which might be from fw@strlen.de are

queue-3.14/netfilter-x_tables-add-and-use-xt_check_entry_offsets.patch
queue-3.14/netfilter-x_tables-assert-minimum-target-size.patch
queue-3.14/netfilter-x_tables-add-compat-version-of-xt_check_entry_offsets.patch
queue-3.14/netfilter-x_tables-check-for-bogus-target-offset.patch
queue-3.14/netfilter-x_tables-validate-e-target_offset-early.patch
queue-3.14/netfilter-x_tables-validate-targets-of-jumps.patch
queue-3.14/netfilter-x_tables-don-t-move-to-non-existent-next-rule.patch
queue-3.14/netfilter-x_tables-kill-check_entry-helper.patch
queue-3.14/netfilter-x_tables-make-sure-e-next_offset-covers-remaining-blob-size.patch
queue-3.14/netfilter-x_tables-check-standard-target-size-too.patch
queue-3.14/netfilter-x_tables-validate-all-offsets-and-sizes-in-a-rule.patch
queue-3.14/netfilter-x_tables-don-t-reject-valid-target-size-on-some-architectures.patch
queue-3.14/netfilter-x_tables-fix-unconditional-helper.patch

                 reply	other threads:[~2016-06-22 22:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14666343451514@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=fw@strlen.de \
    --cc=pablo@netfilter.org \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.