Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add windows memory search support #18585

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ def search(needles, min_search_len = 5, match_len = 500)
request = Packet.create_request(COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_SEARCH)

request.add_tlv(TLV_TYPE_PID, process.pid)
needles.each { | needle | request.add_tlv(TLV_TYPE_MEMORY_SEARCH_NEEDLE, needle) }
needles.each do | needle |
request.add_tlv(TLV_TYPE_MEMORY_SEARCH_NEEDLE, needle)
request.add_tlv(TLV_TYPE_MEMORY_SEARCH_NEEDLE_LEN, needle.bytesize)
Copy link
Contributor

@adfoster-r7 adfoster-r7 Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems odd that we need this additional information, when the length value is already baked into the TLV itself (Type Length Value)

I wonder if this is being added as a workaround for your current Meterpreter implementation? 🤔

end
request.add_tlv(TLV_TYPE_MEMORY_SEARCH_MATCH_LEN, match_len)
request.add_tlv(TLV_TYPE_UINT, min_search_len)

Expand Down
1 change: 1 addition & 0 deletions lib/rex/post/meterpreter/extensions/stdapi/tlv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ module Stdapi
TLV_TYPE_MEMORY_SEARCH_SECT_LEN = TLV_META_TYPE_QWORD | 2654
TLV_TYPE_MEMORY_SEARCH_MATCH_ADDR = TLV_META_TYPE_QWORD | 2655
TLV_TYPE_MEMORY_SEARCH_MATCH_STR = TLV_META_TYPE_STRING | 2656
TLV_TYPE_MEMORY_SEARCH_NEEDLE_LEN = TLV_META_TYPE_UINT | 2657

##
#
Expand Down