user.js icon indicating copy to clipboard operation
user.js copied to clipboard

Q: What does NS have (or will have) that uBo+uM don't

Open Thorin-II opened this issue 8 years ago • 88 comments

Question: I still do not fully understand what NS offers that uBo+uM don't.

  • Something about XSS (isn't that covered or is this some special NS thing)
  • Something about ABE
  • Something about ClearClick
  • inclusion type checking?

People have suggested (eg reddit, and here) that you can use NS in global allow mode but leave those four items above as active. Personally I never got an XSS warning from NS (maybe one a year), and the new WebExt version (not sure where they are at) I do not really want to touch with a barge pole (yet, if ever)

Aren't these things in uBo/uM - if not, why not?

@gorhill @Atavic excuse my ignorance, ELI5

Thorin-II avatar Dec 25 '17 22:12 Thorin-II

uMatrix - NoScript Related: https://github.com/gorhill/uMatrix/issues/297 NoScript info in italian.

Atavic avatar Dec 26 '17 00:12 Atavic

XSS

To answer earthlng's q in the other thread - https://noscript.net/features#xss & also https://noscript.net/faq#qa4_1 . This is obviously the legacy version. I tend to just use XSS as a term to cover all third party scripts and I control it by default denying 3rd parties in uBo etc, and with uM.

In all my years of NS (which always got the requests first before uBo etc), I have only ever had a couple of warnings for this XSS

ClearClicking

https://noscript.net/faq#qa7_1

ABE

https://noscript.net/faq#qa8_1

Thorin-II avatar Dec 26 '17 03:12 Thorin-II

A lot of this info is old. AFAIK clickjacking is nigh impossible now?

Thorin-II avatar Dec 26 '17 03:12 Thorin-II

I think you don't have to worry much about clickjacking if you deny third-party frames (and/or javascript, of course).

EDIT: IIRC it was also tackled at browser-level at some point. Now I just have to remember where I read that...

EDIT 2: Well, yes and no. What I read was about the X-Frame-Options HTTP header which has been around for about 8 years (according to Wikipedia). Firefox did adopt this header, but it's only a server-side solution.

claustromaniac avatar Dec 26 '17 03:12 claustromaniac

EDIT: IIRC it was also tackled at browser-level at some point

Yeah, I remember reading a couple of bugzillas that covered this. As for denying 3rd party iframes - that's just the first level of defence .. some sites you may need to allow those which means you are at risk (you cannot trust any site is my motto - its not IF but WHEN they get hacked)

Thorin-II avatar Dec 26 '17 05:12 Thorin-II

Sorry, I haven't used Noscript for a long time but are there any Noscripts ABE rules which can not be handled using uMatrix ?

for example the following is the default, may be the only and mostly used, ABE rule in Noscript.

# Noscript
# Prevent Internet sites from requesting LAN resources.

Site LOCAL
Accept from LOCAL
Deny

We can rewrite it easily in the uMatrix way:

[Source]              * -> any external resource 
[Destination] 127.0.0.1 -> which tries to access the localhost or local resources
[Content]             * -> whatever the request or the requested content is ..
[action]          block -> should be BLOCKED
# uMatrix
# Prevent Internet sites from requesting LAN resources.

* 127.0.0.1 * block
* localhost * block    
* [::1]     * block       // block access to ipv6 localhost
* 192.168   * block       // block access to LAN 192.168.x.x

The best practice is to use a separate browser for accessing local resources or using a temporary allow if needed ... but for those who need it permanently

# uMatrix
# Accept from LOCAL

127.0.0.1 127.0.0.1 * allow
localhost localhost * allow
[::1]     [::1]     * allow
192.168   192.168   * allow

btw, don't forget to remove the matrix-off: localhost true rule.

theWalkingDuck avatar Dec 26 '17 13:12 theWalkingDuck

don't forget to remove the matrix-off: localhost true rule

I have no idea why I added this built-in rule. I will remove it.

gorhill avatar Dec 26 '17 14:12 gorhill

Look for types of XSS here. OWASP has many info about it, mainly server-side. Look at this PDF on page 24 for info about ABE Rules.

Atavic avatar Dec 26 '17 14:12 Atavic

Also here for OWASP info.

Atavic avatar Dec 26 '17 16:12 Atavic

56743 .. warning! 17 years old :grin: - bit of a moot ticket for uM users => * * frame block

Thorin-II avatar Dec 27 '17 01:12 Thorin-II

OK, this is good: http://vojtechruzicka.com/preventing-clickjacking/

Thorin-II avatar Dec 27 '17 02:12 Thorin-II

@Thorin-Oakenpants very nice, thanks!

claustromaniac avatar Dec 27 '17 02:12 claustromaniac

FYI: what does uM have that NS doesn't? rhetorical question

add ability to block web workers on a per-site basis

  • https://github.com/gorhill/uMatrix/commit/deeb211c5d489af02fabe419c33e3ae15d3d291e

Thorin-II avatar Jan 01 '18 00:01 Thorin-II

FYI: note, I can't link to the individual review/reply (its on AMO's NS reviews page), so here's a cropped screenie

screenie

HOWEVER, if you're after security, you cannot rely on uMatrix over NoScript. For instance, even if you're blocking scripts with uMatrix on a site you don't trust, it can execute JavaScript by exploiting cross-site request vulnerabilities on a site you trust. This is prevented by NoScript's anti-XSS filter.

I still fail to see what NS's so called anti-XSS offers that uMatrix (with all 3p blocked by default) doesn't. It is some special XSS type attack detection to block sh*t even when you allow it by default (I have no idea what NS's defaults are, but I would assume little breakage and not in a hard mode)

Thorin-II avatar Jan 01 '18 23:01 Thorin-II

I believe the scenario he has in mind is:

  1. site X is suffering from an XSS vulnerability
  2. victim allows script execution on site X
  3. an attacker knows about this vulnerability
  4. attacker controls site Y
  5. victim visits site Y
  6. attacker sends victim to vulnerable site X along with a malicious js payload which will be injected somehow by triggering the vulnerability
  7. malicious javascript payload can then observe all what victim does on site X, including stealing victim's credentials if any

(in step 5-6, the victim could be simply given a specially crafted URL by the attacker, or by an innocent intermediate -- see https://excess-xss.com/).

So the way I understand, this requires to examine 3rd-party POST requests for main document (like when submitting a form).

I have collated cases regarding how blindly allowing 3rd-party frames is a security issue: https://github.com/gorhill/uBlock/wiki/Dynamic-filtering:-Benefits-of-blocking-3rd-party-iframe-tags#malware-protection. By no mean complete, these are just all cases for which I confirmed blocking 3rd-party frames would have foiled the attack (there is a case in there I emailed the author to confirm whether the attack was iframe-based, this was not clear from the article). There are more cases reported in the media I left out which required that 3rd-party scripts be blocked (that wasn't the topic of the wiki page).

The fact that he describes the blocking of 3rd-party scripts/frames as "disabl[ing] annoying stuff" means he is trying to belittle uMatrix -- there is no way to sensibly describe malvertising as "annoying" -- I don't think he is helping himself by describing the real actual ongoing threat of malvertising (again see list of actual cases above) as merely "annoying".

Now what I long for is such a list of real, actual documented cases where specifically only NoScript's XSS would have protected its users. Whatever threat someone wants to be protected against, an important factor is for users to be able to assess the likelihood of it happening. Surely such a list of actual, real documented cases would be the best way to convince users of how the importance of the feature relative to other threats (3rd-party frames, scripts, etc.)

On my side, I will read more about all this and see what could be sensibly added to uMatrix.

gorhill avatar Jan 02 '18 00:01 gorhill

:+1: Malvertising could be more appropriate.

An example of such "annoying stuff" could be file-hosting sites like that old one, rapidshare.

Atavic avatar Jan 02 '18 23:01 Atavic

From this thread: https://www.ghacks.net/2017/12/30/noscript-webextension-update-improves-user-interface/#comment-4325925

surrogate scripts ...

Essentially mirroring a library, or a modified version of a given library (e.g. mootools, or jquery). uBlock used to have this.

Decentraleyes does this, but that still doesn't stop the JS from executing


Now what I long for is such a list of real, actual documented cases where specifically only NoScript's XSS would have protected its users

As per Atavic's link, the last couple of comments from @berrythesoftwarecodeprogrammar (they're at the end) - https://github.com/gorhill/uMatrix/issues/297

The two XSS examples are hopefully still up and running, and maybe someone can work out what they are doing that NS picks up on and blocks

Thorin-II avatar Jan 03 '18 02:01 Thorin-II

Essentially mirroring a library, or a modified version of a given library (e.g. mootools, or jquery).

Decentraleyes does this, but that still doesn't stop the JS from executing

For what it's worth, Decentreleyes does have the option to block scripts when the necessary CDN resource aren't available.

Ultimately, you can make Decentraleyes block requests for any missing CDN resources, too. GitHub page

In settings, there's the option to "Block requests for missing resources - Cancel intercepted request if the required resource is not locally available."

uBlock used to have this.

As far as I'm aware, uBO still uses some local, neutered versions of some commons scripts, doesn't it?

overdodactyl avatar Jan 03 '18 04:01 overdodactyl

uBO used to have an experimental feature called "local mirroring" a long time ago. In the end I canned it, this is best left to a dedicated extension.

The current neutered scripts feature is really just scriplets served through redirection to local data: URIs, and it apply only to blocked requests, never to non-blocked requests.

gorhill avatar Jan 03 '18 04:01 gorhill

Thanks for the clarification @gorhill! I wasn't aware of the local mirroring feature

If you don't mind the follow up question, do you use Decentraleyes + uBO via the method mentioned on the Decentraleyes wiki page then? (set up noop rules, then enable the block requests for missing resources option)

overdodactyl avatar Jan 03 '18 05:01 overdodactyl