freeBuf
主站

分类

漏洞 工具 极客 Web安全 系统安全 网络安全 无线安全 设备/客户端安全 数据安全 安全管理 企业安全 工控安全

特色

头条 人物志 活动 视频 观点 招聘 报告 资讯 区块链安全 标准与合规 容器安全 公开课

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

如何使用route-detect在Web应用程序路由中扫描身份认证和授权漏洞
2024-02-24 00:55:25

关于route-detect

route-detect是一款功能强大的Web应用程序路由安全扫描工具,该工具可以帮助广大研究人员在Web应用程序路由中轻松识别和检测身份认证漏洞和授权漏洞。

Web应用程序HTTP路由中的身份认证(authn)和授权(authz)漏洞是目前最常见的Web安全问题,下列行业标准也足以突出证明了此类安全问题的严重性:

2021 OWASP Top 10 #1 - 访问控制中断

2021 OWASP Top 10 #7 - 身份验证失效

2023 OWASP API Top 10 #1 - 象级别授权中断

2023 OWASP API Top 10 #2 - 身份验证失效

2023 OWASP API Top 10 #5 - 功能级别授权中断

2023 CWE Top 25 #11 - CWE-862: 缺少授权

2023 CWE Top 25 #13 - CWE-287: 不正确的身份验证

2023 CWE Top 25 #20 - CWE-306: 关键功能缺少身份验证

2023 CWE Top 25 #24 - CWE-863: 不正确的授权

支持的Web框架

当前版本的route-detect支持下列Web框架:

Python: Django (django, django-rest-framework), Flask (flask), Sanic (sanic)

PHP: Laravel (laravel), Symfony (symfony), CakePHP (cakephp)

Ruby: Rails* (rails), Grape (grape)

Java: JAX-RS (jax-rs), Spring (spring)

Go: Gorilla (gorilla), Gin (gin), Chi (chi)

JavaScript/TypeScript: Express (express), React (react), Angular (angular)

工具安装

由于该工具使用Python开发,因此我们首先需要在本地设备上安装并配置好Python环境。

接下来,广大研究人员可以直接使用下列命令将该项目源码克隆至本地:

git clone https://github.com/mschwager/route-detect.git

或者直接使用pip工具安装最新版本的route-detect:

$ python -m pip install --upgrade route-detect

安装完成后,我们可以使用下列命令检测route-detect是否安装成功:

$ echo 'print(1 == 1)' | semgrep --config $(routes which test-route-detect) -

Scanning 1 file.

 

Findings:

 

  /tmp/stdin

     routes.rules.test-route-detect

        Found '1 == 1', your route-detect installation is working correctly

 

          1┆ print(1 == 1)

 

 

Ran 1 rule on 1 file: 1 finding.

工具使用

route-detect提供了routes命令并使用semgrep来搜索路由信息。

使用which子命令可以将semgrep指向正确的Web应用程序规则:

$ semgrep --config $(routes which django) path/to/django/code

使用viz子命令可以在浏览器中可视化查看路由信息:

$ semgrep --json --config $(routes which django) --output routes.json path/to/django/code

$ routes viz --browser routes.json

如果你不确定目标Web应用程序所使用的框架,可以使用all ID检索和查看:

$ semgrep --json --config $(routes which all) --output routes.json path/to/code

如果你有自己自定义的authn或authz逻辑,可以拷贝route-detect的规则:

$ cp $(routes which django) my-django.yml

我们还可以根据需求修改并运行规则:

$ semgrep --json --config my-django.yml --output routes.json path/to/django/code

$ routes viz --browser routes.json

工具运行截图

许可证协议

本项目的开发与发布遵循BSD-3-Clause开源许可证协议。

项目地址

route-detect:【GitHub传送门

参考资料

https://owasp.org/Top10/A01_2021-Broken_Access_Control/

https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures/

https://owasp.org/API-Security/editions/2023/en/0xa1-broken-object-level-authorization/

https://owasp.org/API-Security/editions/2023/en/0xa2-broken-authentication/

https://owasp.org/API-Security/editions/2023/en/0xa5-broken-function-level-authorization/

https://cwe.mitre.org/top25/archive/2023/2023_top25_list.html

https://github.com/returntocorp/semgrep

# web安全 # web应用安全 # 路由安全 # 身份认证 # 授权
本文为 独立观点,未经允许不得转载,授权请联系FreeBuf客服小蜜蜂,微信:freebee2022
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
相关推荐
  • 0 文章数
  • 0 关注者
文章目录