阅读 Servlet 3.0 规范时,我发现了以下内容,想知道这是否真的是推荐的做法。出于安全原因,我记得曾收到建议不要包含此信息:
It is recommended that containers use the X-Powered-By HTTP header to publish its implementation information. The field value should consist of one or more implementation types, such as "Servlet/3.0". Optionally, the supplementary information of the container and the underlying Java platform can be added after the implementation type within parentheses. The container should be configurable to suppress this header. Here's the examples of this header:
X-Powered-By: Servlet/3.0 JSP/2.2 (GlassFish v3 JRE/1.6.0)
例如,here ,有人反对这种做法。我曾经使用一种工具来分析我的网站是否存在潜在问题,结果返回了安全警告和删除 X-Powered-By header 的建议。
最佳答案
通过模糊实现的安全是安全的“层”。由于它属于这种情况,最好隐藏该 header 而不是让它暴露。有自动化工具、扫描仪、机器人等会查找特定的服务器响应 header 。如果满足正确的条件,工具/机器人通常会执行其他功能,包括向主机发送漏洞。通过简单地隐藏 header ,您可以防止这些和其他类型的攻击。诚然,易受攻击的应用程序仍然是易受攻击的应用程序。无论如何......重点是,建议删除那些标题。安全性必须分层实现,防止应用程序底层框架的足迹是保护它的许多步骤中的第一步。
关于Java Servlet 3.0 规范建议公开 X-Powered-by。这不是安全不良做法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20570479/