relay: re-TreeConnect IPC$ in RemoteRegistry restore#20
Merged
Conversation
After a successful relay samdump/secretsdump the deferred
restoreRemoteRegistryState tried to CreatePipe("svcctl") and got
STATUS_OBJECT_NAME_NOT_FOUND (0xc0000034). The attack downloads its
hives from ADMIN$ before returning, which switches the SMB session's
tree away from IPC$, and svcctl lives on IPC$.
Fixed by re-TreeConnect'ing to IPC$ at the top of
restoreRemoteRegistryState. The function is now tree-state-agnostic
and safe to invoke from any defer position without coupling to the
attack's tree management.
Verified live against GOAD srv02 with RemoteRegistry set to
Stopped+Manual and eddard.stark relayed via net use: attack
auto-starts the service, dumps SAM hashes, then cleanup stops the
service and srv02's final state is Stopped+Manual again (was
Running+Manual before this fix).
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.
Summary
Follow-up to #19. After a successful relay samdump/secretsdump the deferred
restoreRemoteRegistryStatewas callingCreatePipe("svcctl")and gettingSTATUS_OBJECT_NAME_NOT_FOUND (0xc0000034). The attack downloads its hives fromADMIN$before returning, which switches the SMB session's tree away fromIPC$, and svcctl lives onIPC$.Fixed by re-TreeConnect'ing to
IPC$at the top ofrestoreRemoteRegistryState. The function is now tree-state-agnostic and safe to invoke from any defer position without coupling to the attack's tree management.Test plan
go build ./...cleango vet ./...cleango test ./...passesRemoteRegistryto Stopped+Manual, relayed eddard.stark vianet use, watched:Stopped Manual(wasRunning Manualbefore this fix — service was left running)