如何使用route-detect在Web应用程序路由中扫描身份认证和授权漏洞

2024-03-27 963 0

关于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


4A评测 - 免责申明

本站提供的一切软件、教程和内容信息仅限用于学习和研究目的。

不得将上述内容用于商业或者非法用途,否则一切后果请用户自负。

本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。

如果您喜欢该程序,请支持正版,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。敬请谅解!

程序来源网络,不确保不包含木马病毒等危险内容,请在确保安全的情况下或使用虚拟机使用。

侵权违规投诉邮箱:4ablog168#gmail.com(#换成@)

相关文章

苹果试图保护你的隐私,OpenAI可能做不到
Shuffle:一款完全自动化的安全栈增强平台
如何使用CODASM编码Payload并降低熵值
SessionExec:一款针对会话安全的安全命令测试工具
Arkime:一款大规模数据包捕获和索引数据库系统
从蓝队流量角度分析Shiro-550反序列化漏洞

发布评论