Page 1 of 1

[RESOLVED] XSS whitelisting

Posted: Mon Mar 26, 2012 8:51 pm
by Gazer75
Please make a simple way to white list for XSS. The regular expression cr*p is confusing. Been trying for months to figure out how to use it, not just for this, and not getting anywhere.
Why cant this list be a simple website list?

Can someone help me fix www.se.no/tv/ so I can use my tv guide again?

Thank you

Re: XSS whitelisting

Posted: Tue Mar 27, 2012 6:48 am
by Tom T.
Gazer75 wrote:Please make a simple way to white list for XSS. The regular expression cr*p is confusing. Been trying for months to figure out how to use it, not just for this, and not getting anywhere.
Why cant this list be a simple website list?
Probably because the detection and prevention of the various types of XSS, and the minimization of false positives, is more complex than simply whitelisting a script or site, though I could be mistaken.

As a quick-and-dirty work-around, this made the XSS notification go away for me:

Code: Select all

^https?://konto\.dagbladet\.no/.*
although since Javascript injection is in fact being reported, I'd rather have Giorgio look at this and see if it's a false positive or something genuinely amiss.

Ahh -- going further, a pop-up opens, asking for login creds, and that pop-up has a blocked object that requires further permission.

Code: Select all

Temporarily allow http://www.se.no/xdr/xd_receiver.html#fname=clientLogin$namespace=DB.Client
(text/html <IFRAME> / https://konto.dagbladet.no)
So yes, iFrame injection or similar appears to be going on. But everything else works, including all of the links.

Confirmed as also successfully removing the XSS notification on Fx 11.0 as well as 3.6.28.

I'll let him know. Please confirm that the work-around works in the meantime.

"The Big Bang Theory" is popular there? :)

@ Giorgio:

Code: Select all

[NoScript InjectionChecker] JavaScript Injection in ///api/xdr/dev/#host=www.se.no$xdr=xdr/xd_receiver.html$sf=checkServerLogin
(function anonymous() {host = www.se.no$xdr = xdr;DUMMY_EXPR;})

[NoScript XSS] Sanitized suspicious request. Original URL [https://konto.dagbladet.no/api/xdr/dev/#host=www.se.no$xdr=xdr/xd_receiver.html$sf=checkServerLogin] requested from [http://www.se.no/tv/#]. Sanitized URL: [https://konto.dagbladet.no/api/xdr/dev/#6425552468366076828].

Re: XSS whitelisting

Posted: Tue Mar 27, 2012 8:58 am
by Giorgio Maone
It is a false positive, indeed, caused by the weird hash parameters convention which overlaps with JavaScript syntax.
I'll try to "desensitize" the InjectionChecker module to this pattern in a future version.

In the meanwhile, thanks Tom T. for the suggested work-around, which can further be tweaked this way to be more specific:

Code: Select all

^https?://konto\.dagbladet\.no/[^<"']+#

Re: XSS whitelisting

Posted: Tue Mar 27, 2012 8:44 pm
by Gazer75
Thank you!

I love NoScript, but sometimes it makes me scratch my head :)

Sorry if the language was a bit harsh. Regex really makes me angry as I can't seem to figure out out it works...
Any good sites that can teach me?

Re: XSS whitelisting

Posted: Tue Mar 27, 2012 11:14 pm
by therube
Good or bad, don't know, but ... Wikipedia: Regular expression.

Re: XSS whitelisting

Posted: Wed Mar 28, 2012 3:04 am
by Tom T.
@ Gazer75:
therube wrote:Good or bad, don't know, but ... Wikipedia: Regular expression.
It's good, but to avoid information overload, I'd suggest focusing on "Basic Concepts", "Syntax", and "Posix" (including all subsections).
Else, it becomes overwhelming for the novice.

Perhaps let the webmaster know of the issue, and of Giorgio's recommendation to modify their syntax? Link to this thread...

@ Giorgio:
Thanks for the confirmation as false positive, the possible future tweak of InjectionChecker (can't anyone tell these sites not to use parameters that may collide with JS?), and the fine-tuning. It was near the end of my session, and I wanted to give OP *something* that would work while it was still fairly early in the indicated region's day. :)

Will mark as Resolved, thanks.

Re: [RESOLVED] XSS whitelisting

Posted: Thu Mar 29, 2012 12:06 am
by Giorgio Maone
Please check latest development build 2.3.7rc1: it should work even without exceptions.

Re: [RESOLVED] XSS whitelisting

Posted: Thu Mar 29, 2012 6:29 am
by Tom T.
Giorgio Maone wrote:Please check latest development build 2.3.7rc1: it should work even without exceptions.
Confirmed that with NS 2.3.7rc1, the site works all the way through the loading of the pop-up login box, with no XSS messages, nothing pertinent in Error Console, and with zero XSS exceptions, in both Fx 11.0 and (what's left of) Fx 3.6.28, thanks.

Re: [RESOLVED] XSS whitelisting

Posted: Thu Mar 29, 2012 9:36 am
by dhouwn
Considering regular expressions, http://perldoc.perl.org/perlre.html and https://developer.mozilla.org/en/JavaSc ... on_Pattern look like quite good summaries (in former you just need to ignore all the Perl-specific stuff).

Re: [RESOLVED] XSS whitelisting

Posted: Fri Mar 30, 2012 2:50 am
by Tom T.
dhouwn wrote:Considering regular expressions, http://perldoc.perl.org/perlre.html <snip> ignore all the Perl-specific stuff).
Consult a Perl guide, but ignore all Perl-specific stuff? ;)

Can't argue with the MDN link, but as the name implies, it's targeted to developers (presupposing a good bit of knowledge and experience). WP article seems more targeted to a lay audience, but it's OP's call.