Skip to content

Windows update recovery marker is attacker-deletable, silencing the tamper refusal #868

Closed

Description

@Vasanthdev2004

Follow-up from #751, which closes the #742 overwrite primitive but leaves this narrower gap.

After a failed promotion where the restore is blocked, the only record that <target>.old holds the last verified binary is a .keep file sitting beside it in the install directory:

func oldBinaryPreserved(oldPath string) bool {
	_, err := os.Lstat(oldPath + oldBinaryPreservedSuffix)
	return err == nil || !errors.Is(err, os.ErrNotExist)
}

replace_windows.go:271. Pure pathname existence, no identity binding, nothing outside the install directory.

Under the same threat model as #742, a principal who can write that directory deletes the marker. On the next zero upgrade, preflightRecoveryStateLocked finds no marked recovery, os.Lstat(targetPath) succeeds because the attacker's file is there, and the run proceeds with no refusal. The operator is never told the target holds unverified bytes.

The recovery copy itself survives, so this is not the arbitrary-overwrite primitive. What is lost is the warning.

#751 already builds the mechanism to fix it. appendRecoveryCleanupRecord writes identity-bound records to a trusted per-user store under UserConfigDir()/zero/update-recovery, outside the attacker's reach. It is only reached on promote's success path (stage_windows.go:161); the failure branch returns first at :155. Writing an unresolved-state record there on failure too, and consulting it alongside the marker, closes this without new infrastructure.

Raised by @jatmn as a P2 on #751. Splitting it out so #751 can land on its own merits.

Activity

  1. Vasanthdev2004 commented on Aug 12, 2026

    @Vasanthdev2004
    CollaboratorAuthor

    @PierrunoYT holding this one rather than approving it, because the mechanism it describes appears to be gone.

    #751 merged into main this morning as cabfeef, and it reworked update staging. oldBinaryPreserved, oldBinaryPreservedSuffix, and any .keep marker no longer appear anywhere under internal/update/. The attacker-deletable pathname marker this issue is built on does not seem to exist on current main.

    That may mean it is fixed, or it may mean the same weakness moved somewhere I have not spotted. You wrote the original analysis, so you are better placed to say which. Could you re-check against cabfeef and either point at the surviving code or close it?

    Not closing it myself, because "I could not find the function" is weaker evidence than your original report.

  2. added
    issue-approved
    on Aug 25, 2026
  3. gnanam1990 commented on Aug 25, 2026

    @gnanam1990
    Collaborator

    Re-reviewed against current main and approved. The earlier hold assumed the pathname marker had disappeared, but oldBinaryPreservedSuffix, oldBinaryPreserved, and marker-based recovery preflight are present again. The trusted identity-bound cleanup record is still written on the successful promotion path, so the failed-restore marker deletion gap described here remains actionable.

  4. added 5 commits that reference this issue on Aug 28, 2026
    bddc892
    6536b5a
    3b8d814
    432ef71
    ff7387a
  5. added a commit that references this issue on Sep 12, 2026
    a3852ba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue-approved

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions