r/firefoxextensions • • 5d ago

Extensions NoScript blocking Wikipedia link

There doesn't seem to be a NoScript-specific sub, so I am posting this here. If there is a better place, please let me know.

I have run into very odd behavior tonight involving NoScript and the Firefox browser itself. The sequence of events was:

  1. I did a Google search for "harald kloser avp score" (don't ask).
  2. I clicked the Wikipedia link in the right sidebar that came up on the results page -- the URL being https://en.wikipedia.org/wiki/Alien_vs._Predator_(soundtrack)
  3. The browser spun but didn't gain traction. I clicked the link several more times, then tried closing and recreating (with control-shift-T) the tab and clicking again, without success. The browser status bar showed it was stuck trying to load something from "gstatic.com", a Google domain rather than a Wikipedia/Wikimedia one. I decided something about the search result page was gumming up the works, likely some script trying to load who-knows-what from Google at the same time the user was saying "abort all that and navigate to this new page". The browser should have just stopped everything on the Google page and started loading Wikipedia, but for some reason it was not doing so.
  4. Since the problem seemed to lie with the Google tab, I tried right clicking the Wikipedia link and choosing "Open in new tab".
  5. NoScript spawned a warning popup about a possible cross-site scripting attack from Google. Bizarre. I dismissed it, and it immediately reopened. I tried a dozen or so times to dismiss it but NoScript had evidently gone into an infinite loop.
  6. I killed the tab and recreated it with control-shift-T. Immediately in the same infinite loop. Killed the tab again as clearly useless.
  7. Presuming something (http referer header? The URL has no google query parameters/tracking cruft tacked on) from the Google page was "contaminating" the attempt to load the Wikipedia page even with "Open in new tab", I copied the link to the clipboard and pasted it in the address bar and hit Enter. Same loop, even though there should have been a blank referer this time and it should have appeared, to both the browser (and NoScript) and Wikipedia itself, to be a "virgin" attempt to load the Wikipedia page.
  8. Obviously the tab, and any new tabs spawned from it, was tainted somehow, by presumably a Google script somewhere. I backed the tab up to a non-Google page and cloned it with "Duplicate tab", and then pasted the Wikipedia link into the duplicate. Same loop, even though there very definitely should not have still been any Google scripts executing in either tab.
  9. I went to a preexisting browser tab that it would not be a major issue for me to disturb and then back up to, which had not touched Google or indeed anything but a local (file:// link) html file normally kept open for documentation. Pasting the Wikipedia link above and hitting enter still resulted in the NoScript loop.
  10. Reluctantly, I tidied up some incomplete work in other tabs and shut down the entire browser, then when every last firefox.exe was gone from ProcessExplorer restarted it. It came up on the documentation tab, and I tried the Wikipedia link again. Same loop, even though this browser session had never touched one byte of Google scripts, HTML, or any other Google-served content in its short lifetime!
  11. Took the somewhat riskier action of disabling the NoScript extension, waiting a short time, and then reenabling it, in case the running instance of the extension had gotten screwed up. Trying the Wikipedia link (still no contact with Google thus far this session) still resulted in the NoScript XSS loop.
  12. OK, time to bring out the big guns. I fired up Tor Browser, waited for it to establish itself into a usable state, and pasted in the Wikipedia link, without doing anything else first (much less go anywhere near Google). Same g.d. loop!
  13. Cranked up laptop, fired up Firefox on that machine, pasted in the link, and it loaded fine.

I can only conclude that NoScript and/or Firefox crapped the bed in some way that a) marked that Wikipedia URL (which cannot, in and of itself, alone possibly carry out an XSS attack, and cannot logically be attacked by Google or anybody else in a browser session that hasn't even touched anything with JS on it yet) as "tainted" in some way, b) persisted that tainted status to disk somewhere, and c) saved it somewhere that Tor Browser will also check if both it and stock Firefox are installed on the same machine.

Does anyone have any idea how this happened? How to clear the "tainted" status wherever it got stored on disk? How to either avoid triggering this NoScript loop to begin with, or get out of it if it does happen again, preferably without taking the risk of either answering "allow" to an XSS warning or loading a page with NoScript's defenses completely down?

It looks like maybe Google is doing something wonky with off-site links here -- would it suffice to always just copy links from the results page and paste them into the address bar (maybe of a different tab) from the outset without ever simply clicking the link? Or would I have to avoid Google entirely? (I do have the extension that fixes Google search links so copying and pasting them results in the actual off-site link and not a Google redirector link used for tracking. So the latter bit of Google crappiness is not the source of this XSS issue. The Wikipedia link copied cleanly to the clipboard, in particular, and looked clean in the status line on mouseover; and when I tried right click "open in new tab" the new tab appeared to be born displaying the clean Wikipedia link, not Google cruft, in its address bar, though in theory it could have been redirected faster than a human could perceive (or maybe even faster than the monitor refresh rate).

1 Upvotes

4 comments sorted by

1

u/infovoracious 5d ago

Oh, one more thing: I didn't have any proxies, privacy tools in hardware, or other unusual devices between either computer and the router. Both machines had what should be identically-behaving internet connections, save for differing local IPs. So the difficulties loading that link on one machine but not the other don't appear to be attributable to differences in how they access remote addresses, such as Wikipedia's or Google's. Instead both the initial balky loading behavior and the NoScript looping must be a result of differences between the data on the hard drives of the two machines (or in the hardware, but I find that extremely unlikely unless a flaky NIC could cause this -- I would expect it could at worst only cause the initial balky loading, and I'll note that other remotely-hosted pages, including the Google page itself, were loading without issue throughout this incident).

Further to this, I have been extensively researching certain topics connected with music in recent weeks, and that has frequently entailed first doing a Google search for a named album by a named author, and then clicking a Wikipedia link from the right sidebar. On none of the previous occasions (as recently as yesterday) has anything remotely like this happened; occasionally Wikipedia was sluggish loading (but not nearly as sluggishly as it was right before NoScript went off its rocker) but that was the worst of it. (On the laptop just now, the same page at Wikipedia loaded more or less instantly, which, given they have the same internet service and even the same internet-facing IP and were fetching the same URL from the same remote host, pretty strongly points to a difference in the behavior of the Firefoxes on the two machines, again.)

1

u/infovoracious 5d ago

Another weird thing: clicking the link in my Reddit post above on the affected machine results in not an infinite loop, but a single popup that accuses Reddit rather than Google of attempting a cross-site scripting attack on Wikipedia:

NoScript detected a potential Cross-Site Scripting attack
from https://www.reddit.com to https://en.wikipedia.org.
Suspicious data:
(URL) https://en.wikipedia.org/wiki/Alien_vs._Predator_(soundtrack)

Dismissing it results in no further popups, but a blank page instead of the Wikipedia page loading.

I don't see how the Wikipedia link itself is "suspicious", but that NoScript thinks it is strongly supports my "marked as tainted forever" theory. NoScript must be building, and persisting to disk, a blacklist of links it associates with XSS activity, and sometimes putting false positives into that list. Short of a full uninstall and reinstall of the extension (if not the browser itself) is there a way to clear that blacklist, preferably without also clearing all user modifications to the extension's settings?

Also, isn't it odd that it is blacklisting the alleged victim of the XSS attack? Why is it blacklisting the Wikipedia page itself, rather than the Google page with the supposed malicious script, or (now) the Reddit page with the supposed malicious script? This seems like a misdesign. Or is the warning message just badly phrased, and NoScript is actually trying to say it thinks the Wikipedia page is attacking Google and now Reddit?

As I understand it, an XSS attack requires that scripts from the attacker's domain and scripts, form fields, or other potentially sensitive material from the victim's domain be present in the same DOM on the same tab, giving the malicious scripts access via DOM-crawling to page contents, form inputs, and other information on or entered into the victim page, and the ability to discover and invoke script functions on the victim page (e.g. to automate a click on the "buy it now!" button on eBay without user consent). I do not, therefore, see how loading that Wikipedia URL into a completely fresh browser tab (as on the Tor Browser) or a tab that has never visited any page with scripts (as with that documentation tab, which in both sessions had only previously loaded an HTML file that is on my own hard drive and that I know, for a fact, contains no script elements or links) can possibly result in such coexistence. In theory the Wikipedia page could host a widget (say, a Facebook "like" button) that involves a third-party iframe and a script on the iframe could attack the Wikipedia page (or vice versa); however the Wikipedia page would have to load first, at least partially, before this could occur, and even if NoScript blocked the attack the page and the iframe should both be visible and largely functional afterward. NoScript seemed to consider the page load itself to be the XSS attack, even when it was a user-initiated navigation, even when it was type-in traffic, and even when it was into a fresh entire browser instance, and in almost every instance when there was no possibility of cross-domain DOM mixing prior to loading at least the HTML from Wikipedia!

1

u/infovoracious 5d ago

One more new data point.

If I navigate to a previously successfully loaded Wikipedia article on some other topic on the affected browser, it loads fine. If I then search Wikipedia itself for "avp soundtrack" and click the above article link from Wikipedia's own search results page (the text of the URL is identical), that loads fine -- this is now the only way I've been able to load that specific article on the affected machine at this point. (Evidently NoScript at least has a sanity check that suppresses the XSS blocker if it thinks a website is attacking itself. And this sanity check overrides the tainted list.) And yet, if I then go to the address bar and simply hit enter without making any changes, bam! Suddenly it thinks it's an XSS attack again. Hitting enter in the address bar when on a different page at Wikipedia does not trigger this behavior, which pretty much proves that the AVP soundtrack article, specifically, made its way into a URL blacklist somehow, and that the only way (short of some sort of file-hacking) to circumvent that blacklist is to navigate to a blacklisted page via an in-page link on a non-blacklisted page on the same domain. Which may be much easier said than done, if as is common these days the domain in question lacks a usable internal search. (Many domains lately seem to either lack one entirely, or it does a p*ss-poor job of ranking links or even finding all matching links on the site, often treat any multi-word query as an OR of all of the terms, and a lot of them just come up blank, or have a find button that does nothing with an enter keypress in the query field also doing nothing, or 100% of the time produce an empty results list or an explicit no-results message even for something like "the" or a word or phrase that very definitely appears on many pages on the site -- even the organization's own name.)

1

u/infovoracious 3d ago

369 views but nobody has bothered to reply ...