Dynamic data masking hides sensitive values at the moment they are read, based on who is asking, while the stored data stays exactly as it was. A support agent opens a customer record and sees a card number as dots with only the last four digits showing. A colleague in a role allowed to see more is shown the whole number. Both are looking at one stored value: this form of data masking changes the view and nothing else.

It exists because many people inside a live system need to work with a record without needing every part of it. A support agent may need to confirm a customer’s card, but has no reason to see the full number. Removing the number from the database would break the systems that charge the card, so dynamic masking keeps one complete stored value and changes only what each role is shown.

Dynamic masking is one member of the family of data obfuscation techniques, and it sits under CISSP Domain 2, Asset Security, where the ISC2 exam outline asks candidates to determine data security controls. This guide explains what it is, how it works on one record, where it goes wrong, and how it differs from its nearest neighbour, static masking.

What is dynamic data masking?

Dynamic data masking applies a rule to sensitive values as they are read. When a user or an application asks for the data, the rule checks who is asking and returns the full value, part of it, or a replacement. The value in storage is never rewritten.

Three properties define it:

  • It changes what is shown, not what is stored. The database holds the full value; the masking happens in the result that reaches the user.
  • It depends on who is asking. The rule is usually tied to a role, which is the job a login is allowed to do, such as support agent. Some products can also decide on attributes such as department or location.
  • It is used inside production. Production is the live system that serves real customers. Dynamic masking limits what its users see without changing the data the system relies on.

Where the mask is applied

The rule sits somewhere between the stored data and the person reading it, and implementations vary by product:

  • In the database. A masking rule is attached to a column, and query results are masked for any user who has not been granted permission to see the real value.
  • In a proxy. A separate component between applications and the database masks values in the results before passing them on.
  • In the application. The application receives the full value and decides what to display based on the user’s role.

Each place protects a different set of access paths, which is the subject of the traps later in this guide.

How dynamic masking works on one record

Take one customer record (sample data, not a real person or card; the card number deliberately fails the Luhn check that real issued card numbers pass):

FieldStored in the databaseShown to the support roleShown to a role allowed to see more
NameGagan SinghGagan SinghGagan Singh
Card number4539 1488 0353 6467•••• •••• •••• 64674539 1488 0353 6467

The record is stored once, in full. When the support agent’s screen asks for it, the masking rule sees the support role and returns the card number with the first twelve digits replaced by dots. The agent can still confirm the card, because the last four digits match the card in the customer’s hand. A role that the rule allows to see more is shown the whole number. The name is not masked, because the agent needs it to talk to the customer.

The important part is what did not happen. Nothing was transformed in storage. The full card number is still in the database, so the real value can still be reached by someone with the right access.

Source: Learn Security Management

Common forms of mask

Products name their masking functions differently, but most offer some version of these:

  • Full masking: the whole value is replaced with a fixed character or a default value.
  • Partial masking: some characters are kept and the rest replaced, as in the card number above.
  • Random masking: a number is replaced with a random value from a set range.
  • Format masks: the value keeps its recognisable shape, for example an email address that shows only its first letter.

The right form depends on the viewer’s task: a support agent confirming a card needs the last four digits, while an analyst may need none.

Where dynamic data masking is used

Dynamic masking suits any situation in which people inside production need to use a record but not every field in full:

  • Customer support and call centres, where agents confirm a card without seeing the full number.
  • Outsourced support teams, who work on the live system with deliberately narrow access.
  • Reporting users, who need the shape of the data more than the identity of each customer.
  • Payment card screens, where PCI DSS, the card industry’s data security standard, expects the card number to be masked when displayed, so that only people with a business need see more than the issuer digits and the last four.

In each case, the masking rule applies need to know to a single field: the person can open the record, but sees only the part their job requires. Deciding which fields are sensitive and which roles may see them in full is a decision for the data owner; the data security roles guide explains who decides what.

Where dynamic masking goes wrong

Dynamic masking looks complete on the screen it was designed for. The weaknesses are elsewhere.

The mask protects only the paths where the rule is applied

This is the central trap. A masking rule protects the access paths it is applied to, and no others. Administrator access, direct database access, and reports or exports that the rule does not apply to can show the full value unless they are controlled separately. If the mask lives in the application, anyone who connects to the database with a query tool sees the full value. If it lives in the database, a privileged account exempt from the rule sees it too.

Source: Learn Security Management

The stored data is still readable in full

Because nothing is transformed in storage, every copy of the stored data holds the full value. Backups, replicas and copies taken for testing contain the real card numbers, unless a test copy is masked statically before it leaves production.

A user who can query may work out the value

In some products, the mask is applied to the result, not to the conditions of the query. A user who can write their own queries may be able to filter on a masked column, for example for card numbers starting with particular digits, and narrow down the real value without ever being shown it.

It is not a substitute for encryption or access control

Dynamic masking does not stop anyone reaching the data; it only changes what some users are shown. Encryption protects the stored data if a disk or a backup is stolen. Access control, such as role-based access control and least privilege, decides who can reach the data at all.

Dynamic masking vs static masking

Dynamic masking’s nearest neighbour is static data masking, and a masked screen and a masked copy can look alike.

Dynamic data maskingStatic data masking
What changesOnly what is shown, when it is readThe stored data, in a copy
Where it is usedProduction: role-based viewsNon-production: development, test, training
Is the stored value real?Yes, storage is unchangedNo, the copy holds fakes
Who sees the real value?Roles the rule allows, and any path the rule does not apply toNo one, from the copy
Main weaknessAccess paths the rule does not apply to show the full valueWeak or consistent masking keeps links

Static masking permanently replaces the values in a copy with realistic fakes, and there is no key and no table that brings the originals back from that copy. Dynamic masking changes only the view. A simple rule separates them: use dynamic masking to limit what users can see inside production, and use static masking when data leaves production for development or test.

How a CISSP scenario may test dynamic masking

Scenarios on data obfuscation tend to describe a business need and ask which technique meets it. A few patterns are worth recognising:

  • A support screen should show only part of a value, while the full value stays available to the systems that use it. That points towards dynamic masking.
  • The value must stay complete in storage but hidden from some users. Static masking, tokenization and redaction all change or remove the value somewhere; dynamic masking does not.
  • A masked screen and a full value appearing elsewhere in the same stem, such as an export or an administrator’s query. The answer is likely to be a control on that other access path, not a stronger mask.
  • A test environment built from production with dynamic masking in place. A candidate is expected to see that the copy holds the stored values in full.
  • Masking offered against a stolen backup or a compromised administrator. Encryption or privileged access controls are more likely to fit.

Asking four questions usually separates the options: does the original need to come back, who may bring it back, is the stored data changed or only what is shown, and what other data could identify the person. For dynamic masking the answers are: the original never left storage, any role the rule allows and any path it does not apply to, only what is shown changes, and the unmasked fields and anything the user can query still need checking.

Conclusion

Dynamic data masking lets people inside a live system work with a record while seeing only the part their role needs. It keeps one complete stored value and changes what each role is shown. Its limit follows from that design: the full value is still there for any path the rule does not apply to. Dynamic masking changes what is shown, not what is stored, so privileged access may still reveal the full value.

Ready to test that under exam conditions? Our LSM CISSP practice tests are built around scenario questions like these: choosing the right data protection technique for the business need, and spotting the access path that a control leaves open, with full explanations for every answer.

Quick reference for the CISSP exam

Dynamic data masking hides sensitive values as they are read, based on who is asking. The stored data is not changed.

Dynamic data masking defined

  • Works on: the live data in production, at query or display time.
  • Changes: only what is shown; storage keeps the full value.
  • Decided by: a masking rule tied to the viewer’s role.
  • Applied in: the database, a proxy, or the application.

The dynamic vs static discriminator

  • Dynamic: only the view is changed; used inside production.
  • Static: the copy is changed permanently; used outside production.

The traps

  • The mask protects only the access paths where the rule is applied.
  • Administrator access, direct database access, and reports or exports the rule does not apply to can show the full value.
  • Backups and copies hold the full value, because nothing changed in storage.
  • It is not a substitute for encryption or access control.