refactor(darwin): gate securityd gcore keychain dump behind keychain_gcore build tag - #629
Merged
moonD4rk merged 3 commits intoAug 7, 2026
Conversation
…gcore build tag Mirror the abe_embed treatment of the Windows ABE payload (moonD4rk#575) for the macOS CVE-2025-24204 securityd-dump path: retag gcoredump_darwin.go under 'darwin && keychain_gcore' and add a 'darwin && !keychain_gcore' stub for DecryptKeychainRecords. The default go build (and library consumers) then ship without the exploit code or its byte signatures; the capability is opt-in via -tags keychain_gcore, exactly like -tags abe_embed. GcoredumpRetriever already treats a DecryptKeychainRecords error as a silent fallthrough to the next tier, so the default build falls through to the native security-CLI path with no behavior change.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #629 +/- ##
=======================================
Coverage 73.12% 73.12%
=======================================
Files 69 69
Lines 3215 3215
=======================================
Hits 2351 2351
Misses 640 640
Partials 224 224
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
moonD4rk
self-requested a review
August 7, 2026 02:20
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
Mirrors the
abe_embedtreatment of the Windows ABE payload (#575) for the macOSCVE-2025-24204 securityd-dump path, so the sensitive code is opt-in at build time
instead of always compiled into every darwin binary.
masterkey/gcoredump_darwin.gofrom//go:build darwinto//go:build darwin && keychain_gcore. All of the gcore/vmmap/Mach-O scanningcode, plus its helpers (
findProcessByName,scanMasterKeyCandidates,findMallocSmallRegions,getMallocSmallRegionData,addressRange,byteSliceToString,homeDir/loginKeychainPath) is used only in this file,so it moves under the tag cleanly.
masterkey/gcoredump_stub_darwin.go(//go:build darwin && !keychain_gcore)providing
DecryptKeychainRecords()that returns an error — same stub/real splitas
crypto/windows/payload/{stub,embed}_windows.go.GcoredumpRetriever(struct +RetrieveKey) stays unconditional inretriever_darwin.go; its single caller ofDecryptKeychainRecords()already treatsany error as a silent fallthrough to the next tier (the "needs root" case), so the
default build just falls through to
KeychainPasswordRetriever/SecurityCmdRetrieverexactly as a non-root run does today. No behavior change forthe native-Keychain path.
Why
The securityd-dump code (byte-scanning
securitydmemory via agcorecore dump)is the part of the darwin build that gets flagged in security audits and antivirus
scans (cf. the recurring reports #623, #497, #469). It only helps a
rootcaller,which is a rare path. Making it opt-in via
-tags keychain_gcoremeans the defaultgo build ./...— and anything importing HackBrowserData as a library — shipswithout the exploit code or its identifying strings, while release/CLI users who want
it opt in exactly like
-tags abe_embed.Note for release builds
This PR is the mechanism only (as #575 was for the payload; #590 wired the release
tag separately). The darwin binary in
.goreleaser.yml(id: hack-browser-data)carries no tags, so with this change official darwin releases would be gcore-off by
default. If you want release parity with today, add
tags: [keychain_gcore]to thatbuild (or a dedicated darwin build id) — happy to fold that in here or leave it to a
follow-up, your call on release policy.
Test plan
go build ./...(darwin, default) — no securityd/gcore code linkedgo build -tags keychain_gcore ./...(darwin)GOOS=linux GOARCH=amd64 go build ./...GOOS=windows GOARCH=amd64 go build ./...go vet ./masterkey/...default +-tags keychain_gcorego test ./masterkey/...default +-tags keychain_gcore— pass0matches forsecurityd,kern.proc.all,MALLOC_SMALL,scanMasterKeyCandidates,findMallocSmallRegions; the-tags keychain_gcorebinary has all of them.golangci-lint run/typos— not run locally; deferring to CI.