Cyber Attacks and Defense in Practice
An access key with administrator privileges allowing all operations (a long-lived credential) was written in a configuration file and given to a batch job running in the cloud. Which of the following is the most appropriate revision to reduce the damage if this key leaks?
- AReplace the access key string with a longer one so that attackers find it harder to guess, while keeping the current privileges unchanged
- BAssign a role that allows only the operations and resources the job needs, and use short-lived credentials issued automatically by the execution environment
- CMove the access key from the configuration file into the program's source code and manage and share it in the repository together with the source code
Show answer and explanation
Answer: B. Assign a role that allows only the operations and resources the job needs, and use short-lived credentials issued automatically by the execution environment
If a long-lived key that allows all operations leaks, an attacker can read or delete every resource in the account or create new resources for abuse, so the damage is the greatest possible. Following the principle of least privilege, assigning a role that allows only the operations and resources the job needs and switching to automatically receiving temporary credentials that expire after a few hours or so from a role attached to the virtual machine or container removes even the need to store a key. In addition, unused privileges are reviewed regularly and unusual API calls are monitored.
- A. The length of the key concerns how hard it is to guess and does not change the size of the damage if it leaks.
- B. Correct. Narrowing privileges and using credentials that expire quickly reduces the damage if they leak.
- C. Writing it in the source code makes it more likely to leak through the repository and is actually more dangerous.
Continue: 9 more Cyber Attacks and Defense in Practice questions