You are investigating a pod that is suspected of being compromised. You need to preserve the container's filesystem for forensic analysis. Which `crictl` command should you use to export the container's filesystem as a tar archive?
Trap 1: crictl logs <container-id>
crictl logs retrieves only the standard output and standard error streams produced by the container's main process, which reveals application-level messages but provides no access to the container's filesystem. Logs are stored by the runtime or a logging driver and do not reflect deleted files, configuration artifacts, or binaries present on disk. For filesystem forensic analysis, capturing the root filesystem via crictl export is required.
Trap 2: crictl inspect <container-id>
crictl inspect returns a JSON object containing the container's configuration, status, mounts, network settings, and resource details, but it does not expose the actual content of files on the container's filesystem. It can be useful to identify the image and mount points, yet it cannot answer questions about file contents or hidden artifacts. To inspect raw files, you must export the filesystem or use a copy-on-write tool.
Trap 3: crictl exec <container-id> tar cvf /tmp/fs.tar /
crictl exec runs a command inside the container, which creates a new process and thus changes the runtime state; using tar inside the container writes an archive to /tmp/fs.tar, leaving forensic artifacts and potentially triggering anti-forensic mechanisms in a compromised pod. Additionally, the archive remains inside the container, requiring a second exec to copy it out, and the tar binary itself may be subverted by an adversary. A proper acquisition should be performed externally using crictl export to guarantee the container's filesystem is not modified.
- A
crictl logs <container-id>
Why wrong: crictl logs retrieves only the standard output and standard error streams produced by the container's main process, which reveals application-level messages but provides no access to the container's filesystem. Logs are stored by the runtime or a logging driver and do not reflect deleted files, configuration artifacts, or binaries present on disk. For filesystem forensic analysis, capturing the root filesystem via crictl export is required.
- B
crictl export <container-id>
crictl export streams the container's entire root filesystem as a tar archive, including the writable layer, without executing any additional processes inside the container. This makes it the preferred method for forensic acquisition because it preserves the filesystem state at the moment of export, allowing offline analysis of binaries, scripts, and config files. The archive can be redirected to a file for hashing and analysis, and it avoids altering the container's runtime state.
- C
crictl inspect <container-id>
Why wrong: crictl inspect returns a JSON object containing the container's configuration, status, mounts, network settings, and resource details, but it does not expose the actual content of files on the container's filesystem. It can be useful to identify the image and mount points, yet it cannot answer questions about file contents or hidden artifacts. To inspect raw files, you must export the filesystem or use a copy-on-write tool.
- D
crictl exec <container-id> tar cvf /tmp/fs.tar /
Why wrong: crictl exec runs a command inside the container, which creates a new process and thus changes the runtime state; using tar inside the container writes an archive to /tmp/fs.tar, leaving forensic artifacts and potentially triggering anti-forensic mechanisms in a compromised pod. Additionally, the archive remains inside the container, requiring a second exec to copy it out, and the tar binary itself may be subverted by an adversary. A proper acquisition should be performed externally using crictl export to guarantee the container's filesystem is not modified.