Disable the Shutdown port (Automated)
Description
Tomcat listens on TCP port 8005 to accept shutdown requests. By connecting to this port and sending the SHUTDOWN command, all applications within Tomcat are halted. The shutdown port is not exposed to the network as it is bound to the loopback interface. If this functionality is not used, it is recommended that the shutdown port be disabled.
Rationale
Disabling the Shutdown port will eliminate the risk of malicious local entities using the shutdown command to disable the Tomcat server.
Audit Procedure
Perform the following to determine if the shutdown port has been disabled: Ensure the port attribute in $CATALINA_HOME/conf/server.xml is set to -1.
$ cd $CATALINA_HOME/conf/
$ grep '<Server[[:space:]]\+\[[^]]*port[[:space:]]*=[[:space:]]*"[[:space:]]*-1"' server.xml
Remediation
Set the port to -1 in the $CATALINA_HOME/conf/server.xml to disable the shutdown port:
<Server port="-1" shutdown="SHUTDOWN">
Default Value
The shutdown port is enabled on TCP port 8005, bound to the loopback address.
References
- https://tomcat.apache.org/tomcat-9.0-doc/config/server.html
CIS Controls
v8:
- 4.4 Implement and Manage a Firewall on Servers
- Implement and manage a firewall on servers, where supported. Example implementations include a virtual firewall, operating system firewall, or a third-party firewall agent.
- 4.8 Uninstall or Disable Unnecessary Services on Enterprise Assets and Software
- Uninstall or disable unnecessary services on enterprise assets and software, such as an unused file sharing service, web application module, or service function.
v7:
- 1.7 Deploy Port Level Access Control
- Utilize port level access control, following 802.1x standards, to control which devices can authenticate to the network. The authentication system shall be tied into the hardware asset inventory data to ensure only authorized devices can connect to the network.
- 9.2 Ensure Only Approved Ports, Protocols and Services Are Running
- Ensure that only network ports, protocols, and services listening on a system with validated business needs, are running on each system.
Profile Applicability
1---2name: cis-tomcat10-v110-3-23description: "Disable the Shutdown port (Automated)"4category: cis-tomcat5version: "1.1.0"6author: cyberstrike-official7tags: [cis, tomcat, linux, java, shutdown, port]8cis_id: "3.2"9cis_benchmark: "CIS Apache Tomcat 10 Benchmark v1.1.0"10tech_stack: [linux, tomcat, java]11cwe_ids: []12chains_with: []13prerequisites: []14severity_boost: {}15metadata:16 source: https://skillmd.com/skills/cyberstrikeus/cis-tomcat10-v110-3-217---1819# Disable the Shutdown port (Automated)2021## Description2223Tomcat listens on TCP port 8005 to accept shutdown requests. By connecting to this port and sending the SHUTDOWN command, all applications within Tomcat are halted. The shutdown port is not exposed to the network as it is bound to the loopback interface. If this functionality is not used, it is recommended that the shutdown port be disabled.2425## Rationale2627Disabling the Shutdown port will eliminate the risk of malicious local entities using the shutdown command to disable the Tomcat server.2829## Audit Procedure3031Perform the following to determine if the shutdown port has been disabled: Ensure the port attribute in `$CATALINA_HOME/conf/server.xml` is set to -1.3233```bash34$ cd $CATALINA_HOME/conf/35$ grep '<Server[[:space:]]\+\[[^]]*port[[:space:]]*=[[:space:]]*"[[:space:]]*-1"' server.xml36```3738## Remediation3940Set the port to -1 in the `$CATALINA_HOME/conf/server.xml` to disable the shutdown port:4142```xml43<Server port="-1" shutdown="SHUTDOWN">44```4546## Default Value4748The shutdown port is enabled on TCP port 8005, bound to the loopback address.4950## References51521. https://tomcat.apache.org/tomcat-9.0-doc/config/server.html5354## CIS Controls5556**v8:**5758- 4.4 Implement and Manage a Firewall on Servers59 - Implement and manage a firewall on servers, where supported. Example implementations include a virtual firewall, operating system firewall, or a third-party firewall agent.60- 4.8 Uninstall or Disable Unnecessary Services on Enterprise Assets and Software61 - Uninstall or disable unnecessary services on enterprise assets and software, such as an unused file sharing service, web application module, or service function.6263**v7:**6465- 1.7 Deploy Port Level Access Control66 - Utilize port level access control, following 802.1x standards, to control which devices can authenticate to the network. The authentication system shall be tied into the hardware asset inventory data to ensure only authorized devices can connect to the network.67- 9.2 Ensure Only Approved Ports, Protocols and Services Are Running68 - Ensure that only network ports, protocols, and services listening on a system with validated business needs, are running on each system.6970## Profile Applicability7172- Level 2