Live data from Hacker News

XSS Attacks: The Next Wave

snyk.io

41–47 of 47 posts

Re: XSS Attacks: The Next Wave

#41
I'm interested in the topic, but found the article quite disappointing. It doesn't really go into the technical details why we have a new wave of XSS vulns.

What I learned only recently: With many modern javascript frameworks many of the assumptions you may have had about XSS in the past are obsolete. The strategies that worked in the past - proper escaping of untrusted input - don't necessarily work any more if you're using something like angularjs.

Re: XSS Attacks: The Next Wave

#42

Why can't we tackle XSS in the browser, by preventing javascript from executing in the (or anywhere other than for that matter)? There is an old memory protection technique of designating the stack & heap (data portions of memory) as non-executable. It seems like a similar idea should apply to the web, where the DOM is effectively a "data" portion, and separate out all executable javascript into a separate section. I…

This already exists. It's called Content Security Policy. https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP

And it is an almighty pain in the arse to set up

Re: XSS Attacks: The Next Wave

#43

> Lastly, “DOM-based XSS” attacks occur purely in the browser when client-side JavaScript echoes back a portion of the URL onto the page. This Google Doc has tracked almost all "sinks" and "sources" for DOM-based XSS[1]. They aren't by any means limited to the URL (usually accessed by the `document.location` object). [1] https://docs.google.com/spreadsheets/d/1Mnuqkbs9L-s3QpQtUrOk...

You're right, I tried to keep this section as brief as I could. DOM Based XSS could happen from any source, but the hardest-to-detect (and very common) variant is using the fragment (the part after the #) to inject the payload, which is never sent to the user.

Re: XSS Attacks: The Next Wave

#44
post #41

I'm interested in the topic, but found the article quite disappointing. It doesn't really go into the technical details why we have a new wave of XSS vulns. What I learned only recently: With many modern javascript frameworks many of the assumptions you may have had about XSS in the past are obsolete. The strategies that worked in the past - proper escaping of untrusted input - don't necessarily work any more if you'…

This article was very much about the data we've collected and our analysis of it, as opposed to our opinions as to why - had to keep it to a reasonable length! So we kept that section short in the end. I do plan follow up posts that provide my theories as to why it's happening, and I think a best practices guide that discusses template-related XSS is a good idea. In the meantime, you can check out this related post: https://snyk.io/blog/type-manipulation/

Re: XSS Attacks: The Next Wave

#45
post #40
post #35

> AngularJS version 1, used at that point by approx. 30% of all websites :) Something got quoted wrong there.

I think they misread a chart from their source, which shows 0.3% market share for AngularJS: https://w3techs.com/technologies/history_overview/javascript...

awkward typo there! Fixed now.

Re: XSS Attacks: The Next Wave

#46

Earlier quoted context omitted.

This already exists. It's called Content Security Policy. https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP

And it is an almighty pain in the arse to set up

Unless you can influence an organisation at a pretty high level it is often impossible to write a useful CSP.

To take a really degenerate example, media sites tend to have so many third-party JS integrations (maps, multiple analytics providers, ad systems etc etc) that you can't write a useful, security-improving CSP :/

Which means talking to marketing about their preferred analytics tool, asking the business if they really want these ad networks etc etc.

Re: XSS Attacks: The Next Wave

#47
post #7
post #2

The rise in the client doing heavy lifting via libraries such as React is driving an increase in vulnerabilities. Developers getting into React don't always realize that all the code is executed in the client and any input validation and authentication they come up with has to also exist on the server storing that data.

React by default has pretty good XSS protection. That being said, "don't trust the client" has been something developers have struggled with ever since we started writing client/server software.

Not just pretty good, I mean to show code unescaped you need to write `dangerouslySetInnerHTML`.

I think it's a common misconception, heavy-weight software usually does pretty well with common problems. If you think of frameworks like Rails which make input validation easy, writing manual SQL almost obsolete (SQL injection) and even CSRF protection happens mostly transparently.

Post reply on HN