Ensure that all Oracle Cloud Infrastructure (OCI) compute instances require the use of Instance Metadata Service Version 2 (IMDSv2) when requesting instance metadata in order to protect against vulnerabilities that could be used to access the Instance Metadata Service (IMDS). IMDSv2 uses session-oriented requests. This allows you to create a session token that defines the session duration, which can be a minimum of 1 second and a maximum of 6 hours. During this duration, you can use the same session token for subsequent metadata requests. After this duration expires, you must create a new session token to use for future requests.
Instance Metadata Service (IMDS) provides a convenient way to access metadata available for a running OCI compute instance such as hostname, network configuration, associated security lists, and so on. Application code can access this metadata from a running compute instance using one of two methods: Instance Metadata Service Version 1 (IMDSv1) or Instance Metadata Service Version 2 (IMDSv2). The OCI compute instances that allow IMDSv1 are exposed to Server Side Request Forgery (SSRF) attacks, which could allow a threat actor to manipulate the server side of a web application or an API to perform unauthorized actions. IMDSv2 uses session-oriented requests to mitigate several types of vulnerabilities that could be used to attempt to access the IMDS, protecting against malicious activities such as SSRF attacks.
Audit
To determine the version of the Instance Metadata Service (IMDS) configured for your OCI compute instances, perform the following operations:
Remediation / Resolution
To enforce IMDSv2 for your Oracle Cloud Infrastructure (OCI) compute instances, perform the following operations:
Once the use of IMDSv2 is enforced, applications or agents that use IMDSv1 for instance metadata access may lose connectivity.References
- Oracle Cloud Infrastructure Documentation
- Overview of the Compute Service
- Getting Instance Metadata
- #10 - Server-Side Request Forgery (SSRF)
- Oracle Cloud Infrastructure CLI Documentation
- Compartment list
- Instance list
- Instance get
- Instance update