计算机工程与应用 ›› 2025, Vol. 61 ›› Issue (18): 309-316.DOI: 10.3778/j.issn.1002-8331.2408-0365

• 网络、通信与安全 • 上一篇    下一篇

基于ASLan++的OAuth2.0协议授权码模型形式化建模与分析

严海星   

  1. 福建医科大学 文理艺术学院,福州 350000
  • 出版日期:2025-09-15 发布日期:2025-09-15

Formal Modelling and Analysis of Authorization Code Model in OAuth 2.0 Protocol Based on ASLan++

YAN Haixing   

  1. School of Arts and Sciences, Fujian Medical University, Fuzhou 350000, China
  • Online:2025-09-15 Published:2025-09-15

摘要: OAuth2.0协议被广泛应用的同时,其安全性备受争议。针对授权码泄露和跨站请求伪造问题,对OAuth2.0协议中的授权码模型进行安全性研究。根据OAuth2.0协议标准,采用形式化建模语言ASLan++对授权码模型中的用户浏览器、第三方应用服务器和授权服务器进行形式化建模,分析模型的安全目标,并采用线性时态逻辑描述授权码模型的安全性质。使用基于SAT的模型检查器对授权码形式化模型进行模型检测,实验结果发现了8条被攻击的反例,其中7条反例证明了授权码模型存在授权码等重要参数泄露的问题,另外1条反例证明了授权码模型存在跨站请求伪造攻击的风险。在研究这些检测结果时,还发现了一种新的攻击——中间人攻击。它在用户浏览器和第三方应用服务器中充当第三者,在双方通信过程中窃取重要数据。分析了产生跨站请求伪造问题的原因,提出了一个增强授权码模型安全性的建议。

关键词: OAuth2.0协议, ASLan++, 形式化方法

Abstract: While OAuth2.0 protocol is widely used, its security is highly controversial. To address the problem of authorization code leakage and cross-site request forgery, the authorization code model in OAuth2.0 protocol is studied. Firstly, according to the OAuth2.0 protocol standard, user browsers, third-party application servers and authorization servers in the authorization code model are formally modelled by ASLan++ to analyze the security goals of the model, and linear temporal logic is used to describe the security properties of the authorization code model. Then a SAT-based model checker is used to perform model checking on the formal model of authorization code, and the result shows eight attacked counterexamples, seven of which prove that the authorization code model suffers from the leakage of important parameters such as authorization code, and the other one proves that the authorization code model is at risk of cross-site request forgery attacks. In addition, a new attack which called man-in-the-middle attack is found while studying the results. It acts as a third party between the user’s browsers and the third-party application servers and steals important data during the communication between the two parties. Finally, the causes of the cross-site request forgery problem are analyzed and a proposal is given to enhance the security of the authorization code model.

Key words: OAuth2.0 protocol, ASLan++, formal method