我打算为现有应用构建一个委托(delegate)登录系统。我将实现 OAuth 客户端(在 Web 应用程序中)和 OAuth 服务器(一个简单的授权和资源服务器,目前实际上只有一个“用户”资源。)
考虑到这一点,我在当前 OAuth 2 draft 中看到了以下部分(第 22 版):
3.1.2.1. Endpoint Request Confidentiality
If a redirection request will result in the transmission of an
authorization code or access token over an open network (between the
resource owner's user-agent and the client), the client SHOULD
require the use of a transport-layer security mechanism.
Lack of transport-layer security can have a severe impact on the
security of the client and the protected resources it is authorized
to access. The use of transport-layer security is particularly
critical when the authorization process is used as a form of
delegated end-user authentication by the client (e.g. third-party
sign-in service).
这特别警告我应该在客户端上使用 TLS。当然,我们将在服务器上使用 HTTPS,但即使不是不可能,也很难在所有客户端上启用 HTTPS。
根据我对安全性的有限了解,我想有人可能会窃取授权授予。这引出了我的问题:
客户端身份验证(使用客户端密码)不会阻止窃听者使用授权授予吗?(因为恶意方不会知道客户端密码,希望。)
如果没有,或者如果这里有另一个我没有看到的攻击媒介,我能做些什么来使这项工作在客户端上没有 HTTPS 的情况下安全地进行吗?例如,OAuth 1 会有帮助吗? (可能是因为它有额外的请求 token 步骤。)
P.S.:我正计划使用 TLS 客户端证书而不是 secret 进行客户端身份验证,如果这样可以使情况好转的话。
最佳答案
我认为您误解了此警告的一部分。此 OAuth 警告针对 OWASP A9违规行为。这就是说,即使您使用的是 OAuth,您仍然需要一个安全的传输层来与客户端通信。客户端不需要 key 对进行身份验证,OAuth 是客户端的身份验证形式。但是,浏览器仍然使用存储为 cookie 值的 session ID 对您的应用程序进行身份验证。令人担忧的是,如果攻击者能够截获此值,那么他将拥有与受害客户端相同的访问权限。
关于security - OAuth 2 客户端真的需要 TLS 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8378664/