在 HTTP 请求中,您可以检查各种类型的网络请求,而在应用层攻击中,您只能访问已缓解的 HTTP 请求。这些请求可以通过 Cloudflare 的几种产品之一进行缓解,如 WAF、Cloudflare DDoS Protection、Cloudflare bot solutions 等。
由于我们正在调查攻击,我们可以检查攻击的双方——攻击的来源位置和目标位置。对于攻击的来源,Cloudflare 使用与 IP 相关的攻击来源位置(注意,攻击的人类策划者可能位于与攻击发起源计算机不同的位置)。对于攻击的目标位置,Cloudflare 使用与受攻击区域相关的计费位置。
这种根据攻击双方进行过滤的功能仅在 top locations 端点中可用。除非另有说明,其他端点按来源位置进行过滤,如攻击的发起位置。
攻击的规模由已缓解请求的总数定义。
与 HTTP 请求一样,这些端点可以分为获取时间序列的能力、汇总整个日期范围的单个值,以及主要位置列表。
让我们调查按产品划分的缓解请求的全球分布。
curl "https://api.cloudflare.com/client/v4/radar/attacks/layer7/timeseries_groups/mitigation_product?aggInterval=1h&dateRange=1d&name=attacks&format=json" \
--header "Authorization: Bearer <API_TOKEN>"从以下缩写的响应中,我们可以得出结论:分布式拒绝服务(DDoS)攻击构成了绝大多数请求——这是合理的,因为 DDoS 攻击就其本质而言,会执行更多请求。其次是 WAF,然后是 IP 信誉请求。
{
"success": true,
"errors": [],
"result": {
"attacks": {
"timestamps": ["2022-11-05T11:00:00Z", ".."],
"ddos": ["53.824302", "54.305823", ".."],
"waf": ["39.760956", "39.31228", ".."],
"ip_reputation": ["5.623487", "5.485468", ".."],
"access_rules": ["0.648368", "0.676456", ".."],
"bot_management": ["0.139733", "0.217155", ".."],
"api_shield": ["0.003154", "0.002819", ".."],
"data_loss_prevention": ["0.0", "0.0", ".."]
},
"meta": {
"dateRange": {
"startTime": "2022-11-05T11:00:00Z",
"endTime": "2022-11-06T11:00:00Z"
},
// ...
}
}
}有关更多信息,请参阅随着时间推移,通过缓解技术获取第 7 层攻击。
我们还可以按来源位置进行过滤,并检查来自特定位置的攻击——在以下示例中,我们将检查来自英国的攻击:
curl "https://api.cloudflare.com/client/v4/radar/attacks/layer7/summary?location=GB&name=attacks_gb&aggInterval=1h&dateRange=1d&format=json" \
--header "Authorization: Bearer <API_TOKEN>"{
"success": true,
"errors": [],
"result": {
"attacks_gb": {
"waf": "75.012138",
"ddos": "18.539149",
"ip_reputation": "5.721021",
"access_rules": "0.592515",
"bot_management": "0.131998",
"api_shield": "0.003178",
"data_loss_prevention": "0.0"
},
"meta": {
// ...
}
}
}该响应意味着来自英国的所有缓解请求中,有 75% 是由 WAF 产品缓解的。
有关更多信息,请参阅获取第 7 层攻击摘要。
在以下示例中,我们将检查过去 24 小时内应用层攻击中作为目标的主要位置:
curl "https://api.cloudflare.com/client/v4/radar/attacks/layer7/top/locations/target?name=attacks_target&limit=5&dateRange=1d&format=json" \
--header "Authorization: Bearer <API_TOKEN>"{
"success": true,
"errors": [],
"result": {
"attacks_target": [
{
"targetCountryName": "Belgium",
"targetCountryAlpha2": "BE",
"value": "18.536740",
"rank": 1
},
{
"targetCountryName": "United States",
"targetCountryAlpha2": "US",
"value": "16.116210",
"rank": 2
},
{
"targetCountryName": "China",
"targetCountryAlpha2": "CN",
"value": "13.864696",
"rank": 3
},
{
"targetCountryName": "India",
"targetCountryAlpha2": "IN",
"value": "4.344139",
"rank": 4
},
{
"targetCountryName": "Germany",
"targetCountryAlpha2": "DE",
"value": "4.182777",
"rank": 5
}
],
"meta": {
"dateRange": {
"startTime": "2022-11-05T12:00:00Z",
"endTime": "2022-11-06T12:00:00Z"
},
// ...
}
}
}在指定的日期范围内,向账单地址位于比利时的区域发起的缓解请求占 18%。
有关更多信息,请参阅获取第 7 层主要目标位置。
在过去 24 小时内,哪些源-目标位置对构成了最大攻击?
curl "https://api.cloudflare.com/client/v4/radar/attacks/layer7/top/attacks?limit=5&dateRange=1d&format=json" \
--header "Authorization: Bearer <API_TOKEN>"典型响应将类似于以下内容:
{
"success": true,
"errors": [],
"result": {
"top_0": [
{
"originCountryName": "United States",
"originCountryAlpha2": "US",
"targetCountryName": "United States",
"targetCountryAlpha2": "US",
"value": "3.790724",
"rank": 1
},
{
"originCountryName": "United States",
"originCountryAlpha2": "US",
"targetCountryName": "Belgium",
"targetCountryAlpha2": "BE",
"value": "3.602177",
"rank": 2
},
{
"originCountryName": "China",
"originCountryAlpha2": "CN",
"targetCountryName": "Netherlands",
"targetCountryAlpha2": "NL",
"value": "3.017341",
"rank": 3
},
{
"originCountryName": "China",
"originCountryAlpha2": "CN",
"targetCountryName": "China",
"targetCountryAlpha2": "CN",
"value": "2.472068",
"rank": 4
},
{
"originCountryName": "Indonesia",
"originCountryAlpha2": "ID",
"targetCountryName": "China",
"targetCountryAlpha2": "CN",
"value": "2.056729",
"rank": 5
}
],
"meta": {
// ...
}
}
}这意味着所有缓解请求的 3.79% 是往返于美国的,所有缓解请求的 3.6% 是从美国到比利时的,依此类推。
有关更多信息,请参阅获取第 7 层主要攻击对。
有关开放系统互连(OSI)模型第 3 层数据的更多信息,请参阅网络层攻击。