Apache Tomcat Security Best Practices:

Apache Tomcat Security Best Practices:

. Don't run Tomcat as the root user

This line of ?er accounts with a high level of administrative access. In Tomcat's case, a user with the minimum necessary OS permissions should be created exclusively to run the Tomcat process.

2. Remove any default sample or test web applications

Most web server platforms also provide a set of sample or test web application for demo and learning purposes. These applications have been known to harbor?vulnerabilities, and should be removed if not in use. Tomcat's examples web application is an application that should be removed to prevent exploitation.

3. Put Tomcat's shutdown procedure on lockdown

This prevents malicious actors from shutting down Tomcat's web services. Either disable the shutdown port by setting the?port?attribute in the?server.xml?file to?-1. If the port must be kept open, be sure to configure a strong password for shutdown.

4. Disable support for TRACE requests

Though useful for debugging, enabling?allowTrace?can expose some browsers to an?cross-site scripting XSS attack. This can be mitigated by disabling allowTrace in the?server.xml?file.

5. Disable sending of the X-Powered-By HTTP header

If enabled, Tomcat will send information such as?the Servlet and JSP specification versions and the full Tomcat version, among others. This gives attackers a workable starting point to craft an attack. To prevent this information leakage, disable the?xpoweredBy?attribute in the?server.xml?file.

6. Disable SSLv3 to prevent POODLE attacks

POODLE is a?SSL?v3 protocol vulnerability discovered in 2014.?An attacker can gain access to sensitive information such as?passwords and browser cookies by exploiting this vulnerability; subsequently, SSL v3 (and SSL in general) should not?be included?in?server.xml file?under?the?sslEnabledProtocols?attribute.

Enforce HTTPS


7. Set the deployXML attribute to false in a hosted environment

The prevents would-be attackers from attempting to increase privileges to a web application by packaging an altered/custom context.xml. This is especially critical in hosted environments where other web applications sharing the same server resources cannot be trusted.

8. Configure and use realms judiciously

Tomcat's realms are designed differently and their limitations should be understood before use. For example,?the?DataSourceRealm?should be used in place of the?JDBCRealm, as the latter is single threaded for all authentication/authorization options and not?suited for production use. The??JAASRealm?should also be avoided, as it is seldom used and sports an immature codebase.

9. Set Tomcat to create new facade object for each request

This can be configured by setting the?org.apache.catalina.connector.RECYCLE_FACADES?system property to?true. By doing this, you reduce the chance of a buggy application exposing data between requests.

10. Ensure that access to resources is set to read-only

This?can be done by setting?readonly?to?true?under?DefaultServlet,?effectively?preventing clients?from?deleting/modifying static resources on the server and uploading new resources.

11. Disable Tomcat from displaying directory listings

Listing the contents of directories with a large number of files can consume considerable system resources, and can therefore be used in a denial-of-service (DoS) attack. Setting?listings?to?false?under?DefaultServlet?mitigates this risk.

12. Enable logging of network traffic

In general, logs should generated and maintained on all levels (e.g., user access, Tomcat internals, et al), but network traffic logging is especially useful for breach assessment and forensics. To set up your Tomcat application to create logs of network traffic, use/configure the?AccessLogValve?component.

13. Disable automated deployment if not in use

If you're running a fully-realized CI/CD pipeline, good for you—you'll need?full use of?Tomcat's?host components. However, if not—be sure to?set all?the host?attributes to?false?(autoDeploy, deployOnStartup,?and?deployXML)?to prevent them from being compromised by an attacker.

14. Disable or limit the Tomcat Manager Webapp

Tomcat Manager enables?easy configuration and management of Tomcat instances?through one web interface.?Convenient, no doubt—for both authorized administrators and attackers.?Alternative methods for?administering Tomcat instances are therefore better, but if Tomcat Manager must be used, be sure to use its?configuration options to limit your risk exposure.

15. Limit the availability of connectors

Connectors by default listen to all interfaces. For better security, they should only listen to those required by your web application and ignore the rest.?This can be accomplished?by setting the?address?attribute of the connector element.

1.?????????????Replace default 404, 403, 500 page

2.?????????????Add Secure & HttpOnly flag to Cookie

3.?????????????Remove Server Banner

要查看或添加评论,请登录

Rajeev kumar的更多文章

  • Network Security Attack Types

    Network Security Attack Types

    Glossary Description ARP spoofing is the process of linking an attacker’s MAC address with the IP address of a…

  • Indicators of Compromise

    Indicators of Compromise

    Indicators of Compromise Indicators of compromise (IOCs) serve as forensic evidence of potential intrusions, unusual…

  • Data Privacy

    Data Privacy

    Data Privacy Day, January 28 In 2006, the Council of Europe decided to launch a Data Protection Day, to be celebrated…

  • Spam vs Phishing

    Spam vs Phishing

    It is not surprising that most of us have encountered numerous spam and phishing emails in our inbox and believe it or…

  • Slack (Messenger) Security Best Practices

    Slack (Messenger) Security Best Practices

    While Slack gives us immense flexibility and convenience while connecting with people, it gives a gateway to bad actors…

  • Remote Workers - Cyber Security Advice

    Remote Workers - Cyber Security Advice

    Unfortunately, remote working and cybersecurity concerns go hand in hand. Individuals and corporations continue to face…

  • How To Handle Phishing Emails

    How To Handle Phishing Emails

    1. If you receive a phishing e-mail message, do not respond to it.

  • GCP - Security Best Practices

    GCP - Security Best Practices

    Summary of Topics A. Using IAM Securely B.

  • Firewall Rules – Best Practices

    Firewall Rules – Best Practices

    1. Document your firewall rules - Use Comments to Explain the Purpose of Special Rules Anyone who works on your IT…

  • Bypassing MFA

    Bypassing MFA

    Bypassing MFA Independent of which authentication technology you use, implementation flaws and misconfigurations can…

社区洞察

其他会员也浏览了