问题背景

什么是TCP timestamps(TCP 时间戳)?

The remote host implements TCP Timestamps, as defined by RFC1323 (https://www.ietf.org/rfc/rfc1323.txt). A side effect of this feature is that the uptime of the remote host can be sometimes be computed.

以前,TCP/IP 堆栈使用每个发送数据窗口的一个示例来计算 RTT  。 计时器 (发送) 时重新传输计时器报告,直到收到确认。TCP 时间戳选项现在可以在堆栈认为 (data 和 ACK) 使用,以执行如下操作:

  • RTT computation
  • PAWS check

使用TCP 时间戳,可以使用较大的窗口准确计算 RTT。 RTT 用于计算重新传输间隔。 要获得最佳吞吐量,需要准确的 RTT 和重新传输时间。

如何来解决呢?

禁用TCP timestamps。

在Linux系统中,在 /etc/sysclt.conf 文件中添加一行 “net.ipv4.tcp_timestamps=0”, 然后再执行 “sysctl -p”指令把修改的设置附加到运行环境。

To disable TCP timestamps on linux add the line 'net.ipv4.tcp_timestamps=0' to /etc/sysclt.conf. Execute 'sysctl -p' to apply the settings at runtime.

再Windows系统中,执行 "netsh int tcp set global timestamps = disabled "

TO disable TCP timestamps on Windows execute ' netsh int tcp set global timestamps = disabled '

问题描述

在Azure App Service中部署的Web App应用,在进行安全扫描的时候,发现了TCP timestamps的问题,建议Disable TCP Timestamps。但是根据安全描述中提示的指令在App Service的Kudu(https://<yourwebapp>.scm.chinacloudsites.cn/)中执行时,提示Deny。如图:

【Azure 应用服务】Azure Web App的服务(基于Windows 操作系统部署)在被安全漏洞扫描时发现了TCP timestamps漏洞-LMLPHP

问题解答

由于App Service是PaaS服务,用户没有权限禁用TCP Timestamp。在启用改属性后它带来的优点是能提升TCP的性能,它的弱点时被攻击者计算出系统远行的时间。

【Azure 应用服务】Azure Web App的服务(基于Windows 操作系统部署)在被安全漏洞扫描时发现了TCP timestamps漏洞-LMLPHP

 (Source:Beyond Security | Finding and Fixing Vulnerabilities in TCP Timestamps Retrieval , a Low Risk Vulnerability

而且,Azure App service实际上是在后端Worker上运行Web App的应用代码,而Worker前面有还有前端Front End和负载均衡Load Balancer来转发请求,所以客户端请求是不会直接到达Worker的。这也是Azure中PaaS服务的一种通常架构。而且在Azure中的服务天然受到Azure环境的保护。

同时,由于这是一个低等级的漏洞,考虑Web App运行在云环境中,而且如果禁用后也会影响性能等其他问题,所以它是可以忽略的。

附件一: TCP Timestamps扫描漏洞截图

【Azure 应用服务】Azure Web App的服务(基于Windows 操作系统部署)在被安全漏洞扫描时发现了TCP timestamps漏洞-LMLPHP

参考资料

TCP Windows说明:https://docs.microsoft.com/zh-cn/troubleshoot/windows-server/networking/description-tcp-features#timestamps

Finding and Fixing Vulnerabilities in TCP Timestamps Retrieval , a Low Risk Vulnerability:https://beyondsecurity.com/scan-pentest-network-vulnerabilities-tcp-timestamps-retrieval.html?cn-reloaded=1&cn-reloaded=1

RFC1323 :https://www.ietf.org/rfc/rfc1323.txt

认识 Azure安全性:https://www.trustcenter.cn/zh-cn/security/default.html

06-12 12:51