mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: vegard.nossum@oracle.com
To: linux-kernel@vger.kernel.org
Cc: Vegard Nossum <vegard.nossum@oracle.com>
Subject: [PATCH 2/9] exploit: report to audit subsystem when available
Date: Thu, 12 Dec 2013 17:52:25 +0100	[thread overview]
Message-ID: <1386867152-24072-2-git-send-email-vegard.nossum@oracle.com> (raw)
In-Reply-To: <1386867152-24072-1-git-send-email-vegard.nossum@oracle.com>

From: Vegard Nossum <vegard.nossum@oracle.com>

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 include/uapi/linux/audit.h |    1 +
 security/exploit.c         |   16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 75cef3f..65811d4 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -131,6 +131,7 @@
 #define AUDIT_ANOM_PROMISCUOUS      1700 /* Device changed promiscuous mode */
 #define AUDIT_ANOM_ABEND            1701 /* Process ended abnormally */
 #define AUDIT_ANOM_LINK		    1702 /* Suspicious use of file links */
+#define AUDIT_ANOM_EXPLOIT          1703 /* Known exploit attempt */
 #define AUDIT_INTEGRITY_DATA	    1800 /* Data integrity verification */
 #define AUDIT_INTEGRITY_METADATA    1801 /* Metadata integrity verification */
 #define AUDIT_INTEGRITY_STATUS	    1802 /* Integrity enable status */
diff --git a/security/exploit.c b/security/exploit.c
index a732613..3d8ee5b 100644
--- a/security/exploit.c
+++ b/security/exploit.c
@@ -1,3 +1,4 @@
+#include <linux/audit.h>
 #include <linux/cred.h>
 #include <linux/exploit.h>
 #include <linux/printk.h>
@@ -19,9 +20,24 @@ void _exploit(const char *id)
 	pid_t pid = task_pid_nr(task);
 	uid_t uid = from_kuid(&init_user_ns, current_uid());
 	char comm[sizeof(task->comm)];
+#ifdef CONFIG_AUDIT
+	struct audit_buffer *ab;
+#endif
 
 	get_task_comm(comm, task);
 
+#ifdef CONFIG_AUDIT
+	ab = audit_log_start(NULL, GFP_ATOMIC, AUDIT_ANOM_EXPLOIT);
+	if (ab) {
+		audit_log_format(ab, "exploit id=%s pid=%u uid=%u auid=%u ses=%u comm=",
+			id, pid, uid,
+			from_kuid(&init_user_ns, audit_get_loginuid(task)),
+			audit_get_sessionid(task));
+		audit_log_untrustedstring(ab, comm);
+		audit_log_end(ab);
+	}
+#endif
+
 	pr_warn_ratelimited("warning: possible %s exploit attempt by pid=%u uid=%u comm=%s\n",
 		id, pid, uid, comm);
 }
-- 
1.7.10.4


  reply	other threads:[~2013-12-12 16:54 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-12 16:52 [PATCH 1/9] Known exploit detection vegard.nossum
2013-12-12 16:52 ` vegard.nossum [this message]
2013-12-12 16:52 ` [PATCH 3/9] hfs: Known exploit detection for CVE-2011-4330 vegard.nossum
2013-12-13  8:00   ` Dan Carpenter
2013-12-12 16:52 ` [PATCH 4/9] net: Known exploit detection for CVE-2012-2136 vegard.nossum
2013-12-12 16:52 ` [PATCH 5/9] hfsplus: Known exploit detection for CVE-2012-2319 vegard.nossum
2013-12-13  1:40   ` Greg Kroah-Hartman
2013-12-13 11:14   ` One Thousand Gnomes
2013-12-12 16:52 ` [PATCH 6/9] x86: Known exploit detection for CVE-2013-0268 vegard.nossum
2013-12-12 16:52 ` [PATCH 7/9] drm/i915: Known exploit detection for CVE-2013-0913 vegard.nossum
2013-12-12 16:52 ` [PATCH 8/9] userns: Known exploit detection for CVE-2013-1959 vegard.nossum
2013-12-12 16:52 ` [PATCH 9/9] perf: Known exploit detection for CVE-2013-2094 vegard.nossum
2013-12-12 19:06 ` [PATCH 1/9] Known exploit detection Theodore Ts'o
2013-12-12 21:13   ` Kees Cook
2013-12-12 23:50     ` Ryan Mallon
2013-12-12 23:55       ` Kees Cook
2013-12-13 11:10         ` One Thousand Gnomes
2013-12-13 14:21           ` Jiri Kosina
2013-12-13  9:20       ` Vegard Nossum
2013-12-13 22:49         ` Ryan Mallon
2013-12-13 13:06       ` Ingo Molnar
2013-12-13 15:55         ` Jason Cooper
2013-12-13 23:07         ` Ryan Mallon
2013-12-13  0:25     ` Dave Jones
2013-12-13  0:45       ` Andy Lutomirski
2013-12-13  1:42       ` Greg Kroah-Hartman
2013-12-13  1:44         ` Dave Jones
2013-12-13  5:09         ` James Morris
2013-12-13  5:46           ` Theodore Ts'o
2013-12-13 13:19             ` Ingo Molnar
2013-12-13 10:21           ` Vegard Nossum
2013-12-13 10:31         ` Alexander Holler
2013-12-13 11:48           ` Dan Carpenter
2013-12-13 11:57             ` Greg Kroah-Hartman
2013-12-13 13:23             ` Ingo Molnar
2013-12-13 18:00               ` Kees Cook
2013-12-13 17:58         ` Kees Cook
2013-12-13 18:14           ` Linus Torvalds
2013-12-13 18:37             ` Kees Cook
2013-12-13  5:27     ` Theodore Ts'o
2013-12-13  9:32       ` Jiri Kosina
2013-12-13 18:07       ` Kees Cook
2013-12-13  9:12     ` Vegard Nossum
2013-12-13 13:27       ` Ingo Molnar
2013-12-13  8:20   ` Vegard Nossum
2013-12-14 23:59   ` Ryan Mallon
2013-12-13 12:54 ` Ingo Molnar
2013-12-16  5:17 ` Sasha Levin
2013-12-19  6:14 ` David Rientjes

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=1386867152-24072-2-git-send-email-vegard.nossum@oracle.com \
    --to=vegard.nossum@oracle.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®