【问题标题】:Xss VulnerabilityXss 漏洞
【发布时间】:2016-03-03 13:44:22
【问题描述】:

我使用 Acunetix Vulnerability Scanner 对我的 Web 应用程序进行了审核,开发人员报告告诉我:

/referentiels-web/j_spring_cas_security_check
Details
URL encoded GET input ticket was set to ST-1664-V7HlBALHdSMeqYmAjHL9-passeport01.brgm-rec.fr'"()&%<acx><ScRiPt>qvVq(9803)</ScRiPt>
>qvVq(9803)</ScRiPt>
GET /referentiels-web/authfailed.jsp;jsessionid=83A16DB68D05ECF865408DAC009A0DAF HTTP/1.1
Referer: https://myapp.com:443/referentiels-web/
Connection: Keep-alive
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko)
Chrome/41.0.2228.0 Safari/537.21
Accept: */*
Host: Rgf-ref.brgm-rec.fr

但是当 当我尝试重现这个 xss 漏洞时, 我无法重现,为什么..?

我的测试网址:

https://myapp.com:443/referentiels-web/authfailed.jsp;jsessionid=83A16DB68D05EC‌​F865408DAC009A0DAF?<sc ript>alert('test')</sc ript>

报告:

邮递员:

authfailed.jsp:

<%@ page import="org.springframework.security.core.AuthenticationException" %>
<%@ page import="org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter" %>
<%@ page import="org.springframework.security.web.WebAttributes" %>

<html>
<head>
    <title>Login to CAS failed!</title>
</head>

<body>
<h2>Login to CAS failed!</h2>

<font color="red">
    Your CAS credentials were rejected.<br/><br/>
    Reason: <%= ((AuthenticationException) session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION)).getMessage() %>
</font>

</body>
</html>

【问题讨论】:

  • 好吧,让我们从如何您尝试复制开始
  • @cricket_007 我已经这样做了https://myapp.com:443/referentiels-web/authfailed.jsp;jsessionid=83A16DB68D05ECF865408DAC009A0DAF?&lt;sc ript&gt;alert('test')&lt;/sc ript&gt;
  • 你在网址栏中输入了那个?我认为这不是 XSS,因为您的网站没有评估脚本标签
  • @cricket_007 是的,我在我的网址栏中输入了它
  • 长话短说,向用户显示堆栈跟踪是个坏主意,请不要这样做。这对用户体验不利(它使您的网站看起来笨拙和损坏),它对用户没有帮助(用户不阅读错误消息),并且在安全方面,它揭示了有关您的系统的不必要的细节,在这种情况下,它容易受到 XSS 攻击,因为您回显了一条异常消息,其中可能包含一些未经处理的用户输入。

标签: java jsp xss


【解决方案1】:

我可以从报告中看到脚本被设置到“票”GET输入中

试试这个网址:

https://myapp.com:443/referentiels-web/authfailed.jsp;jsessionid=83A16DB68D05EC‌​F865408DAC009A0DAF?ticket=ST-1664-V7HlBALHdSMeqYmAjHL9-passeport01.brgm-rec.fr'"()&%<ScRiPt>alert('test')</ScRiPt>

或编码的一个,如:

https://myapp.com:443/referentiels-web/authfailed.jsp;jsessionid=83A16DB68D05EC‌​F865408DAC009A0DAF?ticket=%53%54%2D%31%36%36%34%2D%56%37%48%6C%42%41%4C%48%64%53%4D%65%71%59%6D%41%6A%48%4C%39%2D%70%61%73%73%65%70%6F%72%74%30%31%2E%62%72%67%6D%2D%72%65%63%2E%66%72%27%22%28%29%26%25%3C%53%63%52%69%50%74%3E%61%6C%65%72%74%28%27%74%65%73%74%27%29%3C%2F%53%63%52%69%50%74%3E

https://myapp.com:443/referentiels-web/authfailed.jsp;jsessionid=83A16DB68D05EC‌​F865408DAC009A0DAF?ticket=U1QtMTY2NC1WN0hsQkFMSGRTTWVxWW1BakhMOS1wYXNzZXBvcnQwMS5icmdtLXJlYy5mciciKCkmJTxTY1JpUHQ+YWxlcnQoJ3Rlc3QnKTwvU2NSaVB0Pg==

【讨论】: