A Master Key is designed to open a set of several locks. These locks also have keys which are specific to each one (the change key) and cannot open any of the others in the set. Locks which have master keys have a second set of the mechanism used to open them which is identical to all of the others in the set of locks. For example, master keyed pin tumbler locks will have two shear points at each pin position, one for the change key and one for the master key. A far more secure (and more expensive) system has two cylinders in each lock, one for the change key and one for the master key.
Larger organizations, with more complex “grandmaster key” systems, may have several masterkey systems where the top level grandmaster key works in all of the locks in the system.
A practical attack exists to create a working master key for an entire system given only access to a single master-keyed lock and its associated key. This is described in Cryptology and Physical Security: Rights Amplification in Master-Keyed Mechanical Locks