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

Update the theme hijack exploit #2

Conversation

zeroSteiner
Copy link

This fixes the issues with exploiting the TOCTOU issue.

I fixed the over arching issue by addressing them as two smaller issues.

First it was necessary to identify, when the payload DLL vs the signed DLL should be sent. This was achieved by implementing the hooks provided in rapid7/ruby_smb#256. This allows the callback hook to be invoked when a create request is received so that it can be inspected. I know the original vulnerability mentioned using the share access == 5, but on further inspection I think checking the desired_access.execute is a more intuitive and equally reliable indicator. This solves the problem of when one DLL should be used vs another which brings us to the second problem.

The second problem was how to switch the content of a DLL file after the TreeConnect request is received. VirtualDynamicFiles are generated and converted to VirtualStaticFiles when the TreeConnect request is received (in english this is when the share is opened). This takes place so the file object can be stat'ed to obtain information necessary for a directory listing, prior to the file being opened. In instead opted to inline a subclass of the VirtualStaticFile that maintains a separate content on a per-thread basis. Client connections are handled in a dedicated thread, so keeping things isolated to their threads should address any issues that could occur if multiple client systems opened the exploit file at the same time. The exploit tracks an instance of the Thread-Localized version of the virtual static file, and uses the previously mentioned hooks to set the content as desired.

bwatters-r7 pushed a commit that referenced this pull request Nov 13, 2023
@bwatters-r7 bwatters-r7 merged commit 81ec3d0 into bwatters-r7:exploit/cve-2023-38146 Nov 13, 2023
32 checks passed
bwatters-r7 pushed a commit that referenced this pull request Aug 21, 2024
bwatters-r7 pushed a commit that referenced this pull request Dec 5, 2024
Stage cmd payloads to a file before executing
bwatters-r7 pushed a commit that referenced this pull request Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants