Acta Scientiarum Naturalium Universitatis Pekinensis ›› 2018, Vol. 54 ›› Issue (2): 320-330.DOI: 10.13209/j.0479-8023.2017.172

Previous Articles     Next Articles

Cross Site Script Prevention Based on Delimiters

ZHANG Huilin1,2, LI Guancheng1, DING Yu1, DUAN Lei1, HAN Xinhui1,†, XIAO Jianguo1   

  1. 1. Institute of Computer Science and Technology, Peking University, Beijing 100871
    2. National Computer Network Emergency Response Technical Team/Coordination Center of China, Beijing 100029
  • Received:2017-02-08 Revised:2017-03-01 Online:2018-03-20 Published:2018-03-20
  • Contact: HAN Xinhui, E-mail: hanxinhui(at)pku.edu.cn

基于分隔符的跨站脚本攻击防御方法

张慧琳1,2, 李冠成1, 丁羽1, 段镭1, 韩心慧1,†, 肖建国1   

  1. 1. 北京大学计算机科学技术研究所, 北京100871
    2. 国家计算机网络应急技术处理协调中心, 北京100029
  • 通讯作者: 韩心慧, E-mail: hanxinhui(at)pku.edu.cn
  • 基金资助:
    国家发展和改革委员会2011年信息安全专项《信息系统个人信息保护标准体系建设及关键标准研究验证》资助

Abstract:

The authors propose a practical and accurate cross site script prevention method based on delimiters for UTF-8 encoded web applications. Only trusted delimiters are tainted into corresponding UTF-8 shadow bytes, and these tainted shadow bytes are automatically propagated in web applications and can be directly delivered into output pages. Cross site script is prevented by analyzing the tainted delimiters and HTML context of output pages. A prototype called XSSCleaner is implemented on PHP. The evaluation shows that XSSCleaner can accurately protect web applications from real world cross site script attacks with an average overhead 12.9%.

Key words: cross site script, delimiter, dynamic taint analysis, positive taint, shadow bytes, context

摘要:

通过分析跨站脚本攻击的特性, 提出一种基于分隔符的跨站脚本攻击防御方法, 该方法适用于UTF-8编码的Web应用程序。首先, 仅对可信数据中的分隔符进行积极污点标记; 然后, 利用字符UTF-8编码值的转换轻量级完成污点标记, 该污点信息可随着字符串操作直接传播到结果页面; 最后, 根据结果页面中分隔符的污点信息及页面上下文分析, 检查脚本执行节点的合法性和脚本内容的可靠性, 精确地检测并防御跨站脚本攻击。针对PHP平台实现了原型系统XSSCleaner。实验证明, XSSCleaner可轻量级地完成污点分析, 并且能够对跨站脚本攻击进行精确防御, 页面生成的时间开销平均为12.9%。

关键词: 跨站脚本攻击, 分隔符, 动态污点分析, 积极污点标记, 影子字节, 页面上下文

CLC Number: