Add Windows Time Provider persistence module#21522
Open
M4nu02 wants to merge 2 commits into
Open
Conversation
Adds a new persistence module that registers a custom Time Provider DLL under the W32Time service registry key. The service loads the DLL at startup, providing persistence across reboots. Requires Administrator or SYSTEM privileges. Fixes rapid7#20825
jvoisin
reviewed
Jun 1, 2026
| 'Emanuele Cervelli', | ||
| ], | ||
| 'Platform' => [ 'win' ], | ||
| 'Arch' => [ARCH_X64, ARCH_X86], |
Contributor
There was a problem hiding this comment.
Isn't it arch-independent-ish? Windows runs on ARM as well now :)
Comment on lines
+150
to
+157
| stop_result = service_stop('W32Time') | ||
| start_result = service_start('W32Time') | ||
|
|
||
| if stop_result.zero? && start_result.zero? | ||
| print_good('W32Time service restarted successfully') | ||
| else | ||
| print_warning("Unable to restart W32Time cleanly (stop=#{stop_result}, start=#{start_result}).") | ||
| end |
Contributor
There was a problem hiding this comment.
lib/msf/core/post/windows/services.rb has a service_restart method
Contributor
Author
There was a problem hiding this comment.
That's good to know, thanks.
Refactor the W32Time persistence module to utilize the built-in Msf::Post::Windows::Services#service_restart method. This replaces the custom `restart_w32time` helper function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new persistence module that registers a custom Time Provider DLL under the W32Time service registry key. The service loads the DLL at startup, providing persistence across reboots. Requires Administrator or SYSTEM privileges.
Fixes #20825
Verification
msfconsoleuse exploit/windows/persistence/time_providerset SESSION [SESSION]runThe classic technique as described in several blogs only registers the DLL under W32Time, resulting in a LocalService shell. I modified the ObjectName registry key to LocalSystem, granting an immediate SYSTEM shell upon reboot and allowing the payload to execute reliably from any directory.