Skip to content

Zero-byte SSE-C objects never authenticate the customer key #82

Closed

Description

@Vonng

Problem

A zero-byte SSE-C object never has its customer key authenticated. GetObjectNInfo returns early for zero-byte objects without constructing a decryptor (cmd/erasure-object.go:262), and ObjectInfo.decryptChecksum returns immediately when the object carries no checksum (cmd/encryption-v1.go). Nothing on the path unseals the stored object key, so a syntactically valid but incorrect key is accepted.

Observed behaviour

Reproduced on main (ce456dba0), identical on ErasureSD and Erasure:

Request Expected Actual
GET a zero-byte SSE-C object with a wrong key 403 200
CopyObject a zero-byte SSE-C object to a new key with a wrong source key 403 200
Either request against a non-empty object 403 403

The zero-byte early return dates to upstream commit 523bd76 (2024-05-05) and is present in RELEASE.2026-08-06T00-00-00Z. This is inherited from upstream, not introduced by SILO.

Impact

Low. A zero-byte object has no plaintext to disclose, so neither request yields data the caller did not already have. What remains is:

  • AWS S3 compatibility: an incorrect SSE-C key must return 403 AccessDenied.
  • A caller holding s3:GetObject/s3:PutObject but not the object key can produce a copy of the object sealed under a key of their choosing.

Only GET and CopyObject were exercised. Any other path that reads an object should be checked against the same early return.

Reproduction

Write a zero-byte SSE-C object with no checksum, then read it back with a different, internally MD5-consistent key:

putCopyChecksumSource(t, apiRouter, credentials, bucketName, object, nil, map[string]string{
    xhttp.AmzServerSideEncryptionCustomerAlgorithm: xhttp.AmzEncryptionAES,
    xhttp.AmzServerSideEncryptionCustomerKey:       base64.StdEncoding.EncodeToString(oldKey),
    xhttp.AmzServerSideEncryptionCustomerKeyMD5:    base64.StdEncoding.EncodeToString(oldMD5[:]),
})
// GET with wrongKey returns 200 instead of 403

The same object copied to another key with x-amz-copy-source-server-side-encryption-customer-key set to the wrong key also returns 200.

Proposed direction

Authenticate the key where the data path stops being able to do it, rather than at each call site: before the zero-byte early return, unseal the stored object key with the supplied SSE-C key and fail with crypto.ErrInvalidCustomerKey when it does not match. That covers every reader uniformly instead of leaving each handler to remember.

Acceptance criteria

  • GET, HEAD and CopyObject of a zero-byte SSE-C object with an incorrect key return 403 AccessDenied.
  • The same requests with the correct key are unaffected, including objects with and without checksums.
  • Non-empty objects keep their current behaviour.
  • No on-disk format change.

Relationship to other work

Activity

  1. added
    bug
    on Aug 29, 2026
  2. Vonng commented on Aug 29, 2026

    @Vonng
    MemberAuthor

    Local implementation status and acceptance correction

    The zero-byte GetObjectNInfo fix is implemented locally as DCO commit da7d6ed67 on codex/issue-82-zero-ssec; it is not pushed yet.

    One acceptance criterion in the issue body is broader than the defect: HeadObject already authenticates SSE-C explicitly for every object size. The repaired paths are GET, CopyObject, and UploadPartCopy; HEAD remains a non-regression assertion.

    The implementation authenticates supplied SSE-C/SSE-Copy keys only after range and request preconditions, and bypasses absent-header internal reads, NoDecryption, replication, and restore requests. Coverage includes zero/nonzero key parity, cross-object and storage-class copies, UploadPartCopy part non-creation, conditional/range ordering, and internal reader shapes on both object-layer backends. Focused normal/race, go vet ./cmd, and a clean full go test -tags kqueue,dev ./cmd pass.

    A separate, broader GetObjectAttributes key-authentication defect is tracked in #84.

  3. Vonng commented on Aug 29, 2026

    @Vonng
    MemberAuthor

    PR submitted

    The release candidate is PR #87, stacked after #83 so the zero-byte rotation error-contract adjustment is reviewed explicitly. The final stacked hashes are b73581b05 plus integration test c4fd97d0b.

    Hosted CI is now the active gate. No tag or release was created.

  4. Vonng commented on Aug 29, 2026

    @Vonng
    MemberAuthor

    Resolved by #87. Zero-byte SSE-C reads now authenticate the customer key at the object layer while preserving NoDecryption, replication, restore, range, precondition, and internal-read contracts. Final main 1be684b passed Go CI, VulnCheck, the full local race suite, and Test Release run 33254848256.

  5. moved this from Backlog to Done in Siloon Aug 29, 2026
  6. self-assigned this
    on Sep 15, 2026
  7. added theissue type on Sep 15, 2026
  8. added this to the 20260903 milestone on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions