Short · Privacy and cryptography · 17 min read
Does Encryption at Rest Protect Data When an Application Is Compromised?
Encryption at rest can protect stolen storage without preventing a compromised application from reading data through its normal access path. If the attacker controls a process that can obtain plaintext, the important question is which records that process can reach, through which permissions, and whether an independent control can stop it. The encryption can remain correctly implemented while the application delivers the information.
I wouldn't dismiss that encryption as useless. Protecting an offline disk, snapshot or database file is a different security objective from containing a live process. The mistake is using evidence for the first objective to claim the second. A stronger cipher does not repair an application role that legitimately reads every customer's record.
This paper develops a proposed assessment of the plaintext an application can reach under a stated compromise. It draws on twelve authoritative technical sources checked on October 29, 2026. The method and fictional example are original synthesis, not an empirical study or a claim that any specific environment has been tested. The purpose is to turn “our data is encrypted” into a bounded statement about what remains protected when a particular component fails.
Start with the adversary's position, not the encryption checkbox
OWASP's cryptographic-storage guidance makes the threat model central to the choice of encryption layer. It distinguishes application, database, filesystem and hardware protection, including the difference between protecting against physical theft and a remote compromise of the running server (OWASP Foundation, n.d.-b). That is the starting distinction, not an argument against using several layers together.
I would write down the assumed foothold before reviewing controls. A person holding a copied database file has different capabilities from a stolen database login, a compromised web process, or an administrator who can replace the application and alter its policies. Do not combine them into an undefined attacker who can do everything, or quietly switch between them when presenting results.
For a compromised-process assessment, assume the attacker can exercise the process's existing authority and inspect information the process receives. Do not automatically grant control of an independent identity provider, database policy administrator or key-management administrator. Those are additional assumptions that may be appropriate in another scenario. State whether the compromise includes the host and other co-resident services, because a process boundary and a machine boundary are not interchangeable.
The result should name both the protected dataset and the excluded power. “A copied storage object remains unreadable without the required decryption path” is defensible under suitable conditions. “A compromised application cannot read other tenants' records” requires evidence of tenant separation outside the compromised component. Neither claim follows merely from a dashboard reporting encryption enabled.
Locate the point at which ciphertext becomes useful data
Microsoft describes SQL Server transparent data encryption as encrypting pages before writing them to disk and decrypting them when they are read into memory (Microsoft, 2025, “About TDE”). That mechanism protects the stored representation. It does not transform an authorized database query into a cryptographic challenge that the application must independently solve.
Follow one sensitive field through the actual workflow. Where is it encrypted, where is it decrypted, which component sees the result, and which identity requested it? A support application may never hold the storage key while still receiving a customer's address through a query. An export service may receive readable rows after another service performed decryption. Key possession and access to the benefit of decryption are different capabilities.
I would record the plaintext destinations as carefully as the encrypted stores. The immediate response, application cache, temporary file and reporting job can matter as much as the primary database. These are candidates to inspect, not a claim that every application creates every copy. A system that decrypts only a small field for a bounded operation has a different exposure from one that returns the entire record to a general-purpose worker.
This is also why a diagram ending at the key vault is incomplete. The relevant chain ends where a person or program can use the information. If the approved purpose is calculating a shipping charge, ask whether the requesting service needs the full address returned, a limited location attribute, or only the calculated result. Reducing what crosses that boundary can change the consequence of compromise even when the storage encryption stays the same.
A protected master key does not mean plaintext keys never leave a service
AWS distinguishes a symmetric KMS key from a data key used outside KMS. Its data-key documentation describes returning plaintext key material for immediate use alongside an encrypted copy, and explains that the application manages and uses those data keys outside KMS (Amazon Web Services [AWS], n.d.-d). This is a supported envelope-encryption pattern, not evidence of a broken key-management service.
The architectural implication is that a protected wrapping key can coexist with a process capable of local decryption. In that design, protecting the wrapping key from export is valuable, but it does not make every application operation depend on a fresh remote authorization decision. Inspect where the usable data key exists, what it protects and how long the implementation retains it.
Separate three questions during review: can the principal change a key's policy, can it request a cryptographic operation, and can it read the resulting plaintext? Different identities may control each step. Conversely, one application or administrator may have several of these powers through different roles. A separation-of-duties diagram should be checked against effective authority rather than job titles.
I would avoid collecting real secret values merely to prove their existence. Configuration, code paths, approved test instrumentation and synthetic data can establish where decryption occurs. The acceptance question is whether the claimed boundary exists and can be exercised under the stated failure. Copying a production key into a report would create another exposure without making that reasoning stronger.
Model the readable set rather than counting encryption layers
A useful assessment needs a unit more concrete than “the database is exposed.” For a specified compromised component, define its readable set as the records it can cause to become plaintext through the ordinary and delegated paths included in the scenario. This is a proposed analytic model; it is not a new cryptographic security definition or a probability of breach.
Let each permitted path contribute a set of readable records. The overall reachable set is the union of those path-specific sets. A direct query may reach one partition, an export job another, and a reporting API a third. Removing a permission from the first path does not reduce the union if the same records remain available through the second. A successful denial test on one endpoint is therefore insufficient evidence of the overall boundary.
The model also separates entitlement from actual disclosure. A process may be capable of reading a million records without evidence that an attacker did so. Conversely, a small readable set may contain the particular records whose disclosure is most consequential. Record both the authority envelope and the observed activity, with the limits of observation. Do not report the first as a confirmed exfiltration count or the second as proof that unobserved access was impossible.
In practice, I would inventory paths by business operation, resource scope, effective principal and independent enforcement point. Mark paths not yet assessed rather than treating them as denied. This supports a useful management decision: which change actually removes sensitive records from the compromised component's reachable set, and which change merely alters the storage representation while leaving all those paths intact?
Per-tenant keys help only when tenant authority is also separated
Giving each tenant a key can create a useful control boundary, but the key count is not the boundary itself. If one compromised service can request decryption under every tenant's key, its effective access may still span every tenant. The relevant restriction is which tenant's data and cryptographic operations that service can invoke under the conditions the independent enforcement mechanism evaluates.
OWASP recommends validating authorization on every request, applying least privilege and choosing the correct place to enforce checks (OWASP Foundation, n.d.-a). Those recommendations address necessary access-control discipline. My additional concern in this scenario is whether the decisive check remains trustworthy after the application component performing it is compromised.
An application-supplied tenant label is not automatically authoritative. Identify who established the tenant relationship and whether the compromised component can substitute another value while retaining the same backend privileges. A policy that compares two values chosen by that component may look specific without constraining it. The solution could involve a narrower workload identity, resource partitioning or a separate service that verifies a tenant-bound authorization claim; the appropriate design depends on the trust model.
Do not assume that moving a check to another microservice makes it independent. Review who can deploy that service, change its policy and obtain its credentials. If the same compromised administrative boundary controls both services, the separation may help operational organization without satisfying the stronger compromise claim. Describe the residual assumption so the business knows which failure the design is actually meant to withstand.
Encryption context binds data; it does not establish a business entitlement
AWS KMS encryption context consists of non-secret values cryptographically bound to symmetric ciphertext. The same context is needed for decryption, and it can be used in authorization policies. AWS also warns that context appears in plaintext logs and should not contain sensitive information (AWS, n.d.-c). These are useful integrity and policy mechanisms, but they do not supply a missing source of authorization truth.
Suppose a hypothetical application encrypts records with a tenant identifier in the context. A mismatched context can prevent decryption, yet an attacker who controls an application authorized for every tenant may be able to submit the correct context for another tenant's record. The context is not intended to be a secret password. Its protective value depends on the policy and the trustworthy attributes against which the request is checked.
I would distinguish a binding test from an entitlement test. The first confirms that ciphertext cannot be accepted with the wrong associated context under the selected mechanism. The second confirms that the requesting principal cannot obtain another tenant's plaintext even when it knows the correct identifier. Passing the first should not be presented as passing the second.
Use opaque, non-sensitive identifiers where appropriate, and assess the information revealed by metadata itself. The evidence record can identify which context fields matter without copying customer details into a public example. A cryptographic mechanism that improves integrity should not become an accidental channel for sensitive content in operational logs.
Service restrictions constrain a route, not every action available through it
AWS's kms:ViaService condition can restrict applicable KMS use to requests through specified services, and the documentation limits it to forward access sessions (AWS, n.d.-a, “kms:ViaService”). That is a concrete routing and authorization condition. It should not be generalized into a statement that all requests using an approved service are legitimate business requests.
If a design permits decryption through a particular storage service, review the operations and resources the compromised application can access through that service. Denying a direct KMS call may remove one path while leaving an authorized object-read path available. Whether that is acceptable depends on the application's intended data scope, not on the fact that the direct call failed.
This is where the readable-set model helps keep tests honest. Record the denied direct path and the permitted delegated path separately. The policy may be doing exactly what it was designed to do. The finding could be excessive storage authorization or an overbroad business operation, rather than a defect in the cryptographic service.
NIST's zero-trust architecture separates policy decisions from enforcement and describes dynamic authorization before access (Rose et al., 2020, §§2.1, 3). I use that separation as an architectural question: which component can still make and enforce the decision when the requesting workload is hostile? It does not establish that a product labeled zero trust automatically restricts the records returned by an application or invalidates information already released.
Client-side encryption moves the trust boundary
Microsoft's Always Encrypted documentation describes client-side protection that separates sensitive data access from database administration. It also documents operational restrictions and differences between ordinary Always Encrypted and the secure-enclave variant (Microsoft, 2026). That can address a different threat from transparent disk encryption: a database operator who should manage storage without receiving the protected values.
The boundary has moved toward the client that can decrypt. If that client is the application server under assessment, compromising the client still raises a plaintext-access question. If decryption occurs only in another trusted component, explain what the compromised server can request from that component and what the component returns. “Client-side” is a location relative to a service, not a universal synonym for the end user's device.
The same Microsoft documentation explains that deterministic encryption repeats the encrypted value for equal plaintext and can reveal patterns, especially for small sets of possible values. Randomized encryption and enclave-assisted operations have different query capabilities and trust assumptions (Microsoft, 2026). This makes the choice a workload and threat-model decision, not simply a stronger-looking setting.
I would compare alternatives against the operation the business needs: search, equality matching, calculation or display. If a proposal needs a component to receive plaintext to perform that operation, name that component in the compromise analysis. Specialized techniques can change what must be revealed, but their actual leakage, compatibility and operating assumptions require a separate assessment. This paper does not claim that every computation requires exposing plaintext to the general application server.
Cached material changes what a key-policy change can stop
The AWS Encryption SDK supports optional data-key caching. Its documentation explains that cached material can serve cryptographic work without a new KMS request and that caching requires carefully selected security thresholds (AWS, n.d.-b). The feature has performance and cost reasons; its existence also means the architecture cannot assume that every data use produces a new remote key decision.
That creates a distinction between preventing future acquisition of a key and controlling material already available to a process. Removing a permission may stop the next unwrap while leaving a previously obtained plaintext data key usable for the data it protects. The exact duration and scope depend on the implementation and the adversary's capabilities. Do not invent an expiration guarantee from a cache setting when the threat model includes an attacker able to retain information it has already received.
Managed-service optimizations create a related observation limit. AWS documents that S3 Bucket Keys reduce KMS requests; subsequent requests using the bucket-level key do not make new KMS calls or validate the KMS key policy. It also describes bucket-level rather than object-level KMS logging context (AWS, n.d.-f). This is specific documented behavior, not a claim that S3 stops enforcing its own access controls.
For containment planning, test the relevant data-service permissions and existing sessions as well as key-service access. Do not promise that disabling a KMS key instantly recalls plaintext, clears every cache or invalidates every supported service path. Changes can also interrupt legitimate operations. The acceptance task is a bounded observation of which paths stop and which dependencies remain, using approved tests rather than destructive changes to production keys.
Key-use logs are one part of the disclosure evidence
AWS CloudTrail records KMS API activity, but AWS omits sensitive cryptographic fields and allows KMS events to be excluded from a trail. Its documentation cautions that re-enabling collection does not recover events missed during an exclusion (AWS, n.d.-e). A review therefore needs the collection configuration and relevant time period, not merely the existence of a logging service.
Even complete KMS API logging is not necessarily a complete record of plaintext reads. Local data-key use, service caching and business operations that return previously decrypted data can separate one key event from many later reads. This is an inference from the documented mechanisms, not a claim that a particular incident involved them. Correlate key activity with the available data-service and application evidence, and state where that correlation is incomplete.
I would look for enough context to distinguish principal, resource, operation, authorization outcome and time. Test that the selected records actually arrive and remain accessible to investigators. If an application log is controlled by the compromised application, treat its integrity and completeness as assumptions to investigate rather than independent confirmation of the application's account.
Logging must not create a second uncontrolled copy of the protected dataset. OWASP's logging guidance identifies tokens, passwords, encryption keys and sensitive personal information as data generally unsuitable for direct logging, with appropriate handling needed where recording is necessary (OWASP Foundation, n.d.-c). Prefer identifiers and bounded outcome evidence over full decrypted payloads. More logging is not stronger assurance if it silently broadens who can read the underlying information.
Test the claim with a controlled compromise model
A useful exercise should reproduce the assumed authority without requiring a real compromise. Use synthetic records, approved test identities and a representative environment. State differences from production, especially policy inheritance, service caching and administrative separation. The goal is to challenge a precise protection claim, not to demonstrate that an ordinary login succeeds.
| Test condition | Question to resolve | Evidence that matters |
|---|---|---|
| Storage artifact without its supported key path | Does the selected at-rest protection prevent readable recovery? | Artifact identity, mechanism and bounded result |
| Ordinary application identity | What sensitive records can normal operations return? | Resource scope and actual application output |
| Same identity requesting another tenant | Does independent authorization reject the request? | Decision source, enforcement point and denial evidence |
| Direct key access denied but service access allowed | Does a delegated path still return plaintext? | Both paths assessed, with effective permissions |
| Access withdrawn after controlled prior use | What can the retained state still enable? | Observed service/session/cache behavior and limits |
| Logging enabled for the exercise | Which actions can investigators reconstruct? | Collected events, missing links and sensitive-data checks |
These tests answer different questions. A failure of one does not erase a pass on another, but it can invalidate a broader assurance statement. Record the configuration and expected result before execution. Otherwise, it is too easy to reinterpret whatever happened as success.
Keep destructive production-key operations outside this exercise. Where a test cannot safely reproduce a condition, record it as untested and use a narrower claim. A laboratory denial is not proof of production enforcement when the relevant permissions differ. Likewise, a successful read establishes capability under the tested conditions, not that historical data theft occurred.
A fictional review changes the investment decision
Consider fictional Linden, whose case-management application stores encrypted records and uses one backend identity for all customers. The browser normally shows only the signed-in customer's cases. The team proposes another storage-encryption layer after being asked what would happen if the application process were compromised.
In a synthetic review, the team distinguishes the browser session from the backend identity. The backend can request all case records; the tenant restriction is applied only by the application code being treated as compromised. Storage decryption works as designed. The finding is an unrestricted plaintext path through the backend's legitimate authority, not broken encryption or proof that every record has been stolen.
Linden considers per-tenant keys, but rejects a design that lets the same backend use them all without independent restriction. Instead, it evaluates a narrower service contract that verifies the caller's tenant-bound entitlement and returns only the fields required for the case operation. The review includes who can alter that verifier and whether reporting or support paths retain broader access. The proposed change is useful only if those assumptions hold.
The acceptance statement is deliberately limited: under the tested application-process compromise, the selected cross-tenant request is denied at an independently controlled boundary, while the approved case workflow still works. Other export paths and administrative compromise require separate evidence. This is a fictional reasoning example, not a client result or a claim that one architecture fits every organization.
Decide which residual access is necessary
Some applications genuinely need broad plaintext access. An analytics job may process a large authorized population, and a service may have availability requirements that make a separate decision on every record impractical. The answer is not to describe that access as eliminated. Decide whether the processing can use fewer fields, smaller partitions, a different schedule or a constrained result, then disclose the access that remains necessary.
OWASP's storage guidance recommends avoiding unnecessary retention of sensitive information (OWASP Foundation, n.d.-b). That supports asking whether the application needs to hold the data at all. It does not prescribe a universal retention period or resolve legal obligations. A smaller justified dataset can reduce exposure without adding another key hierarchy, but deletion and retention decisions still require the appropriate business authority.
This assessment has limits. It does not compare cryptographic algorithms, certify an HSM, establish regulatory breach exemptions or cover every confidential-computing architecture. Vendor documentation establishes mechanisms, not the security of an unexamined deployment. The proposed readable-set model has not been empirically validated here, and actual adversary capability, policy drift and incomplete evidence can change the conclusion.
For adjacent decisions, read who should own cloud workload identities and whether private endpoints prevent data exfiltration. Identity ownership and approved destinations matter, but neither replaces the question answered here: what plaintext can this compromised component cause the system to reveal?
If your encryption assurance stops at enabled, contact me about a data-access boundary assessment. We can trace one sensitive workflow, identify the independent controls and define tests that distinguish protected storage from restricted plaintext access. The deliverable is a defensible statement of what your encryption protects, what the application can still read and which change would reduce that exposure.
References
- Amazon Web Services. (n.d.-a). AWS KMS condition keys. Retrieved October 29, 2026, from https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html
- Amazon Web Services. (n.d.-b). Data key caching. Retrieved October 29, 2026, from https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/data-key-caching.html
- Amazon Web Services. (n.d.-c). Encryption context. Retrieved October 29, 2026, from https://docs.aws.amazon.com/kms/latest/developerguide/encrypt_context.html
- Amazon Web Services. (n.d.-d). Generate data keys. Retrieved October 29, 2026, from https://docs.aws.amazon.com/kms/latest/developerguide/data-keys.html
- Amazon Web Services. (n.d.-e). Logging AWS KMS API calls with AWS CloudTrail. Retrieved October 29, 2026, from https://docs.aws.amazon.com/kms/latest/developerguide/logging-using-cloudtrail.html
- Amazon Web Services. (n.d.-f). Reducing the cost of SSE-KMS with Amazon S3 Bucket Keys. Retrieved October 29, 2026, from https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-key.html
- Microsoft. (2025, September 7). Transparent data encryption (TDE). https://learn.microsoft.com/en-us/sql/relational-databases/security/encryption/transparent-data-encryption?view=sql-server-ver17
- Microsoft. (2026, January 28). Always Encrypted. https://learn.microsoft.com/en-us/sql/relational-databases/security/encryption/always-encrypted-database-engine?view=sql-server-ver17
- OWASP Foundation. (n.d.-a). Authorization cheat sheet. Retrieved October 29, 2026, from https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html
- OWASP Foundation. (n.d.-b). Cryptographic storage cheat sheet. Retrieved October 29, 2026, from https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html
- OWASP Foundation. (n.d.-c). Logging cheat sheet. Retrieved October 29, 2026, from https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html
- Rose, S., Borchert, O., Mitchell, S., & Connelly, S. (2020). Zero trust architecture (NIST Special Publication 800-207). National Institute of Standards and Technology. https://doi.org/10.6028/NIST.SP.800-207