Skip to content

Cred Autofill: security notes (FLT-310)

Personal tool for one Windows user (Andrew). It fills one saved email and password into Workday sign-in and create-account forms, only when he clicks the toolbar button or presses Ctrl+Shift+L.

What is protected, and from whom

Asset Where it lives
Workday password Windows Credential Manager, generic credential CredAutofill/default, per user, DPAPI-protected by Windows
Same password, briefly the native host process (one request), the extension service worker, the page's isolated world, then the Workday form itself

The line this tool draws is retrieval versus intentional disclosure:

  • Unauthorized retrieval is in scope and prevented. Another extension asking the native host directly, any non-Workday page, a page reached by navigation mid-fill, page scripts trying to trigger a fill, and accidental leaks through logs, the repo or CI.
  • Disclosure after an intentional fill is accepted. When Andrew triggers a fill, the page he filled receives the password, as if he had typed it. That page is a trusted recipient, and so is any extension that can read that page's DOM. This includes every Workday tenant the URL policy accepts, a malicious tenant among them: one saved credential is shared by all of them. Scoping the fill to one visible form, refusing ambiguous forms and not auto-submitting would not change this, because page JavaScript can read a filled field. Protecting against a malicious tenant would need a different design: approved tenant identities, each with its own credential.

Out of scope: malware already running as Andrew's Windows user. That code can call CredReadW on the same credential directly, or start CredAutofill.exe itself with a forged chrome-extension://... argument (the caller origin is an argv value that Chrome supplies; it keeps out other extensions, not same-user processes). No control in this tool can stop that, and none is claimed.

Controls

  • Gesture only. Fills start from chrome.action.onClicked, which page scripts cannot fire. The extension holds activeTab, scripting and nativeMessaging only, and no host permissions, so it cannot inject into any page without that gesture. activeTab access ends when the tab navigates to another origin.
  • Pinned extension. The manifest key fixes the extension ID. The native host manifest's allowed_origins and SitePolicy.IsAllowedCaller both accept only that ID.
  • Workday only, twice. The extension and the native host each check the page URL against ^https://[a-z0-9-]+(\.wd[0-9]{1,3})?\.(myworkdayjobs|myworkdaysite)\.com/, case-sensitive with ASCII digits because .NET's \d matched an Arabic-Indic digit that JavaScript's does not (so no user info and no explicit port). Both sides use that one pattern and are tested against the same vectors in tests/policy-vectors.json. A test derives the extension ID from the manifest key and checks it against SitePolicy and install.ps1.
  • Refusals happen before the vault is read. Tests assert the vault loader is never called for a wrong caller, a wrong request type or a wrong page.
  • One form, or nothing. The in-page filler starts from the single visible password field.
  • Choosing the form. If the password field belongs to a native <form>, that form is the boundary, and membership follows ownership (form="id").
  • Form-less dialogs (common on Workday): the region grows from the password field while it holds only that one visible password field and at most one visible email field. It stops at the first level that also holds a submit control, and never grows past an enclosing role=dialog or aria-modal element.
  • Same form for everything. Every field, agreement box and submit control used must belong to the same native form as the password field (none, for a form-less dialog). A <form> nested inside a form-less region, or a button with form="other", is never used. This closes the red-team case of a hidden attacker form inside the dialog receiving verifyPassword and being submitted.
  • Refusals. Two email, confirmation or agreement candidates give ambiguous. A field that is not an enabled, writable input gives no-form: password fields must be type=password, and a <fieldset disabled> or an aria-disabled ancestor counts as disabled. The agreement box must be a native checkbox, or a div/span with role=checkbox and no href, for or form. A link or a button posing as a checkbox is refused before anything is written.
  • Order. The form, fields and agreement box are validated before anything is written. Page listeners run inside each input event, so each field is re-checked (type, form, still in the page) right before it is written. The result is changed if one moved.
  • Submitting. Whether the submit control can be clicked is decided only after filling: Workday enables it once the fields are valid. It is re-checked right before the click. A click_filter overlay is clicked only when it is a plain visible div/span (no role, href, for, form or tabindex) beside the button in a wrapper with no other interactive control. Otherwise the button itself is clicked, or nothing. The agreement box is ticked only when the form will be submitted.
  • Reporting. The result is *-submitted, not "signed in": Workday decides whether the sign-in worked.
  • Visibility. In a real browser this uses checkVisibility({opacityProperty, visibilityProperty}) plus a non-zero box, so display, content-visibility, closed <details>, opacity:0, the element's own computed visibility, and zero-size decoys are all handled. Under jsdom (tests only) it falls back to CSS. aria-hidden is not treated as hidden, because it does not hide anything on screen.
  • Vault errors are contained. The settings window shows Credential Manager errors as status text, and a fixed message for an entry it did not write. The host answers vault-error, or credential-corrupt for data it did not write (empty or odd-sized blob, blank user name). The settings window's LoadEmail applies the same check, so both agree on what is saved. Saves enforce Credential Manager's limits: a 512-character user name (measured: 513 fails with error 1734) and a 1,280-character password. The text boxes have no MaxLength, because it silently truncates a pasted password. Over-long input is rejected with a message instead.
  • One request per host process. NativeHost.Run answers a single framed request and returns.
  • Bounded input. 4-byte little-endian length, 1 to 65,536 bytes, otherwise the host stops.
  • No secret in logs. Nothing logs the request or reply. Credential and HostResponse override the record ToString so the password prints as ***. Tests use throwaway Credential Manager targets and delete them.

Rulings on the review items (2026-10-29)

1. TOCTOU between the URL check and the injection: fixed

Before, the extension checked tab.url, asked the native host, then injected with the password as an argument. The tab could navigate in between.

Now:

  1. A probe (readLocation) is injected first. It returns the live location.href, and Chrome returns the documentId of the document it ran in.
  2. The probed URL, not tab.url, is checked and sent to the native host for approval.
  3. The fill is injected with target.documentIds: [documentId]. If that document is gone (the tab navigated or reloaded), Chrome rejects the injection and the password is never delivered.
  4. Inside the page, fillWorkday re-checks location.protocol === "https:" and location.host === expectedHost before it touches any field.

Removing host_permissions also means a cross-origin navigation drops the extension's access to the tab entirely.

2. Password held as a .NET string and a JSON string: accepted, with a short-lived process

Zeroing was considered and rejected as theatre:

  • .NET strings are immutable and the GC may copy them. SecureString is not recommended for new code (DE0001) and gives no protection once the value is marshalled.
  • The value must reach the extension and then the Workday form in plaintext anyway, and the page's own JavaScript heap holds it after every fill.
  • Anything able to read the host process's memory runs as Andrew and can read Credential Manager directly.

What was done instead: the host answers one request and exits, so the managed copy lives for milliseconds. Every buffer this code owns is cleared when it is done (best effort): the serialized reply, the managed byte copy and the unmanaged blob in Save, and the blob CredReadW returned before CredFree. The read buffer is cleared on every path, including a rejected format check. The settings window reads only the email (Vault.LoadEmail), so it never turns the saved password into a string. The council (2026-10-30) upheld this ruling.

3. Native host reading while the settings window saves: no change needed, now tested

CredWriteW replaces the whole credential (user name and blob together) atomically, and CredReadW returns one consistent snapshot. The host only reads. The test Concurrent_reads_never_see_a_torn_email_password_pair runs 20 phases. In each, a barrier releases one save and two reads at the same moment. Every read must pair userN with password-N and must see the previous or the new generation, and the run must observe more than one generation. This is stress evidence, not a proof of the platform contract.

Open observation, root cause not established: inside the xunit test host, CredWriteW sometimes stalled for as long as other threads kept reading, while the same code in a plain process never did. Run times are bimodal: well under a second, or tens of seconds. The phased design bounds the test either way. Production exposure is small, because the native host makes one read and exits.

4. Double gesture while a fill is in flight: fixed

createActionHandler keeps a per-tab in-flight set. A second click or shortcut on the same tab while a fill is running returns busy and is ignored, not queued. The entry is cleared in finally, so a failed fill does not lock the tab. Other tabs are not blocked.

Known behaviour worth knowing

  • On a create-account form the extension fills the confirmation field and ticks the agreement checkbox if it is not already ticked, then presses Create Account. On a sign-in form it presses Sign In. Both happen only on Andrew's gesture. A create form without a confirmation field is filled but not submitted.
  • The same credential is used for every Workday tenant (see the threat model above).
  • Only the top frame is filled. A sign-in form inside an iframe gives no-form.

CI gates

See .github/workflows/ci.yml: locked-mode NuGet restore (every .NET lane, including Stryker.NET's own builds through RestoreLockedMode; a stale lock file fails with NU1004), a build with warnings as errors, unit tests, a 3x churn run, the vulnerable-package gate, Stryker.NET and StrykerJS with break thresholds, npm audit, Semgrep (p/csharp, p/javascript, p/security-audit, p/secrets), actionlint, and gitleaks over the full history.

Each gate fails closed, including the empty cases:

  • Mutation: both mutation gates are re-checked from their JSON reports by scripts/check-mutation-report.mjs. A missing or malformed report, a Pending, missing or unknown mutant status, zero scored mutants, or a NaN score fails the job.
  • Semgrep: runs with --strict, fails on analysis errors, and fails unless every tracked production .cs and .js file appears in its scanned list.
  • gitleaks: fails when it scanned zero commits. Its exception matches the exact manifest public key only; a planted token or an altered key is flagged.

The aggregate mutation score rewards killed mutants, not necessarily the critical paths. The security-relevant behaviour therefore also has targeted tests: refusals before any vault read, the policy vectors, extension-ID derivation, scoped form selection, and the badge handlers.

Not covered by CI: a real Chrome-to-native-host round trip. That is Andrew's usage test on a real Workday page.