lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070307231249.GQ10574@sequoia.sous-sol.org>
Date:	Wed, 7 Mar 2007 15:12:49 -0800
From:	Chris Wright <chrisw@...s-sol.org>
To:	linux-kernel@...r.kernel.org, stable@...nel.org
Cc:	"Theodore Ts'o" <tytso@....edu>,
	Zwane Mwaikambo <zwane@....linux.org.uk>,
	Justin Forbes <jmforbes@...uxtx.org>,
	Chris Wedgwood <reviews@...cw.f00f.org>,
	Randy Dunlap <rdunlap@...otime.net>,
	Michael Krufky <mkrufky@...uxtv.org>,
	Chuck Ebbert <cebbert@...hat.com>,
	Dave Jones <davej@...hat.com>,
	Chuck Wolber <chuckw@...ntumlinux.com>,
	akpm@...ux-foundation.org, torvalds@...ux-foundation.org,
	alan@...rguk.ukuu.org.uk, Marcel Holtmann <marcel@...tmann.org>,
	Don Howard <dhoward@...hat.com>,
	Harald Welte <laforge@...monks.org>
Subject: [patch 103/101] Fix buffer overflow in Omnikey CardMan 4040 driver (CVE-2007-0005)

From: Marcel Holtmann <marcel@...tmann.org>

Based on a patch from Don Howard <dhoward@...hat.com>

When calling write() with a buffer larger than 512 bytes, the
driver's write buffer overflows, allowing to overwrite the EIP and
execute arbitrary code with kernel privileges.

In read(), there exists a similar problem, but coming from the device.
A malicous or buggy device sending more than 512 bytes can overflow
of the driver's read buffer, with the same effects as above.

Signed-off-by: Marcel Holtmann <marcel@...tmann.org>
Signed-off-by: Harald Welte <laforge@...monks.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Chris Wright <chrisw@...s-sol.org>
---
 drivers/char/pcmcia/cm4040_cs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- linux-2.6.20.1.orig/drivers/char/pcmcia/cm4040_cs.c
+++ linux-2.6.20.1/drivers/char/pcmcia/cm4040_cs.c
@@ -273,6 +273,7 @@ static ssize_t cm4040_read(struct file *
 	DEBUGP(6, dev, "BytesToRead=%lu\n", bytes_to_read);
 
 	min_bytes_to_read = min(count, bytes_to_read + 5);
+	min_bytes_to_read = min_t(size_t, min_bytes_to_read, READ_WRITE_BUFFER_SIZE);
 
 	DEBUGP(6, dev, "Min=%lu\n", min_bytes_to_read);
 
@@ -340,7 +341,7 @@ static ssize_t cm4040_write(struct file 
 		return 0;
 	}
 
-	if (count < 5) {
+	if ((count < 5) || (count > READ_WRITE_BUFFER_SIZE)) {
 		DEBUGP(2, dev, "<- cm4040_write buffersize=%Zd < 5\n", count);
 		return -EIO;
 	}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ