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

Remove hardcoded blockapi hashes and ASM Blockapi #19609

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

dledda-r7
Copy link
Contributor

@dledda-r7 dledda-r7 commented Nov 1, 2024

This PR removes some old hardcoded block-api hashes and update some block api assembly block using the dedicated mixin.

Verification

  • for each module ensure the generated hash is the same of the hardcoded one
  • I quickly added a print(combined_asm) inside the generate_<payload> function and checked for the hashes
  • You can use any other way to check that such as objdump of the PE before and after

@dledda-r7 dledda-r7 marked this pull request as draft November 1, 2024 10:08
@dledda-r7 dledda-r7 self-assigned this Nov 19, 2024
Copy link
Contributor Author

@dledda-r7 dledda-r7 Nov 19, 2024

Choose a reason for hiding this comment

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

Not able to do generate here fixed

@dledda-r7 dledda-r7 marked this pull request as ready for review November 20, 2024 08:07
@dledda-r7 dledda-r7 changed the title WIP: Remove hardcoded blockapi hashes and ASM Blockapi Remove hardcoded blockapi hashes and ASM Blockapi Nov 20, 2024
@dledda-r7 dledda-r7 marked this pull request as draft November 21, 2024 18:52
@dledda-r7 dledda-r7 self-assigned this Nov 21, 2024
@dledda-r7
Copy link
Contributor Author

Re-Drafting as I need to work on some more hard-coded thing which I hoped I would be able to bypass.

@dledda-r7 dledda-r7 force-pushed the remove-hardcoded-blockapi-hash branch from 8e6bcb3 to eb58072 Compare November 26, 2024 17:07
@dledda-r7 dledda-r7 marked this pull request as ready for review November 27, 2024 13:25
@dledda-r7 dledda-r7 removed their assignment Nov 27, 2024
@dledda-r7 dledda-r7 added payload code quality Improving code quality labels Nov 27, 2024
@smcintyre-r7 smcintyre-r7 self-assigned this Nov 27, 2024
Copy link
Contributor

@smcintyre-r7 smcintyre-r7 left a comment

Choose a reason for hiding this comment

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

I think you missed:

Generally speaking in the future when you edit a line like the following, it would clean things up a bit to remove the comment since it's now redundant with the source code. I wouldn't bother going back and deleting all of these comments, but as you continue to make changes, and it's convenient, I'd drop them.

push #{Rex::Text.block_api_hash("kernel32.dll", "VirtualAllocEx")} ; hash( "kernel32.dll", "VirtualAllocEx" )

Also, would you mind making a list of modules that have had non-trivial changes that should be tested? Any module that was previously hard coding the block API should probably get a quick test to ensure that it's still working. Adding them as checklist items to the PR description would be great. I can get started going through those next week after the two I found that were missing updates are addressed as well.

@dledda-r7
Copy link
Contributor Author

I think you missed:

Generally speaking in the future when you edit a line like the following, it would clean things up a bit to remove the comment since it's now redundant with the source code. I wouldn't bother going back and deleting all of these comments, but as you continue to make changes, and it's convenient, I'd drop them.

push #{Rex::Text.block_api_hash("kernel32.dll", "VirtualAllocEx")} ; hash( "kernel32.dll", "VirtualAllocEx" )

Also, would you mind making a list of modules that have had non-trivial changes that should be tested? Any module that was previously hard coding the block API should probably get a quick test to ensure that it's still working. Adding them as checklist items to the PR description would be great. I can get started going through those next week after the two I found that were missing updates are addressed as well.

Good catch with the reverse_tcp_dns, I think the reverse_https_proxy need to be rewritten. working on that.

@dledda-r7
Copy link
Contributor Author

So I re-wrote the reverse_https_proxy. but something in framework changed and we are not getting the second stage anymore, we are getting HTML with It Works so the payload is allocating that and jumping into it. Probably something some changes in the ReverseHttp handler...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Improving code quality payload
Projects
Status: Waiting on Contributor
Development

Successfully merging this pull request may close these issues.

2 participants