Skip to content

Port 22 is exposed

Description

This rule detects whether port 22 is exposed in Dockerfiles. Exposing port 22 in Docker containers poses security risks by potentially allowing unauthorized users to gain SSH access. Therefore, avoid exposing port 22 and use more secure methods for managing and accessing your containers.

Code Example

dockerfile
- EXPOSE 22 + # Do not expose port 22
...

Remediation

Docker

To mitigate this issue, remove any EXPOSE instructions related to port 22. Consider using more secure alternatives to SSH for managing your containers.

Example:

Rule Details

FieldValue
IDIAC-0834
SeverityLOW
IaC Typedockerfile
FrameworksDocker
Checkov IDCKV_DOCKER_1

References